[llvm-commits] [126086] Allow reg-sized structs and unions as inputs to asm.
johannes at apple.com
johannes at apple.com
Fri Apr 13 15:52:01 PDT 2007
Revision: 126086
Author: johannes
Date: 2007-04-13 15:52:00 -0700 (Fri, 13 Apr 2007)
Log Message:
-----------
Allow reg-sized structs and unions as inputs to asm.
Modified Paths:
--------------
apple-local/branches/llvm/gcc/llvm-convert.cpp
Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-04-13 22:35:30 UTC (rev 126085)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-04-13 22:52:00 UTC (rev 126086)
@@ -3638,7 +3638,20 @@
return 0;
if (AllowsReg || !AllowsMem) { // Register operand.
- Value *Op = Emit(Val, 0);
+ const Type *LLVMTy = ConvertType(type);
+ Value *Op;
+ if (!LLVMTy->isFirstClassType()) {
+ // Structs and unions are permitted here, as long as they're the
+ // same size as a register.
+ Value *Target = CreateTemporary(LLVMTy);
+ LValue LV = EmitLV(Val);
+ EmitAggregateCopy(Target, LV.Ptr, type, false, TREE_THIS_VOLATILE (Val));
+ LLVMTy = IntegerType::get(TD.getTypeSizeInBits(LLVMTy));
+ Op = new LoadInst(CastToType(Instruction::BitCast, Target,
+ PointerType::get(LLVMTy)), "tmp", CurBB);
+ } else {
+ Op = Emit(Val, 0);
+ }
CallOps.push_back(Op);
CallArgTypes.push_back(Op->getType());
} else { // Memory operand.
More information about the llvm-commits
mailing list