summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Sparc
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-08-22 15:57:58 +0000
committerChris Lattner <sabre@nondot.org>2002-08-22 15:57:58 +0000
commitf18177ea01ba7032ae63fc3071fd11c68a7efb15 (patch)
treef8574f2ccc860ebe52e51680f14b39528bedbfc7 /llvm/lib/Target/Sparc
parent5c7c19cf141b1096ccd58fe62a5dff8f5f40669d (diff)
downloadbcm5719-llvm-f18177ea01ba7032ae63fc3071fd11c68a7efb15.tar.gz
bcm5719-llvm-f18177ea01ba7032ae63fc3071fd11c68a7efb15.zip
Change code to not use the copyOperands method added to User. It's now
more efficient to boot. llvm-svn: 3453
Diffstat (limited to 'llvm/lib/Target/Sparc')
-rw-r--r--llvm/lib/Target/Sparc/EmitAssembly.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/Target/Sparc/EmitAssembly.cpp b/llvm/lib/Target/Sparc/EmitAssembly.cpp
index 680e7d20b52..f3de79d1016 100644
--- a/llvm/lib/Target/Sparc/EmitAssembly.cpp
+++ b/llvm/lib/Target/Sparc/EmitAssembly.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;
}
OpenPOWER on IntegriCloud