mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-06 04:13:17 +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:
45
ir/irvar.cpp
45
ir/irvar.cpp
@@ -12,44 +12,6 @@
|
||||
#include "gen/irstate.h"
|
||||
#include "ir/irvar.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IrVar::IrVar(VarDeclaration* var)
|
||||
{
|
||||
V = var;
|
||||
value = NULL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IrGlobal::IrGlobal(VarDeclaration* v): IrVar(v)
|
||||
{
|
||||
type = NULL;
|
||||
constInit = NULL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IrLocal::IrLocal(VarDeclaration* v) : IrVar(v)
|
||||
{
|
||||
nestedIndex = -1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IrParameter::IrParameter(VarDeclaration* v) : IrLocal(v), arg(0), isVthis(false)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -69,14 +31,11 @@ IrField::IrField(VarDeclaration* v) : IrVar(v)
|
||||
index = 0;
|
||||
unionOffset = v->offset;
|
||||
}
|
||||
constInit = NULL;
|
||||
}
|
||||
|
||||
extern LLConstant* get_default_initializer(
|
||||
VarDeclaration* vd,
|
||||
Initializer* init);
|
||||
extern LLConstant* get_default_initializer(VarDeclaration* vd, Initializer* init);
|
||||
|
||||
llvm::Constant * IrField::getDefaultInit()
|
||||
llvm::Constant* IrField::getDefaultInit()
|
||||
{
|
||||
if (constInit)
|
||||
return constInit;
|
||||
|
||||
Reference in New Issue
Block a user