|
Revision 1359:34f2fd925de3, 1.2 kB
(checked in by Frits van Bommel <fvbommel wxs.nl>, 3 years ago)
|
Intrinsics shouldn't see struct padding, so use a special TargetABI for them
that removes it.
This unbreaks the llvm_*_with_overflow intrinsics.
|
| Line | |
|---|
| 1 |
#ifndef __LDC_GEN_ABI_H__ |
|---|
| 2 |
#define __LDC_GEN_ABI_H__ |
|---|
| 3 |
|
|---|
| 4 |
#include <vector> |
|---|
| 5 |
|
|---|
| 6 |
struct Type; |
|---|
| 7 |
struct IrFuncTyArg; |
|---|
| 8 |
struct DValue; |
|---|
| 9 |
|
|---|
| 10 |
namespace llvm |
|---|
| 11 |
{ |
|---|
| 12 |
class Type; |
|---|
| 13 |
class Value; |
|---|
| 14 |
} |
|---|
| 15 |
|
|---|
| 16 |
// return rewrite rule |
|---|
| 17 |
struct ABIRewrite |
|---|
| 18 |
{ |
|---|
| 19 |
/// get a rewritten value back to its original form |
|---|
| 20 |
virtual LLValue* get(Type* dty, DValue* v) = 0; |
|---|
| 21 |
|
|---|
| 22 |
/// get a rewritten value back to its original form and store result in provided lvalue |
|---|
| 23 |
/// this one is optional and defaults to calling the one above |
|---|
| 24 |
virtual void getL(Type* dty, DValue* v, llvm::Value* lval); |
|---|
| 25 |
|
|---|
| 26 |
/// put out rewritten value |
|---|
| 27 |
virtual LLValue* put(Type* dty, DValue* v) = 0; |
|---|
| 28 |
|
|---|
| 29 |
/// should return the transformed type for this rewrite |
|---|
| 30 |
virtual const LLType* type(Type* dty, const LLType* t) = 0; |
|---|
| 31 |
}; |
|---|
| 32 |
|
|---|
| 33 |
// interface called by codegen |
|---|
| 34 |
struct TargetABI |
|---|
| 35 |
{ |
|---|
| 36 |
/// Returns the ABI for the target we're compiling for |
|---|
| 37 |
static TargetABI* getTarget(); |
|---|
| 38 |
/// Returns the ABI for intrinsics |
|---|
| 39 |
static TargetABI* getIntrinsic(); |
|---|
| 40 |
|
|---|
| 41 |
virtual void newFunctionType(TypeFunction* tf) {} |
|---|
| 42 |
virtual bool returnInArg(TypeFunction* tf) = 0; |
|---|
| 43 |
virtual bool passByVal(Type* t) = 0; |
|---|
| 44 |
virtual void doneWithFunctionType() {} |
|---|
| 45 |
|
|---|
| 46 |
virtual void rewriteFunctionType(TypeFunction* t) = 0; |
|---|
| 47 |
}; |
|---|
| 48 |
|
|---|
| 49 |
#endif |
|---|