force size of alloca to i32, which is currently required by LLVM IR.

This fixes use of alloca on 64-bit systems.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52334 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2008-06-16 17:15:14 +00:00
Родитель 1e692ace08
Коммит 9e800e3dd8
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -261,10 +261,13 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) {
return RValue::get(Builder.CreateZExt(LHS, ConvertType(E->getType()), return RValue::get(Builder.CreateZExt(LHS, ConvertType(E->getType()),
"tmp")); "tmp"));
} }
case Builtin::BI__builtin_alloca: case Builtin::BI__builtin_alloca: {
return RValue::get(Builder.CreateAlloca(llvm::Type::Int8Ty, // FIXME: LLVM IR Should allow alloca with an i64 size!
EmitScalarExpr(E->getArg(0)), Value *Size = EmitScalarExpr(E->getArg(0));
Size = Builder.CreateIntCast(Size, llvm::Type::Int32Ty, false, "tmp");
return RValue::get(Builder.CreateAlloca(llvm::Type::Int8Ty, Size,
"tmp")); "tmp"));
}
case Builtin::BI__builtin_memcpy: { case Builtin::BI__builtin_memcpy: {
Value* MemCpyOps[4] = { Value* MemCpyOps[4] = {
EmitScalarExpr(E->getArg(0)), EmitScalarExpr(E->getArg(0)),