[llvm-commits] [llvm-gcc-4.2] r46375 - /llvm-gcc-4.2/trunk/gcc/llvm-abi.h

Evan Cheng evan.cheng at apple.com
Fri Jan 25 15:02:28 PST 2008


Author: evancheng
Date: Fri Jan 25 17:02:28 2008
New Revision: 46375

URL: http://llvm.org/viewvc/llvm-project?rev=46375&view=rev
Log:
Drop zero-sized aggregate arguments.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-abi.h

Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=46375&r1=46374&r2=46375&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Fri Jan 25 17:02:28 2008
@@ -120,6 +120,13 @@
   }
 }
 
+/// isAggregareOfSizeZero - Returns true if this is an aggregate with size zero.
+///
+static bool isAggregareOfSizeZero(tree type) {
+  if (!isAggregateTreeType(type)) return false;
+  return int_size_in_bytes(type) == 0;
+}
+
 // LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR - Return true if this aggregate
 // value should be passed by value, i.e. passing its address with the byval
 // attribute bit set. The default is false.
@@ -227,6 +234,9 @@
         PassInMixedRegisters(type, Ty, Elts);
       } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) {
         PassInIntegerRegisters(type, Ty);
+      } else if (isAggregareOfSizeZero(type)) {
+        // Zero sized aggregare, just drop it!
+        ;
       } else if (TREE_CODE(type) == RECORD_TYPE) {
         for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field))
           if (TREE_CODE(Field) == FIELD_DECL) {





More information about the llvm-commits mailing list