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

Duncan Sands baldrick at free.fr
Wed Dec 2 02:19:11 PST 2009


Author: baldrick
Date: Wed Dec  2 04:19:10 2009
New Revision: 90315

URL: http://llvm.org/viewvc/llvm-project?rev=90315&view=rev
Log:
Aggregate types are never used as unary or binary right-hand-sides
for gimple assignment.  Simplify code using this.

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=90315&r1=90314&r2=90315&view=diff

==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Wed Dec  2 04:19:10 2009
@@ -1169,6 +1169,10 @@
 /// DestLoc.
 void TreeToLLVM::EmitAggregate(tree exp, const MemRef &DestLoc) {
   assert(AGGREGATE_TYPE_P(TREE_TYPE(exp)) && "Expected an aggregate type!");
+  if (TREE_CODE(exp) == CONSTRUCTOR) {
+    EmitCONSTRUCTOR(exp, &DestLoc);
+    return;
+  }
   LValue LV = EmitLV(exp);
   assert(!LV.isBitfield() && "Bitfields containing aggregates not supported!");
   EmitAggregateCopy(DestLoc, MemRef(LV.Ptr, LV.getAlignment(),
@@ -6810,11 +6814,11 @@
 void TreeToLLVM::RenderGIMPLE_ASSIGN(gimple stmt) {
   tree lhs = gimple_assign_lhs(stmt);
   if (AGGREGATE_TYPE_P(TREE_TYPE(lhs))) {
+    assert(get_gimple_rhs_class(gimple_expr_code(stmt)) == GIMPLE_SINGLE_RHS &&
+           "Aggregate type but rhs not simple!");
     LValue LV = EmitLV(lhs);
     MemRef NewLoc(LV.Ptr, LV.getAlignment(), TREE_THIS_VOLATILE(lhs));
-    // TODO: This case can presumably only happen with special gimple
-    // assign right-hand-sides.  Try to simplify by exploiting this.
-    EmitGimpleAssignRHS(stmt, &NewLoc);
+    EmitAggregate(gimple_assign_rhs1 (stmt), NewLoc);
     return;
   }
   WriteScalarToLHS(lhs, EmitGimpleAssignRHS(stmt, 0));





More information about the llvm-commits mailing list