Interface of getByValTypeAlignment differed between
authorDale Johannesen <dalej@apple.com>
Thu, 28 Feb 2008 22:31:51 +0000 (22:31 +0000)
committerDale Johannesen <dalej@apple.com>
Thu, 28 Feb 2008 22:31:51 +0000 (22:31 +0000)
generic & x86 versions; change generic to follow x86
and improve comments.  Add PPC version (not right
for non-Darwin.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47734 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/TargetLowering.cpp
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCISelLowering.h

index 4f04ce34fc6da02e1aa8c79288350439d6c6054a..a3d24cc7b422edaeb9583f868c225a03600348a0 100644 (file)
@@ -420,7 +420,8 @@ public:
   }
 
   /// getByValTypeAlignment - Return the desired alignment for ByVal aggregate
-  /// function arguments in the caller parameter area.
+  /// function arguments in the caller parameter area.  This is the actual
+  /// alignment, not its logarithm.
   virtual unsigned getByValTypeAlignment(const Type *Ty) const;
   
   /// getRegisterType - Return the type of registers that this ValueType will
index ff5289e088291ca21fb6a3d8d4473174d2d92929..61a155e978ca588e22500ebf2716d42d1776d266 100644 (file)
@@ -424,9 +424,10 @@ unsigned TargetLowering::getVectorTypeBreakdown(MVT::ValueType VT,
 }
 
 /// getByValTypeAlignment - Return the desired alignment for ByVal aggregate
-/// function arguments in the caller parameter area.
+/// function arguments in the caller parameter area.  This is the actual
+/// alignment, not its logarithm.
 unsigned TargetLowering::getByValTypeAlignment(const Type *Ty) const {
-  return Log2_32(TD->getCallFrameTypeAlignment(Ty));
+  return TD->getCallFrameTypeAlignment(Ty);
 }
 
 SDOperand TargetLowering::getPICJumpTableRelocBase(SDOperand Table,
index 5500e37aaecdc08e14ad30877f22a64880f5af74..675c96a9b9f246b699c2ac76df35a50f7ca79451 100644 (file)
@@ -351,6 +351,17 @@ PPCTargetLowering::PPCTargetLowering(PPCTargetMachine &TM)
   computeRegisterProperties();
 }
 
+/// getByValTypeAlignment - Return the desired alignment for ByVal aggregate
+/// function arguments in the caller parameter area.
+unsigned PPCTargetLowering::getByValTypeAlignment(const Type *Ty) const {
+  TargetMachine &TM = getTargetMachine();
+  // Darwin passes everything on 4 byte boundary.
+  if (TM.getSubtarget<PPCSubtarget>().isDarwin())
+    return 4;
+  // FIXME Elf TBD
+  return 4;
+}
+
 const char *PPCTargetLowering::getTargetNodeName(unsigned Opcode) const {
   switch (Opcode) {
   default: return 0;
index 3843998b508adc2e1d5abb1c04edb72e2cc47da2..9c539584a1fb9713c987f285c250fd8fde3b2216 100644 (file)
@@ -268,6 +268,11 @@ namespace llvm {
       getRegForInlineAsmConstraint(const std::string &Constraint,
                                    MVT::ValueType VT) const;
 
+    /// getByValTypeAlignment - Return the desired alignment for ByVal aggregate
+    /// function arguments in the caller parameter area.  This is the actual
+    /// alignment, not its logarithm.
+    unsigned getByValTypeAlignment(const Type *Ty) const;
+
     /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
     /// vector.  If it is invalid, don't add anything to Ops.
     virtual void LowerAsmOperandForConstraint(SDOperand Op,