mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-16 12:53:14 +01:00
Completely seperated type and symbol generation. Should fix a lot of bugs, but is not yet 100% complete.
52 lines
1.7 KiB
C++
52 lines
1.7 KiB
C++
#include "gen/llvm.h"
|
|
#include "declaration.h"
|
|
#include "ir/irvar.h"
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
IrVar::IrVar(VarDeclaration* var)
|
|
{
|
|
V = var;
|
|
value = NULL;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
IrGlobal::IrGlobal(VarDeclaration* v): IrVar(v),
|
|
type(llvm::OpaqueType::get())
|
|
{
|
|
constInit = NULL;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
IrLocal::IrLocal(VarDeclaration* v) : IrVar(v)
|
|
{
|
|
nestedIndex = -1;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
IrField::IrField(VarDeclaration* v, size_t idx, size_t offset) : IrVar(v)
|
|
{
|
|
index = idx;
|
|
unionOffset = offset;
|
|
constInit = NULL;
|
|
|
|
assert(V->ir.irField == NULL && "field for this variable already exists");
|
|
V->ir.irField = this;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////
|