comparison ir/irstruct.cpp @ 1571:8d086d552909

IntegerType is now contextifed. Requires llvm >= 78969. resistor says this will be the last context API change :)
author Benjamin Kramer <benny.kra@gmail.com>
date Fri, 14 Aug 2009 00:39:18 +0200
parents 755abafbf25d
children
comparison
equal deleted inserted replaced
1570:ab03cfb3a212 1571:8d086d552909
18 18
19 ////////////////////////////////////////////////////////////////////////////// 19 //////////////////////////////////////////////////////////////////////////////
20 20
21 IrStruct::IrStruct(AggregateDeclaration* aggr) 21 IrStruct::IrStruct(AggregateDeclaration* aggr)
22 : diCompositeType(NULL), 22 : diCompositeType(NULL),
23 init_pa(llvm::OpaqueType::get()) 23 init_pa(llvm::OpaqueType::get(gIR->context()))
24 { 24 {
25 aggrdecl = aggr; 25 aggrdecl = aggr;
26 26
27 type = aggr->type; 27 type = aggr->type;
28 28
115 size_t n = constants.size(); 115 size_t n = constants.size();
116 while (diff) 116 while (diff)
117 { 117 {
118 if (global.params.is64bit && diff % 8 == 0) 118 if (global.params.is64bit && diff % 8 == 0)
119 { 119 {
120 constants.push_back(LLConstant::getNullValue(llvm::Type::Int64Ty)); 120 constants.push_back(LLConstant::getNullValue(llvm::Type::getInt64Ty(gIR->context())));
121 diff -= 8; 121 diff -= 8;
122 } 122 }
123 else if (diff % 4 == 0) 123 else if (diff % 4 == 0)
124 { 124 {
125 constants.push_back(LLConstant::getNullValue(llvm::Type::Int32Ty)); 125 constants.push_back(LLConstant::getNullValue(llvm::Type::getInt32Ty(gIR->context())));
126 diff -= 4; 126 diff -= 4;
127 } 127 }
128 else if (diff % 2 == 0) 128 else if (diff % 2 == 0)
129 { 129 {
130 constants.push_back(LLConstant::getNullValue(llvm::Type::Int16Ty)); 130 constants.push_back(LLConstant::getNullValue(llvm::Type::getInt16Ty(gIR->context())));
131 diff -= 2; 131 diff -= 2;
132 } 132 }
133 else 133 else
134 { 134 {
135 constants.push_back(LLConstant::getNullValue(llvm::Type::Int8Ty)); 135 constants.push_back(LLConstant::getNullValue(llvm::Type::getInt8Ty(gIR->context())));
136 diff -= 1; 136 diff -= 1;
137 } 137 }
138 } 138 }
139 return constants.size() - n; 139 return constants.size() - n;
140 } 140 }