mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-30 07:00:46 +03:00
Abstracted more (most) ABI details out of the normal codegen.
This commit is contained in:
parent
100815c097
commit
5dbe3ee8e2
11 changed files with 488 additions and 434 deletions
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "gen/llvm.h"
|
||||
#include "gen/tollvm.h"
|
||||
#include "gen/abi.h"
|
||||
#include "ir/irfunction.h"
|
||||
|
||||
#include <sstream>
|
||||
|
@ -9,6 +10,55 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IrFuncTyArg::IrFuncTyArg(Type* t, bool bref, unsigned a)
|
||||
{
|
||||
type = t;
|
||||
ltype = bref ? DtoType(t->pointerTo()) : DtoType(t);
|
||||
attrs = a;
|
||||
byref = bref;
|
||||
rewrite = NULL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
llvm::Value* IrFuncTy::putRet(Type* dty, llvm::Value* val)
|
||||
{
|
||||
assert(!arg_sret);
|
||||
if (ret->rewrite)
|
||||
return ret->rewrite->put(dty, val);
|
||||
return val;
|
||||
}
|
||||
|
||||
llvm::Value* IrFuncTy::getRet(Type* dty, llvm::Value* val)
|
||||
{
|
||||
assert(!arg_sret);
|
||||
if (ret->rewrite)
|
||||
return ret->rewrite->get(dty, val);
|
||||
return val;
|
||||
}
|
||||
|
||||
llvm::Value* IrFuncTy::putParam(Type* dty, int idx, llvm::Value* val)
|
||||
{
|
||||
assert(idx >= 0 && idx < args.size() && "invalid putParam");
|
||||
if (args[idx]->rewrite)
|
||||
return args[idx]->rewrite->put(dty, val);
|
||||
return val;
|
||||
}
|
||||
|
||||
llvm::Value* IrFuncTy::getParam(Type* dty, int idx, llvm::Value* val)
|
||||
{
|
||||
assert(idx >= 0 && idx < args.size() && "invalid getParam");
|
||||
if (args[idx]->rewrite)
|
||||
return args[idx]->rewrite->get(dty, val);
|
||||
return val;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IrFunction::IrFunction(FuncDeclaration* fd)
|
||||
{
|
||||
decl = fd;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue