Mercurial > projects > ldc
diff gen/abi.h @ 1024:9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 03 Mar 2009 02:51:21 +0100 |
parents | e8c6dbcd33d1 |
children | 45af482e3832 |
line wrap: on
line diff
--- a/gen/abi.h Sun Mar 01 22:40:15 2009 +0100 +++ b/gen/abi.h Tue Mar 03 02:51:21 2009 +0100 @@ -4,6 +4,7 @@ #include <vector> struct Type; +struct IrFuncTyArg; namespace llvm { class Type; @@ -11,38 +12,27 @@ } // return rewrite rule -struct ABIRetRewrite +struct ABIRewrite { // get original value from rewritten one - virtual LLValue* get(LLValue* v) = 0; + virtual LLValue* get(Type* dty, LLValue* v) = 0; // rewrite original value - virtual LLValue* put(LLValue* v) = 0; + virtual LLValue* put(Type* dty, LLValue* v) = 0; // returns target type of this rewrite - virtual const LLType* type(const LLType* t) = 0; - - // test if rewrite applies - virtual bool test(TypeFunction* tf) = 0; + virtual const LLType* type(Type* dty, const LLType* t) = 0; }; - // interface called by codegen struct TargetABI { static TargetABI* getTarget(); - TargetABI(); - - const llvm::Type* getRetType(TypeFunction* tf, const llvm::Type* t); - llvm::Value* getRet(TypeFunction* tf, llvm::Value* v); - llvm::Value* putRet(TypeFunction* tf, llvm::Value* v); + virtual bool returnInArg(TypeFunction* tf) = 0; + virtual bool passByVal(Type* t) = 0; - virtual bool returnInArg(TypeFunction* t) = 0; - -protected: - std::vector<ABIRetRewrite*> retOps; - ABIRetRewrite* findRetRewrite(TypeFunction* tf); + virtual void rewriteFunctionType(TypeFunction* t) = 0; }; #endif