Mercurial > projects > ldc
comparison gen/toir.cpp @ 264:a9dae3da4e87 trunk
[svn r285] Fixed D -> bool LLVM helper for floating point values.
Changed the way D-style varargs are passed, now each param should be aligned to size_t.sizeof.
author | lindquist |
---|---|
date | Sat, 14 Jun 2008 17:28:13 +0200 |
parents | 88252a1af660 |
children | 23d0d9855cad |
comparison
equal
deleted
inserted
replaced
263:2be09ee06bc7 | 264:a9dae3da4e87 |
---|---|
1119 for (int i=begin; i<arguments->dim; i++) | 1119 for (int i=begin; i<arguments->dim; i++) |
1120 { | 1120 { |
1121 Argument* argu = Argument::getNth(tf->parameters, i); | 1121 Argument* argu = Argument::getNth(tf->parameters, i); |
1122 Expression* argexp = (Expression*)arguments->data[i]; | 1122 Expression* argexp = (Expression*)arguments->data[i]; |
1123 vtypes.push_back(DtoType(argexp->type)); | 1123 vtypes.push_back(DtoType(argexp->type)); |
1124 size_t sz = getABITypeSize(vtypes.back()); | |
1125 if (sz < PTRSIZE) | |
1126 vtypes.back() = DtoSize_t(); | |
1124 } | 1127 } |
1125 const LLStructType* vtype = LLStructType::get(vtypes); | 1128 const LLStructType* vtype = LLStructType::get(vtypes); |
1126 Logger::cout() << "d-variadic argument struct type:\n" << *vtype << '\n'; | 1129 Logger::cout() << "d-variadic argument struct type:\n" << *vtype << '\n'; |
1127 LLValue* mem = new llvm::AllocaInst(vtype,"_argptr_storage",p->topallocapoint()); | 1130 LLValue* mem = new llvm::AllocaInst(vtype,"_argptr_storage",p->topallocapoint()); |
1128 | 1131 |
1130 for (int i=begin,k=0; i<arguments->dim; i++,k++) | 1133 for (int i=begin,k=0; i<arguments->dim; i++,k++) |
1131 { | 1134 { |
1132 Expression* argexp = (Expression*)arguments->data[i]; | 1135 Expression* argexp = (Expression*)arguments->data[i]; |
1133 if (global.params.llvmAnnotate) | 1136 if (global.params.llvmAnnotate) |
1134 DtoAnnotation(argexp->toChars()); | 1137 DtoAnnotation(argexp->toChars()); |
1135 DtoVariadicArgument(argexp, DtoGEPi(mem,0,k,"tmp")); | 1138 LLValue* argdst = DtoGEPi(mem,0,k); |
1139 argdst = DtoBitCast(argdst, getPtrToType(DtoType(argexp->type))); | |
1140 DtoVariadicArgument(argexp, argdst); | |
1136 } | 1141 } |
1137 | 1142 |
1138 // build type info array | 1143 // build type info array |
1139 assert(Type::typeinfo->ir.irStruct->constInit); | 1144 assert(Type::typeinfo->ir.irStruct->constInit); |
1140 const LLType* typeinfotype = DtoType(Type::typeinfo->type); | 1145 const LLType* typeinfotype = DtoType(Type::typeinfo->type); |