Generalize TargetData strings, to support more interesting forms of data.
Patch by Scott Michel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34266 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp
index 5fd3dcc..ffc0a92 100644
--- a/lib/CodeGen/ELFWriter.cpp
+++ b/lib/CodeGen/ELFWriter.cpp
@@ -255,7 +255,7 @@
   }
 
   const Type *GVType = (const Type*)GV->getType();
-  unsigned Align = TM.getTargetData()->getTypeAlignmentPref(GVType);
+  unsigned Align = TM.getTargetData()->getPrefTypeAlignment(GVType);
   unsigned Size  = TM.getTargetData()->getTypeSize(GVType);
 
   // If this global has a zero initializer, it is part of the .bss or common
diff --git a/lib/CodeGen/MachOWriter.cpp b/lib/CodeGen/MachOWriter.cpp
index fe9d997..0b7dfab 100644
--- a/lib/CodeGen/MachOWriter.cpp
+++ b/lib/CodeGen/MachOWriter.cpp
@@ -147,7 +147,7 @@
 
   // Align the output buffer to the appropriate alignment, power of 2.
   unsigned FnAlign = F->getAlignment();
-  unsigned TDAlign = TD->getTypeAlignmentPref(F->getType());
+  unsigned TDAlign = TD->getPrefTypeAlignment(F->getType());
   unsigned Align = Log2_32(std::max(FnAlign, TDAlign));
   assert(!(Align & (Align-1)) && "Alignment is not a power of two!");
 
@@ -332,7 +332,7 @@
   unsigned Size = TM.getTargetData()->getTypeSize(Ty);
   unsigned Align = GV->getAlignment();
   if (Align == 0)
-    Align = TM.getTargetData()->getTypeAlignmentPref(Ty);
+    Align = TM.getTargetData()->getPrefTypeAlignment(Ty);
   
   MachOSym Sym(GV, Mang->getValueName(GV), Sec->Index, TM);
   
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp
index 0cba156..5ae73ca 100644
--- a/lib/CodeGen/MachineFunction.cpp
+++ b/lib/CodeGen/MachineFunction.cpp
@@ -13,6 +13,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/DerivedTypes.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/CodeGen/SSARegMap.h"
@@ -123,7 +124,7 @@
   const TargetData &TD = *TM.getTargetData();
   bool IsPic = TM.getRelocationModel() == Reloc::PIC_;
   unsigned EntrySize = IsPic ? 4 : TD.getPointerSize();
-  unsigned Alignment = IsPic ? TD.getIntABIAlignment()
+  unsigned Alignment = IsPic ? TD.getABITypeAlignment(Type::Int32Ty)
                              : TD.getPointerABIAlignment();
   JumpTableInfo = new MachineJumpTableInfo(EntrySize, Alignment);
   
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 7b148f1..0bd40c2 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -3056,7 +3056,7 @@
         // new ones, as reuse may inhibit scheduling.
         const Type *Ty = MVT::getTypeForValueType(ExtraVT);
         unsigned TySize = (unsigned)TLI.getTargetData()->getTypeSize(Ty);
-        unsigned Align  = TLI.getTargetData()->getTypeAlignmentPref(Ty);
+        unsigned Align  = TLI.getTargetData()->getPrefTypeAlignment(Ty);
         MachineFunction &MF = DAG.getMachineFunction();
         int SSFI =
           MF.getFrameInfo()->CreateStackObject((unsigned)TySize, Align);
@@ -3979,7 +3979,7 @@
   MachineFrameInfo *FrameInfo = DAG.getMachineFunction().getFrameInfo();
   unsigned ByteSize = MVT::getSizeInBits(VT)/8;
   const Type *Ty = MVT::getTypeForValueType(VT);
-  unsigned StackAlign = (unsigned)TLI.getTargetData()->getTypeAlignmentPref(Ty);
+  unsigned StackAlign = (unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty);
   int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign);
   return DAG.getFrameIndex(FrameIdx, TLI.getPointerTy());
 }
@@ -4289,7 +4289,7 @@
     MachineFunction &MF = DAG.getMachineFunction();
     const Type *F64Type = MVT::getTypeForValueType(MVT::f64);
     unsigned StackAlign =
-      (unsigned)TLI.getTargetData()->getTypeAlignmentPref(F64Type);
+      (unsigned)TLI.getTargetData()->getPrefTypeAlignment(F64Type);
     int SSFI = MF.getFrameInfo()->CreateStackObject(8, StackAlign);
     // get address of 8 byte buffer
     SDOperand StackSlot = DAG.getFrameIndex(SSFI, TLI.getPointerTy());
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index e2bda6d..e72d88c 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -244,7 +244,7 @@
         const Type *Ty = AI->getAllocatedType();
         uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty);
         unsigned Align = 
-          std::max((unsigned)TLI.getTargetData()->getTypeAlignmentPref(Ty),
+          std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty),
                    AI->getAlignment());
 
         TySize *= CUI->getZExtValue();   // Get total allocated size.
@@ -1733,7 +1733,7 @@
   const Type *Ty = I.getAllocatedType();
   uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty);
   unsigned Align =
-    std::max((unsigned)TLI.getTargetData()->getTypeAlignmentPref(Ty),
+    std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty),
              I.getAlignment());
 
   SDOperand AllocSize = getValue(I.getArraySize());
@@ -2934,7 +2934,7 @@
     bool isInReg = FTy->paramHasAttr(j, FunctionType::InRegAttribute);
     bool isSRet  = FTy->paramHasAttr(j, FunctionType::StructRetAttribute);
     unsigned OriginalAlignment =
-      getTargetData()->getTypeAlignmentABI(I->getType());
+      getTargetData()->getABITypeAlignment(I->getType());
     // Flags[31:27] -> OriginalAlignment
     // Flags[2] -> isSRet
     // Flags[1] -> isInReg
@@ -3120,7 +3120,7 @@
     bool isInReg = Args[i].isInReg;
     bool isSRet  = Args[i].isSRet;
     unsigned OriginalAlignment =
-      getTargetData()->getTypeAlignmentABI(Args[i].Ty);
+      getTargetData()->getABITypeAlignment(Args[i].Ty);
     // Flags[31:27] -> OriginalAlignment
     // Flags[2] -> isSRet
     // Flags[1] -> isInReg