diff options
author | Chris Lattner <sabre@nondot.org> | 2002-08-22 15:57:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-08-22 15:57:58 +0000 |
commit | abfb0b5e70d26859cd06fb005eb82ca91e276cd5 (patch) | |
tree | 9e9832f57fa5ececfc9e09c7dc860bea2383e38e | |
parent | dc58535b37790e0779cb59c74bbf8435c16c0bd7 (diff) |
Change code to not use the copyOperands method added to User. It's now
more efficient to boot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3453 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/SparcV9/SparcV9AsmPrinter.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp index 680e7d20b5..f3de79d101 100644 --- a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp +++ b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp @@ -191,19 +191,21 @@ public: // std::string ConstantExprToString(const ConstantExpr* CE, const TargetMachine& target) { - std::string S(""); + std::string S; switch(CE->getOpcode()) { case Instruction::GetElementPtr: { const Value* ptrVal = CE->getOperand(0); valToExprString(ptrVal, target, S); - std::vector<Value*> idxVec = CE->copyOperands(); - idxVec.erase(idxVec.begin()); - uint64_t byteOffset = target.DataLayout.getIndexedOffset(ptrVal->getType(), - idxVec); - uint64_t eltSize = target.DataLayout.getTypeSize( - cast<PointerType>(ptrVal->getType())->getElementType()); + std::vector<Value*> idxVec(CE->op_begin()+1, CE->op_end()); + uint64_t byteOffset = + target.DataLayout.getIndexedOffset(ptrVal->getType(), idxVec); + + const Type *PtrElTy = + cast<PointerType>(ptrVal->getType())->getElementType(); + uint64_t eltSize = target.DataLayout.getTypeSize(PtrElTy); + S += " + " + utostr(byteOffset / eltSize); break; } |