Files
ldc/gen/structs.h
Tomas Lindquist Olsen d03c3a7757 [svn r233] Added: -oq command line option for writing fully qualified object names.
Added: started support for x86 80bit floating point.
Changed: aggregates passed by value now use the llvm 'byval' parameter attribute, also lays ground work for
using other attributes.
Changed: eliminated a lot more std::vectorS, these showed up pretty much at the top when profiling!
Changed: performed other misc. cleanups.
Changed: halt expression now call the new llvm trap intrinsic instead of an assert(0).
Changed: dstress suite now passes -O0 by default, this only eliminates unreferenced globals, which speeds up
linking quite a bit.
2008-06-05 06:38:36 +02:00

75 lines
1.5 KiB
C++

#ifndef LLVMD_GEN_STRUCTS_H
#define LLVMD_GEN_STRUCTS_H
struct StructInitializer;
const LLType* DtoStructType(Type* t);
LLValue* DtoStructZeroInit(LLValue* v);
LLValue* DtoStructCopy(LLValue* dst, LLValue* src);
LLConstant* DtoConstStructInitializer(StructInitializer* si);
/**
* Resolves the llvm type for a struct
*/
void DtoResolveStruct(StructDeclaration* sd);
/**
* Provides the llvm declaration for a struct
*/
void DtoDeclareStruct(StructDeclaration* sd);
/**
* Constructs the constant default initializer a struct
*/
void DtoConstInitStruct(StructDeclaration* sd);
/**
* Provides the llvm definition for a struct
*/
void DtoDefineStruct(StructDeclaration* sd);
typedef LLSmallVector<unsigned, 3> DStructIndexVector;
LLValue* DtoIndexStruct(LLValue* ptr, StructDeclaration* sd, Type* t, unsigned os, DStructIndexVector& idxs);
struct DUnionField
{
unsigned offset;
size_t size;
std::vector<const LLType*> types;
LLConstant* init;
size_t initsize;
DUnionField() {
offset = 0;
size = 0;
init = NULL;
initsize = 0;
}
};
struct DUnionIdx
{
unsigned idx,idxos;
LLConstant* c;
DUnionIdx()
: idx(0), c(0) {}
DUnionIdx(unsigned _idx, unsigned _idxos, LLConstant* _c)
: idx(_idx), idxos(_idxos), c(_c) {}
bool operator<(const DUnionIdx& i) const {
return (idx < i.idx) || (idx == i.idx && idxos < i.idxos);
}
};
class DUnion
{
std::vector<DUnionField> fields;
public:
DUnion();
LLConstant* getConst(std::vector<DUnionIdx>& in);
};
#endif