diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/DataStructure/Local.cpp | 17 | ||||
-rw-r--r-- | lib/Target/SparcV9/SparcV9InstrSelection.cpp | 10 | ||||
-rw-r--r-- | lib/Transforms/IPO/MutateStructTypes.cpp | 6 |
3 files changed, 14 insertions, 19 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index d5c488f05c..e561aca210 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -101,7 +101,7 @@ namespace { // getSubscriptedNode - Perform the basic getelementptr functionality that // must be factored out of gep, load and store while they are all MAI's. // - DSNode *getSubscriptedNode(MemAccessInst &MAI, DSNode *Ptr); + DSNode *getSubscriptedNode(GetElementPtrInst &GEP, DSNode *Ptr); }; } @@ -218,16 +218,15 @@ DSNode *GraphBuilder::getLink(DSNode *Node, unsigned Link) { // getSubscriptedNode - Perform the basic getelementptr functionality that must // be factored out of gep, load and store while they are all MAI's. // -DSNode *GraphBuilder::getSubscriptedNode(MemAccessInst &MAI, DSNode *Ptr) { - for (unsigned i = MAI.getFirstIndexOperandNumber(), e = MAI.getNumOperands(); - i != e; ++i) - if (MAI.getOperand(i)->getType() == Type::UIntTy) +DSNode *GraphBuilder::getSubscriptedNode(GetElementPtrInst &GEP, DSNode *Ptr) { + for (unsigned i = 1, e = GEP.getNumOperands(); i != e; ++i) + if (GEP.getOperand(i)->getType() == Type::UIntTy) Ptr = getLink(Ptr, 0); - else if (MAI.getOperand(i)->getType() == Type::UByteTy) - Ptr = getLink(Ptr, cast<ConstantUInt>(MAI.getOperand(i))->getValue()); + else if (GEP.getOperand(i)->getType() == Type::UByteTy) + Ptr = getLink(Ptr, cast<ConstantUInt>(GEP.getOperand(i))->getValue()); - if (MAI.getFirstIndexOperandNumber() == MAI.getNumOperands()) - Ptr = getLink(Ptr, 0); // All MAI's have an implicit 0 if nothing else. + if (GEP.getNumOperands() == 1) + Ptr = getLink(Ptr, 0); // All GEP's have an implicit 0 if nothing else. return Ptr; } diff --git a/lib/Target/SparcV9/SparcV9InstrSelection.cpp b/lib/Target/SparcV9/SparcV9InstrSelection.cpp index 2c07df5eab..8d3c443877 100644 --- a/lib/Target/SparcV9/SparcV9InstrSelection.cpp +++ b/lib/Target/SparcV9/SparcV9InstrSelection.cpp @@ -963,7 +963,8 @@ SetOperandsForMemInstr(vector<MachineInstr*>& mvec, const InstructionNode* vmInstrNode, const TargetMachine& target) { - MemAccessInst* memInst = (MemAccessInst*) vmInstrNode->getInstruction(); + GetElementPtrInst* memInst = + cast<GetElementPtrInst>(vmInstrNode->getInstruction()); // Variables to hold the index vector and ptr value. // The major work here is to extract these for all 3 instruction types @@ -982,7 +983,7 @@ SetOperandsForMemInstr(vector<MachineInstr*>& mvec, : vmInstrNode->leftChild()); // Check if all indices are constant for this instruction - for (MemAccessInst::op_iterator OI=memInst->idx_begin(),OE=memInst->idx_end(); + for (User::op_iterator OI=memInst->idx_begin(),OE=memInst->idx_end(); allConstantIndices && OI != OE; ++OI) if (! isa<Constant>(*OI)) allConstantIndices = false; @@ -1024,7 +1025,8 @@ SetMemOperands_Internal(vector<MachineInstr*>& mvec, bool allConstantIndices, const TargetMachine& target) { - MemAccessInst* memInst = (MemAccessInst*) vmInstrNode->getInstruction(); + GetElementPtrInst* memInst = + cast<GetElementPtrInst>(vmInstrNode->getInstruction()); // Initialize so we default to storing the offset in a register. int64_t smallConstOffset = 0; @@ -1035,7 +1037,7 @@ SetMemOperands_Internal(vector<MachineInstr*>& mvec, // Check if there is an index vector and if so, compute the // right offset for structures and for arrays // - if (idxVec.size() > 0) + if (!idxVec.empty()) { const PointerType* ptrType = cast<PointerType>(ptrVal->getType()); diff --git a/lib/Transforms/IPO/MutateStructTypes.cpp b/lib/Transforms/IPO/MutateStructTypes.cpp index 2059f9f2a9..e5bad67f5e 100644 --- a/lib/Transforms/IPO/MutateStructTypes.cpp +++ b/lib/Transforms/IPO/MutateStructTypes.cpp @@ -413,15 +413,9 @@ void MutateStructTypes::transformFunction(Function *m) { break; case Instruction::Load: - assert(cast<MemAccessInst>(I).idx_begin() == - cast<MemAccessInst>(I).idx_end() && - "Indexing loads not supported!"); NewI = new LoadInst(ConvertValue(I.getOperand(0))); break; case Instruction::Store: - assert(cast<MemAccessInst>(I).idx_begin() == - cast<MemAccessInst>(I).idx_end() && - "Indexing loads not supported!"); NewI = new StoreInst(ConvertValue(I.getOperand(0)), ConvertValue(I.getOperand(1))); break; |