Mercurial > projects > ldc
comparison gen/toir.c @ 9:dafae18f9c08 trunk
[svn r13] * Updated for LLVM 2.1
* Class v-tables are now typesafe
* Code cleanups
author | lindquist |
---|---|
date | Mon, 01 Oct 2007 21:19:53 +0200 |
parents | 5e69b77a5c51 |
children | d3ee9efe20e2 |
comparison
equal
deleted
inserted
replaced
8:5e69b77a5c51 | 9:dafae18f9c08 |
---|---|
1244 // virtual call | 1244 // virtual call |
1245 if (fdecl->isVirtual()) { | 1245 if (fdecl->isVirtual()) { |
1246 assert(fdecl->vtblIndex > 0); | 1246 assert(fdecl->vtblIndex > 0); |
1247 assert(e1->type->ty == Tclass); | 1247 assert(e1->type->ty == Tclass); |
1248 | 1248 |
1249 const llvm::Type* vtbltype = llvm::PointerType::get(llvm::ArrayType::get(llvm::PointerType::get(llvm::Type::Int8Ty),0)); | |
1250 | |
1251 llvm::Value* zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0, false); | 1249 llvm::Value* zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0, false); |
1252 llvm::Value* vtblidx = llvm::ConstantInt::get(llvm::Type::Int32Ty, (size_t)fdecl->vtblIndex, false); | 1250 llvm::Value* vtblidx = llvm::ConstantInt::get(llvm::Type::Int32Ty, (size_t)fdecl->vtblIndex, false); |
1253 funcval = LLVM_DtoGEP(e->arg, zero, zero, "tmp", p->scopebb()); | 1251 funcval = LLVM_DtoGEP(e->arg, zero, zero, "tmp", p->scopebb()); |
1254 funcval = new llvm::LoadInst(funcval,"tmp",p->scopebb()); | 1252 funcval = new llvm::LoadInst(funcval,"tmp",p->scopebb()); |
1255 funcval = new llvm::BitCastInst(funcval, vtbltype, "tmp", p->scopebb()); | |
1256 funcval = LLVM_DtoGEP(funcval, zero, vtblidx, "tmp", p->scopebb()); | 1253 funcval = LLVM_DtoGEP(funcval, zero, vtblidx, "tmp", p->scopebb()); |
1257 funcval = new llvm::LoadInst(funcval,"tmp",p->scopebb()); | 1254 funcval = new llvm::LoadInst(funcval,"tmp",p->scopebb()); |
1258 funcval = new llvm::BitCastInst(funcval, fdecl->llvmValue->getType(), "tmp", p->scopebb()); | 1255 assert(funcval->getType() == fdecl->llvmValue->getType()); |
1256 //funcval = new llvm::BitCastInst(funcval, fdecl->llvmValue->getType(), "tmp", p->scopebb()); | |
1259 } | 1257 } |
1260 e->val = funcval; | 1258 e->val = funcval; |
1261 e->type = elem::VAL; | 1259 e->type = elem::VAL; |
1262 } | 1260 } |
1263 else { | 1261 else { |