comparison gen/runtime.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 30bdcfb8299e
comparison
equal deleted inserted replaced
1570:ab03cfb3a212 1571:8d086d552909
128 } 128 }
129 129
130 static const LLType* rt_dg1() 130 static const LLType* rt_dg1()
131 { 131 {
132 std::vector<const LLType*> types; 132 std::vector<const LLType*> types;
133 types.push_back(rt_ptr(LLType::Int8Ty)); 133 types.push_back(rt_ptr(LLType::getInt8Ty(gIR->context())));
134 types.push_back(rt_ptr(LLType::Int8Ty)); 134 types.push_back(rt_ptr(LLType::getInt8Ty(gIR->context())));
135 const llvm::FunctionType* fty = llvm::FunctionType::get(LLType::Int32Ty, types, false); 135 const llvm::FunctionType* fty = llvm::FunctionType::get(LLType::getInt32Ty(gIR->context()), types, false);
136 return llvm::StructType::get(gIR->context(), rt_ptr(LLType::Int8Ty), rt_ptr(fty), NULL); 136 return llvm::StructType::get(gIR->context(), rt_ptr(LLType::getInt8Ty(gIR->context())), rt_ptr(fty), NULL);
137 } 137 }
138 138
139 static const LLType* rt_dg2() 139 static const LLType* rt_dg2()
140 { 140 {
141 std::vector<const LLType*> types; 141 std::vector<const LLType*> types;
142 types.push_back(rt_ptr(LLType::Int8Ty)); 142 types.push_back(rt_ptr(LLType::getInt8Ty(gIR->context())));
143 types.push_back(rt_ptr(LLType::Int8Ty)); 143 types.push_back(rt_ptr(LLType::getInt8Ty(gIR->context())));
144 types.push_back(rt_ptr(LLType::Int8Ty)); 144 types.push_back(rt_ptr(LLType::getInt8Ty(gIR->context())));
145 const llvm::FunctionType* fty = llvm::FunctionType::get(LLType::Int32Ty, types, false); 145 const llvm::FunctionType* fty = llvm::FunctionType::get(LLType::getInt32Ty(gIR->context()), types, false);
146 return llvm::StructType::get(gIR->context(), rt_ptr(LLType::Int8Ty), rt_ptr(fty), NULL); 146 return llvm::StructType::get(gIR->context(), rt_ptr(LLType::getInt8Ty(gIR->context())), rt_ptr(fty), NULL);
147 } 147 }
148 148
149 static void LLVM_D_BuildRuntimeModule() 149 static void LLVM_D_BuildRuntimeModule()
150 { 150 {
151 Logger::println("building module"); 151 Logger::println("building module");
152 M = new llvm::Module("ldc internal runtime", gIR->context()); 152 M = new llvm::Module("ldc internal runtime", gIR->context());
153 153
154 Logger::println("building basic types"); 154 Logger::println("building basic types");
155 const LLType* voidTy = LLType::VoidTy; 155 const LLType* voidTy = LLType::getVoidTy(gIR->context());
156 const LLType* boolTy = LLType::Int1Ty; 156 const LLType* boolTy = LLType::getInt1Ty(gIR->context());
157 const LLType* byteTy = LLType::Int8Ty; 157 const LLType* byteTy = LLType::getInt8Ty(gIR->context());
158 const LLType* shortTy = LLType::Int16Ty; 158 const LLType* shortTy = LLType::getInt16Ty(gIR->context());
159 const LLType* intTy = LLType::Int32Ty; 159 const LLType* intTy = LLType::getInt32Ty(gIR->context());
160 const LLType* longTy = LLType::Int64Ty; 160 const LLType* longTy = LLType::getInt64Ty(gIR->context());
161 const LLType* sizeTy = DtoSize_t(); 161 const LLType* sizeTy = DtoSize_t();
162 162
163 Logger::println("building float types"); 163 Logger::println("building float types");
164 const LLType* floatTy = LLType::FloatTy; 164 const LLType* floatTy = LLType::getFloatTy(gIR->context());
165 const LLType* doubleTy = LLType::DoubleTy; 165 const LLType* doubleTy = LLType::getDoubleTy(gIR->context());
166 const LLType* realTy; 166 const LLType* realTy;
167 if ((global.params.cpu == ARCHx86) || (global.params.cpu == ARCHx86_64)) 167 if ((global.params.cpu == ARCHx86) || (global.params.cpu == ARCHx86_64))
168 realTy = LLType::X86_FP80Ty; 168 realTy = LLType::getX86_FP80Ty(gIR->context());
169 else 169 else
170 realTy = LLType::DoubleTy; 170 realTy = LLType::getDoubleTy(gIR->context());
171 171
172 const LLType* cfloatTy = llvm::StructType::get(gIR->context(), floatTy, floatTy, NULL); 172 const LLType* cfloatTy = llvm::StructType::get(gIR->context(), floatTy, floatTy, NULL);
173 const LLType* cdoubleTy = llvm::StructType::get(gIR->context(), doubleTy, doubleTy, NULL); 173 const LLType* cdoubleTy = llvm::StructType::get(gIR->context(), doubleTy, doubleTy, NULL);
174 const LLType* crealTy = llvm::StructType::get(gIR->context(), realTy, realTy, NULL); 174 const LLType* crealTy = llvm::StructType::get(gIR->context(), realTy, realTy, NULL);
175 175
183 const LLType* objectTy = DtoType(ClassDeclaration::object->type); 183 const LLType* objectTy = DtoType(ClassDeclaration::object->type);
184 const LLType* classInfoTy = DtoType(ClassDeclaration::classinfo->type); 184 const LLType* classInfoTy = DtoType(ClassDeclaration::classinfo->type);
185 const LLType* typeInfoTy = DtoType(Type::typeinfo->type); 185 const LLType* typeInfoTy = DtoType(Type::typeinfo->type);
186 186
187 Logger::println("building aa type"); 187 Logger::println("building aa type");
188 const LLType* aaTy = rt_ptr(llvm::OpaqueType::get()); 188 const LLType* aaTy = rt_ptr(llvm::OpaqueType::get(gIR->context()));
189 189
190 Logger::println("building functions"); 190 Logger::println("building functions");
191 191
192 ///////////////////////////////////////////////////////////////////////////////////// 192 /////////////////////////////////////////////////////////////////////////////////////
193 ///////////////////////////////////////////////////////////////////////////////////// 193 /////////////////////////////////////////////////////////////////////////////////////