[llvm-commits] [dragonegg] r90238 - /dragonegg/trunk/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Tue Dec 1 08:49:52 PST 2009


Author: baldrick
Date: Tue Dec  1 10:49:52 2009
New Revision: 90238

URL: http://llvm.org/viewvc/llvm-project?rev=90238&view=rev
Log:
The aggregate case of VIEW_CONVERT_EXPR actually handles
all cases - the generic LV code can handle taking the 
address of a scalar.

Modified:
    dragonegg/trunk/llvm-convert.cpp

Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=90238&r1=90237&r2=90238&view=diff

==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Tue Dec  1 10:49:52 2009
@@ -6249,25 +6249,12 @@
 }
 
 LValue TreeToLLVM::EmitLV_VIEW_CONVERT_EXPR(tree exp) {
-  tree Op = TREE_OPERAND(exp, 0);
-
-  if (AGGREGATE_TYPE_P(TREE_TYPE(Op))) {
-    // If the input is an aggregate, the address is the address of the operand.
-    LValue LV = EmitLV(Op);
-    // The type is the type of the expression.
-    LV.Ptr = Builder.CreateBitCast(LV.Ptr,
-                     PointerType::getUnqual(ConvertType(TREE_TYPE(exp))));
-    return LV;
-  } else {
-    // TODO: Check the VCE is being used as an rvalue, see EmitLoadOfLValue.
-    // If the input is a scalar, emit to a temporary.
-    Value *Dest = CreateTemporary(ConvertType(TREE_TYPE(Op)));
-    Builder.CreateStore(EmitGimpleReg(Op), Dest);
-    // The type is the type of the expression.
-    Dest = Builder.CreateBitCast(Dest,
-                           PointerType::getUnqual(ConvertType(TREE_TYPE(exp))));
-    return LValue(Dest, 1);
-  }
+  // The address is the address of the operand.
+  LValue LV = EmitLV(TREE_OPERAND(exp, 0));
+  // The type is the type of the expression.
+  LV.Ptr = Builder.CreateBitCast(LV.Ptr,
+                                 ConvertType(TREE_TYPE(exp))->getPointerTo());
+  return LV;
 }
 
 LValue TreeToLLVM::EmitLV_WITH_SIZE_EXPR(tree exp) {





More information about the llvm-commits mailing list