comparison gen/tocall.cpp @ 1529:ad7f2f1862d6

Adjust LDC to work with the LLVMContext LLVM changes. This means we now require a fairly new LLVM revision. I use 75234.
author Christian Kamm <kamm incasoftware de>
date Fri, 10 Jul 2009 21:30:02 +0200
parents a5526b7a5ae6
children 7fcb72d518f6
comparison
equal deleted inserted replaced
1528:15f1707721fa 1529:ad7f2f1862d6
185 // build type info array 185 // build type info array
186 const LLType* typeinfotype = DtoType(Type::typeinfo->type); 186 const LLType* typeinfotype = DtoType(Type::typeinfo->type);
187 const LLArrayType* typeinfoarraytype = LLArrayType::get(typeinfotype,vtype->getNumElements()); 187 const LLArrayType* typeinfoarraytype = LLArrayType::get(typeinfotype,vtype->getNumElements());
188 188
189 llvm::GlobalVariable* typeinfomem = 189 llvm::GlobalVariable* typeinfomem =
190 new llvm::GlobalVariable(typeinfoarraytype, true, llvm::GlobalValue::InternalLinkage, NULL, "._arguments.storage", gIR->module); 190 new llvm::GlobalVariable(*gIR->module, typeinfoarraytype, true, llvm::GlobalValue::InternalLinkage, NULL, "._arguments.storage");
191 if (Logger::enabled()) 191 if (Logger::enabled())
192 Logger::cout() << "_arguments storage: " << *typeinfomem << '\n'; 192 Logger::cout() << "_arguments storage: " << *typeinfomem << '\n';
193 193
194 std::vector<LLConstant*> vtypeinfos; 194 std::vector<LLConstant*> vtypeinfos;
195 for (int i=begin,k=0; i<n_arguments; i++,k++) 195 for (int i=begin,k=0; i<n_arguments; i++,k++)
206 std::vector<LLConstant*> pinits; 206 std::vector<LLConstant*> pinits;
207 pinits.push_back(DtoConstSize_t(vtype->getNumElements())); 207 pinits.push_back(DtoConstSize_t(vtype->getNumElements()));
208 pinits.push_back(llvm::ConstantExpr::getBitCast(typeinfomem, getPtrToType(typeinfotype))); 208 pinits.push_back(llvm::ConstantExpr::getBitCast(typeinfomem, getPtrToType(typeinfotype)));
209 const LLType* tiarrty = DtoType(Type::typeinfo->type->arrayOf()); 209 const LLType* tiarrty = DtoType(Type::typeinfo->type->arrayOf());
210 tiinits = llvm::ConstantStruct::get(pinits); 210 tiinits = llvm::ConstantStruct::get(pinits);
211 LLValue* typeinfoarrayparam = new llvm::GlobalVariable(tiarrty, 211 LLValue* typeinfoarrayparam = new llvm::GlobalVariable(*gIR->module, tiarrty,
212 true, llvm::GlobalValue::InternalLinkage, tiinits, "._arguments.array", gIR->module); 212 true, llvm::GlobalValue::InternalLinkage, tiinits, "._arguments.array");
213 213
214 llvm::AttributeWithIndex Attr; 214 llvm::AttributeWithIndex Attr;
215 // specify arguments 215 // specify arguments
216 args.push_back(DtoLoad(typeinfoarrayparam)); 216 args.push_back(DtoLoad(typeinfoarrayparam));
217 if (unsigned atts = tf->fty.arg_arguments->attrs) { 217 if (unsigned atts = tf->fty.arg_arguments->attrs) {