mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-25 00:53:14 +01:00
Small code modifications to Ir-Classes.
Adds some constructors and moves the code to the header file. Uses some of the new constructors. A big problem with the source are the different strategies used for otherwise similar classes. E.g. a IrField registers itself with the VarDeclaration. Same is required for IrParameter, but in this case it is done by the caller.
This commit is contained in:
@@ -720,8 +720,6 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
||||
Type* t = fdecl->type->toBasetype();
|
||||
TypeFunction* f = static_cast<TypeFunction*>(t);
|
||||
|
||||
IrFuncTy &irFty = fdecl->irFty;
|
||||
|
||||
if (!fdecl->ir.irFunc) {
|
||||
fdecl->ir.irFunc = new IrFunction(fdecl);
|
||||
}
|
||||
@@ -811,9 +809,9 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
||||
AppendFunctionToLLVMGlobalCtorsDtors(func, fdecl->priority, fdecl->llvmInternal == LLVMglobal_crt_ctor);
|
||||
}
|
||||
|
||||
// we never reference parameters of function prototypes
|
||||
std::string str;
|
||||
// if (!declareOnly)
|
||||
IrFuncTy &irFty = fdecl->irFty;
|
||||
|
||||
// if (!declareOnly)
|
||||
{
|
||||
// name parameters
|
||||
llvm::Function::arg_iterator iarg = func->arg_begin();
|
||||
@@ -835,12 +833,7 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
||||
// parameters below, because it can be referred to in nested
|
||||
// context types. Will be given storage in DtoDefineFunction.
|
||||
assert(!v->ir.irParam);
|
||||
IrParameter* p = new IrParameter(v);
|
||||
p->isVthis = true;
|
||||
p->value = iarg;
|
||||
p->arg = irFty.arg_this;
|
||||
|
||||
v->ir.irParam = p;
|
||||
v->ir.irParam = new IrParameter(v, iarg, irFty.arg_this, true);
|
||||
}
|
||||
|
||||
++iarg;
|
||||
@@ -861,8 +854,8 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
||||
++iarg;
|
||||
}
|
||||
|
||||
// we never reference parameters of function prototypes
|
||||
unsigned int k = 0;
|
||||
|
||||
for (; iarg != func->arg_end(); ++iarg)
|
||||
{
|
||||
if (fdecl->parameters && fdecl->parameters->dim > k)
|
||||
@@ -873,13 +866,10 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
||||
VarDeclaration* argvd = argsym->isVarDeclaration();
|
||||
assert(argvd);
|
||||
assert(!argvd->ir.irLocal);
|
||||
argvd->ir.irParam = new IrParameter(argvd);
|
||||
argvd->ir.irParam->value = iarg;
|
||||
argvd->ir.irParam->arg = irFty.args[paramIndex];
|
||||
|
||||
str = argvd->ident->toChars();
|
||||
std::string str(argvd->ident->toChars());
|
||||
str.append("_arg");
|
||||
iarg->setName(str);
|
||||
argvd->ir.irParam = new IrParameter(argvd, iarg, irFty.args[paramIndex]);
|
||||
|
||||
k++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user