- Change getelementptr instruction to use long indexes instead of uint
authorChris Lattner <sabre@nondot.org>
Wed, 11 Sep 2002 01:21:35 +0000 (01:21 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 11 Sep 2002 01:21:35 +0000 (01:21 +0000)
    indexes for sequential types.

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

lib/ExecutionEngine/Interpreter/Execution.cpp
lib/Target/SparcV9/SparcV9InstrSelection.cpp

index 868bfbe5bec90a2e3a527208b69146f3b1d69796..082823ade7beb4c7bed21e4de7cff35c1bb8b49a 100644 (file)
@@ -822,7 +822,7 @@ static GenericValue executeGEPOperation(Value *Ptr, User::op_iterator I,
     } else if (const SequentialType *ST = cast<SequentialType>(Ty)) {
 
       // Get the index number for the array... which must be uint type...
-      assert((*I)->getType() == Type::UIntTy);
+      assert((*I)->getType() == Type::LongTy);
       unsigned Idx = getOperandValue(*I, SF).UIntVal;
       if (const ArrayType *AT = dyn_cast<ArrayType>(ST))
         if (Idx >= AT->getNumElements() && ArrayChecksEnabled) {
index 6c5caaf6bfff3c68c8fdd429a92dab7ccf8e8318..ce7e4dc0d925fb10deccdeb16b0fa05f288ddad4 100644 (file)
@@ -24,9 +24,6 @@
 #include <math.h>
 using std::vector;
 
-//************************* Forward Declarations ***************************/
-
-
 //************************ Internal Functions ******************************/
 
 
@@ -937,15 +934,6 @@ CreateCodeForFixedSizeAlloca(const TargetMachine& target,
 }
 
 
-
-// Check for a constant (uint) 0.
-inline bool
-IsZero(Value* idx)
-{
-  return (isa<ConstantInt>(idx) && cast<ConstantInt>(idx)->isNullValue());
-}
-
-
 //------------------------------------------------------------------------ 
 // Function SetOperandsForMemInstr
 //
@@ -1004,7 +992,8 @@ SetOperandsForMemInstr(vector<MachineInstr*>& mvec,
           // offset.  (An extra leading zero offset, if any, can be ignored.)
           // Generate code sequence to compute address from index.
           // 
-          bool firstIdxIsZero = IsZero(idxVec[0]);
+          bool firstIdxIsZero =
+            (idxVec[0] == Constant::getNullValue(idxVec[0]->getType()));
           assert(idxVec.size() == 1U + firstIdxIsZero 
                  && "Array refs must be lowered before Instruction Selection");