Convert to use the new factored out TargetData class
authorChris Lattner <sabre@nondot.org>
Mon, 27 Aug 2001 15:51:16 +0000 (15:51 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 27 Aug 2001 15:51:16 +0000 (15:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@381 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/TargetMachine/Sparc/Sparc.cpp
lib/CodeGen/TargetMachine/Sparc/SparcInstrSelection.cpp

index a9ea1da02cc5933054516a308b2f8420ab9a7c3b..4707b373b95acdbed8adc6c88ed00a5803fe9505 100644 (file)
 //---------------------------------------------------------------------------
 
 UltraSparc::UltraSparc()
-  : TargetMachine(new UltraSparcInstrInfo)
-{
+  : TargetMachine("UltraSparc-Native", new UltraSparcInstrInfo()) {
   optSizeForSubWordData = 4;
-  intSize = 4; 
-  floatSize = 4; 
-  longSize = 8; 
-  doubleSize = 8; 
-  longDoubleSize = 16; 
-  pointerSize = 8;
   minMemOpWordSize = 8; 
   maxAtomicMemOpWordSize = 8;
   zeroRegNum = 0;                      // %g0 always gives 0 on Sparc
 }
 
-UltraSparc::~UltraSparc()
-{
-  delete (UltraSparcInstrInfo*) machineInstrInfo;
+UltraSparc::~UltraSparc() {
 }
 
 //**************************************************************************/
index 95cc0ec62be9e6306dbbe0a914edd1e1501e266b..83962537ce8d0d3a574caa48a2399e5030bb2ddb 100644 (file)
@@ -1347,8 +1347,7 @@ SetMemOperands_Internal(MachineInstr* minstr,
          isConstantOffset = true;
          
          // Compute the offset value using the index vector
-         offset = MemAccessInst::getIndexedOfsetForTarget(ptrType,
-                                                      idxVec, target);
+         offset = target.DataLayout.getIndexedOffset(ptrType, idxVec);
        }
       else
        {
@@ -1359,13 +1358,12 @@ SetMemOperands_Internal(MachineInstr* minstr,
          assert(arrayOffsetVal != NULL
                 && "Expect to be given Value* for array offsets");
          
-         if (arrayOffsetVal->getValueType() == Value::ConstantVal)
-           {
+         if (ConstPoolVal *CPV = arrayOffsetVal->castConstant()) {
              isConstantOffset = true;  // always constant for structs
              assert(arrayOffsetVal->getType()->isIntegral());
-             offset = (arrayOffsetVal->getType()->isSigned())
-                       ? ((ConstPoolSInt*) arrayOffsetVal)->getValue()
-                       : (int64_t) ((ConstPoolUInt*) arrayOffsetVal)->getValue();
+             offset = (CPV->getType()->isSigned())
+                       ? ((ConstPoolSInt*)CPV)->getValue()
+                       : (int64_t) ((ConstPoolUInt*)CPV)->getValue();
            }
          else
            {