Mercurial > projects > ldc
comparison ir/irclass.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 | d1652c8fb4f6 |
comparison
equal
deleted
inserted
replaced
1528:15f1707721fa | 1529:ad7f2f1862d6 |
---|---|
38 llvm::GlobalValue::LinkageTypes _linkage = DtoExternalLinkage(aggrdecl); | 38 llvm::GlobalValue::LinkageTypes _linkage = DtoExternalLinkage(aggrdecl); |
39 | 39 |
40 const LLType* vtblTy = type->irtype->isClass()->getVtbl(); | 40 const LLType* vtblTy = type->irtype->isClass()->getVtbl(); |
41 | 41 |
42 vtbl = new llvm::GlobalVariable( | 42 vtbl = new llvm::GlobalVariable( |
43 vtblTy, true, _linkage, NULL, initname, gIR->module); | 43 *gIR->module, vtblTy, true, _linkage, NULL, initname); |
44 | 44 |
45 return vtbl; | 45 return vtbl; |
46 } | 46 } |
47 | 47 |
48 ////////////////////////////////////////////////////////////////////////////// | 48 ////////////////////////////////////////////////////////////////////////////// |
67 IrTypeClass* tc = cinfo->type->irtype->isClass(); | 67 IrTypeClass* tc = cinfo->type->irtype->isClass(); |
68 assert(tc && "invalid ClassInfo type"); | 68 assert(tc && "invalid ClassInfo type"); |
69 | 69 |
70 // classinfos cannot be constants since they're used a locks for synchronized | 70 // classinfos cannot be constants since they're used a locks for synchronized |
71 classInfo = new llvm::GlobalVariable( | 71 classInfo = new llvm::GlobalVariable( |
72 tc->getPA().get(), false, _linkage, NULL, initname, gIR->module); | 72 *gIR->module, tc->getPA().get(), false, _linkage, NULL, initname); |
73 | 73 |
74 #ifdef USE_METADATA | 74 #ifdef USE_METADATA |
75 // Generate some metadata on this ClassInfo if it's for a class. | 75 // Generate some metadata on this ClassInfo if it's for a class. |
76 | 76 |
77 ClassDeclaration* classdecl = aggrdecl->isClassDeclaration(); | 77 ClassDeclaration* classdecl = aggrdecl->isClassDeclaration(); |
87 mdVals[CD_Finalize] = LLConstantInt::get(LLType::Int1Ty, hasDestructor); | 87 mdVals[CD_Finalize] = LLConstantInt::get(LLType::Int1Ty, hasDestructor); |
88 mdVals[CD_CustomDelete] = LLConstantInt::get(LLType::Int1Ty, hasCustomDelete); | 88 mdVals[CD_CustomDelete] = LLConstantInt::get(LLType::Int1Ty, hasCustomDelete); |
89 // Construct the metadata | 89 // Construct the metadata |
90 llvm::MDNode* metadata = llvm::MDNode::get(mdVals, CD_NumFields); | 90 llvm::MDNode* metadata = llvm::MDNode::get(mdVals, CD_NumFields); |
91 // Insert it into the module | 91 // Insert it into the module |
92 new llvm::GlobalVariable(metadata->getType(), true, | 92 new llvm::GlobalVariable(*gIR->module, metadata->getType(), true, |
93 METADATA_LINKAGE_TYPE, metadata, CD_PREFIX + initname, gIR->module); | 93 METADATA_LINKAGE_TYPE, metadata, CD_PREFIX + initname); |
94 } | 94 } |
95 #endif | 95 #endif |
96 | 96 |
97 return classInfo; | 97 return classInfo; |
98 } | 98 } |
120 std::string name("_D"); | 120 std::string name("_D"); |
121 name.append(cd->mangle()); | 121 name.append(cd->mangle()); |
122 name.append("16__interfaceInfosZ"); | 122 name.append("16__interfaceInfosZ"); |
123 | 123 |
124 llvm::GlobalValue::LinkageTypes _linkage = DtoExternalLinkage(aggrdecl); | 124 llvm::GlobalValue::LinkageTypes _linkage = DtoExternalLinkage(aggrdecl); |
125 classInterfacesArray = new llvm::GlobalVariable(array_type, true, _linkage, NULL, name, classInfo); | 125 classInterfacesArray = new llvm::GlobalVariable(*gIR->module, |
126 array_type, true, _linkage, NULL, name); | |
126 | 127 |
127 return classInterfacesArray; | 128 return classInterfacesArray; |
128 } | 129 } |
129 | 130 |
130 ////////////////////////////////////////////////////////////////////////////// | 131 ////////////////////////////////////////////////////////////////////////////// |
394 mangle.append("11__interface"); | 395 mangle.append("11__interface"); |
395 mangle.append(b->base->mangle()); | 396 mangle.append(b->base->mangle()); |
396 mangle.append("6__vtblZ"); | 397 mangle.append("6__vtblZ"); |
397 | 398 |
398 llvm::GlobalVariable* GV = new llvm::GlobalVariable( | 399 llvm::GlobalVariable* GV = new llvm::GlobalVariable( |
400 *gIR->module, | |
399 vtbl_constant->getType(), | 401 vtbl_constant->getType(), |
400 true, | 402 true, |
401 _linkage, | 403 _linkage, |
402 vtbl_constant, | 404 vtbl_constant, |
403 mangle, | 405 mangle |
404 gIR->module | |
405 ); | 406 ); |
406 | 407 |
407 // insert into the vtbl map | 408 // insert into the vtbl map |
408 interfaceVtblMap.insert(std::make_pair(b->base, GV)); | 409 interfaceVtblMap.insert(std::make_pair(b->base, GV)); |
409 | 410 |