diff --git a/ir/ir.cpp b/ir/ir.cpp new file mode 100644 index 00000000..dd7f611b --- /dev/null +++ b/ir/ir.cpp @@ -0,0 +1,34 @@ +#include "llvm/Target/TargetData.h" + +#include "gen/irstate.h" +#include "gen/tollvm.h" +#include "gen/functions.h" + +#include "ir/ir.h" +#include "ir/irfunction.h" + + +unsigned GetTypeAlignment(Ir* ir, Type* t) +{ + return gTargetData->getABITypeAlignment(DtoType(t)); +} + +Ir::Ir() +: irs(NULL) +{ +} + +void Ir::addFunctionBody(IrFunction * f) +{ + functionbodies.push_back(f); +} + +void Ir::emitFunctionBodies() +{ + while (!functionbodies.empty()) + { + IrFunction* irf = functionbodies.front(); + functionbodies.pop_front(); + DtoDefineFunction(irf->decl); + } +} diff --git a/ir/irsymbol.cpp b/ir/irsymbol.cpp new file mode 100644 index 00000000..2df8f06e --- /dev/null +++ b/ir/irsymbol.cpp @@ -0,0 +1 @@ +#include "ir/irsymbol.h" diff --git a/ir/irsymbol.h b/ir/irsymbol.h new file mode 100644 index 00000000..635c8da5 --- /dev/null +++ b/ir/irsymbol.h @@ -0,0 +1,20 @@ +#ifndef __LDC_IR_IRSYMBOL_H__ +#define __LDC_IR_IRSYMBOL_H__ + +#include "ir/ir.h" + +/// Base class for all symbols. +struct IrSymbol +{ + /// + IrSymbol(Ir* ir) : ir(ir) {} + + /// Migrate symbols to current module if necessary. + virtual void migrate() = 0; + +protected: + /// + Ir* ir; +}; + +#endif