comparison gen/structs.h @ 213:7816aafeea3c trunk

[svn r229] Updated the object.d implementation to the latest Tango. Fixed a bunch of the built-in typeinfos for arrays, they did not inherit TypeInfo_Array. Applied patch to tango/text/convert/Layout.d by fvbommel, closes #47 . Cleaned up some type code. Replaced uses of llvm::Type with LLType (a typedef), same for Value and Constant. Fixed a few cases where typeinfo for user structs could be emitted multiple times, seems to still be some cases of this :/
author lindquist
date Fri, 30 May 2008 19:32:04 +0200
parents 027b8d8b71ec
children 0806379a5eca
comparison
equal deleted inserted replaced
212:4c2689d57ba4 213:7816aafeea3c
1 #ifndef LLVMD_GEN_STRUCTS_H 1 #ifndef LLVMD_GEN_STRUCTS_H
2 #define LLVMD_GEN_STRUCTS_H 2 #define LLVMD_GEN_STRUCTS_H
3 3
4 struct StructInitializer; 4 struct StructInitializer;
5 5
6 const llvm::Type* DtoStructType(Type* t); 6 const LLType* DtoStructType(Type* t);
7 7
8 llvm::Value* DtoStructZeroInit(llvm::Value* v); 8 LLValue* DtoStructZeroInit(LLValue* v);
9 llvm::Value* DtoStructCopy(llvm::Value* dst, llvm::Value* src); 9 LLValue* DtoStructCopy(LLValue* dst, LLValue* src);
10 10
11 llvm::Constant* DtoConstStructInitializer(StructInitializer* si); 11 LLConstant* DtoConstStructInitializer(StructInitializer* si);
12 12
13 /** 13 /**
14 * Resolves the llvm type for a struct 14 * Resolves the llvm type for a struct
15 */ 15 */
16 void DtoResolveStruct(StructDeclaration* sd); 16 void DtoResolveStruct(StructDeclaration* sd);
28 /** 28 /**
29 * Provides the llvm definition for a struct 29 * Provides the llvm definition for a struct
30 */ 30 */
31 void DtoDefineStruct(StructDeclaration* sd); 31 void DtoDefineStruct(StructDeclaration* sd);
32 32
33 llvm::Value* DtoIndexStruct(llvm::Value* ptr, StructDeclaration* sd, Type* t, unsigned os, std::vector<unsigned>& idxs); 33 LLValue* DtoIndexStruct(LLValue* ptr, StructDeclaration* sd, Type* t, unsigned os, std::vector<unsigned>& idxs);
34 34
35 struct DUnionField 35 struct DUnionField
36 { 36 {
37 unsigned offset; 37 unsigned offset;
38 size_t size; 38 size_t size;
39 std::vector<const llvm::Type*> types; 39 std::vector<const LLType*> types;
40 llvm::Constant* init; 40 LLConstant* init;
41 size_t initsize; 41 size_t initsize;
42 42
43 DUnionField() { 43 DUnionField() {
44 offset = 0; 44 offset = 0;
45 size = 0; 45 size = 0;
49 }; 49 };
50 50
51 struct DUnionIdx 51 struct DUnionIdx
52 { 52 {
53 unsigned idx,idxos; 53 unsigned idx,idxos;
54 llvm::Constant* c; 54 LLConstant* c;
55 55
56 DUnionIdx() 56 DUnionIdx()
57 : idx(0), c(0) {} 57 : idx(0), c(0) {}
58 DUnionIdx(unsigned _idx, unsigned _idxos, llvm::Constant* _c) 58 DUnionIdx(unsigned _idx, unsigned _idxos, LLConstant* _c)
59 : idx(_idx), idxos(_idxos), c(_c) {} 59 : idx(_idx), idxos(_idxos), c(_c) {}
60 bool operator<(const DUnionIdx& i) const { 60 bool operator<(const DUnionIdx& i) const {
61 return (idx < i.idx) || (idx == i.idx && idxos < i.idxos); 61 return (idx < i.idx) || (idx == i.idx && idxos < i.idxos);
62 } 62 }
63 }; 63 };
65 class DUnion 65 class DUnion
66 { 66 {
67 std::vector<DUnionField> fields; 67 std::vector<DUnionField> fields;
68 public: 68 public:
69 DUnion(); 69 DUnion();
70 llvm::Constant* getConst(std::vector<DUnionIdx>& in); 70 LLConstant* getConst(std::vector<DUnionIdx>& in);
71 }; 71 };
72 72
73 #endif 73 #endif