Mercurial > projects > ldc
comparison gen/classes.cpp @ 1013:8c73ff5f69e0
Use llvm::CallSite instead of custom CallOrInvoke class.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sat, 28 Feb 2009 22:16:52 +0100 |
parents | 03d7c4aac654 |
children | 6bb04dbee21f |
comparison
equal
deleted
inserted
replaced
1012:39cf8fa483fd | 1013:8c73ff5f69e0 |
---|---|
917 // default allocator | 917 // default allocator |
918 else | 918 else |
919 { | 919 { |
920 llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_allocclass"); | 920 llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_allocclass"); |
921 LLConstant* ci = DtoBitCast(tc->sym->ir.irStruct->classInfo, DtoType(ClassDeclaration::classinfo->type)); | 921 LLConstant* ci = DtoBitCast(tc->sym->ir.irStruct->classInfo, DtoType(ClassDeclaration::classinfo->type)); |
922 mem = gIR->CreateCallOrInvoke(fn, ci, ".newclass_gc_alloc")->get(); | 922 mem = gIR->CreateCallOrInvoke(fn, ci, ".newclass_gc_alloc").getInstruction(); |
923 mem = DtoBitCast(mem, DtoType(tc), ".newclass_gc"); | 923 mem = DtoBitCast(mem, DtoType(tc), ".newclass_gc"); |
924 } | 924 } |
925 | 925 |
926 // init | 926 // init |
927 DtoInitClass(tc, mem); | 927 DtoInitClass(tc, mem); |
1135 // this could happen in user code as well :/ | 1135 // this could happen in user code as well :/ |
1136 cinfo = DtoBitCast(cinfo, funcTy->getParamType(1)); | 1136 cinfo = DtoBitCast(cinfo, funcTy->getParamType(1)); |
1137 assert(funcTy->getParamType(1) == cinfo->getType()); | 1137 assert(funcTy->getParamType(1) == cinfo->getType()); |
1138 | 1138 |
1139 // call it | 1139 // call it |
1140 LLValue* ret = gIR->CreateCallOrInvoke2(func, obj, cinfo, "tmp")->get(); | 1140 LLValue* ret = gIR->CreateCallOrInvoke2(func, obj, cinfo, "tmp").getInstruction(); |
1141 | 1141 |
1142 // cast return value | 1142 // cast return value |
1143 ret = DtoBitCast(ret, DtoType(_to)); | 1143 ret = DtoBitCast(ret, DtoType(_to)); |
1144 | 1144 |
1145 return new DImValue(_to, ret); | 1145 return new DImValue(_to, ret); |
1158 // void* p | 1158 // void* p |
1159 LLValue* tmp = val->getRVal(); | 1159 LLValue* tmp = val->getRVal(); |
1160 tmp = DtoBitCast(tmp, funcTy->getParamType(0)); | 1160 tmp = DtoBitCast(tmp, funcTy->getParamType(0)); |
1161 | 1161 |
1162 // call it | 1162 // call it |
1163 LLValue* ret = gIR->CreateCallOrInvoke(func, tmp, "tmp")->get(); | 1163 LLValue* ret = gIR->CreateCallOrInvoke(func, tmp, "tmp").getInstruction(); |
1164 | 1164 |
1165 // cast return value | 1165 // cast return value |
1166 if (to != NULL) | 1166 if (to != NULL) |
1167 ret = DtoBitCast(ret, DtoType(to)); | 1167 ret = DtoBitCast(ret, DtoType(to)); |
1168 else | 1168 else |
1198 // unfortunately this is needed as the implementation of object differs somehow from the declaration | 1198 // unfortunately this is needed as the implementation of object differs somehow from the declaration |
1199 // this could happen in user code as well :/ | 1199 // this could happen in user code as well :/ |
1200 cinfo = DtoBitCast(cinfo, funcTy->getParamType(1)); | 1200 cinfo = DtoBitCast(cinfo, funcTy->getParamType(1)); |
1201 | 1201 |
1202 // call it | 1202 // call it |
1203 LLValue* ret = gIR->CreateCallOrInvoke2(func, ptr, cinfo, "tmp")->get(); | 1203 LLValue* ret = gIR->CreateCallOrInvoke2(func, ptr, cinfo, "tmp").getInstruction(); |
1204 | 1204 |
1205 // cast return value | 1205 // cast return value |
1206 ret = DtoBitCast(ret, DtoType(_to)); | 1206 ret = DtoBitCast(ret, DtoType(_to)); |
1207 | 1207 |
1208 return new DImValue(_to, ret); | 1208 return new DImValue(_to, ret); |