mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
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
This commit is contained in:
parent
dc58535b37
commit
abfb0b5e70
@ -191,19 +191,21 @@ public:
|
|||||||
//
|
//
|
||||||
std::string ConstantExprToString(const ConstantExpr* CE,
|
std::string ConstantExprToString(const ConstantExpr* CE,
|
||||||
const TargetMachine& target) {
|
const TargetMachine& target) {
|
||||||
std::string S("");
|
std::string S;
|
||||||
|
|
||||||
switch(CE->getOpcode()) {
|
switch(CE->getOpcode()) {
|
||||||
case Instruction::GetElementPtr:
|
case Instruction::GetElementPtr:
|
||||||
{
|
{
|
||||||
const Value* ptrVal = CE->getOperand(0);
|
const Value* ptrVal = CE->getOperand(0);
|
||||||
valToExprString(ptrVal, target, S);
|
valToExprString(ptrVal, target, S);
|
||||||
std::vector<Value*> idxVec = CE->copyOperands();
|
std::vector<Value*> idxVec(CE->op_begin()+1, CE->op_end());
|
||||||
idxVec.erase(idxVec.begin());
|
uint64_t byteOffset =
|
||||||
uint64_t byteOffset = target.DataLayout.getIndexedOffset(ptrVal->getType(),
|
target.DataLayout.getIndexedOffset(ptrVal->getType(), idxVec);
|
||||||
idxVec);
|
|
||||||
uint64_t eltSize = target.DataLayout.getTypeSize(
|
const Type *PtrElTy =
|
||||||
cast<PointerType>(ptrVal->getType())->getElementType());
|
cast<PointerType>(ptrVal->getType())->getElementType();
|
||||||
|
uint64_t eltSize = target.DataLayout.getTypeSize(PtrElTy);
|
||||||
|
|
||||||
S += " + " + utostr(byteOffset / eltSize);
|
S += " + " + utostr(byteOffset / eltSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user