mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
Remove use of ConstantExpr::getShift
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10792 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b16689b647
commit
c6646ebdb9
@ -324,12 +324,6 @@ static Value *RemapOperand(const Value *In,
|
||||
assert(CE->getOpcode() == Instruction::Cast);
|
||||
Value *V = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
|
||||
Result = ConstantExpr::getCast(cast<Constant>(V), CE->getType());
|
||||
} else if (CE->getOpcode() == Instruction::Shl ||
|
||||
CE->getOpcode() == Instruction::Shr) { // Shift
|
||||
Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
|
||||
Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap);
|
||||
Result = ConstantExpr::getShift(CE->getOpcode(), cast<Constant>(V1),
|
||||
cast<Constant>(V2));
|
||||
} else if (CE->getNumOperands() == 2) {
|
||||
// Binary operator...
|
||||
Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
|
||||
|
@ -324,12 +324,6 @@ static Value *RemapOperand(const Value *In,
|
||||
assert(CE->getOpcode() == Instruction::Cast);
|
||||
Value *V = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
|
||||
Result = ConstantExpr::getCast(cast<Constant>(V), CE->getType());
|
||||
} else if (CE->getOpcode() == Instruction::Shl ||
|
||||
CE->getOpcode() == Instruction::Shr) { // Shift
|
||||
Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
|
||||
Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap);
|
||||
Result = ConstantExpr::getShift(CE->getOpcode(), cast<Constant>(V1),
|
||||
cast<Constant>(V2));
|
||||
} else if (CE->getNumOperands() == 2) {
|
||||
// Binary operator...
|
||||
Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
|
||||
|
@ -74,16 +74,13 @@ Constant *llvm::ConstantFoldInstruction(Instruction *I) {
|
||||
case 0: return 0;
|
||||
}
|
||||
|
||||
if (isa<BinaryOperator>(I))
|
||||
if (isa<BinaryOperator>(I) || isa<ShiftInst>(I))
|
||||
return ConstantExpr::get(I->getOpcode(), Op0, Op1);
|
||||
|
||||
switch (I->getOpcode()) {
|
||||
default: return 0;
|
||||
case Instruction::Cast:
|
||||
return ConstantExpr::getCast(Op0, I->getType());
|
||||
case Instruction::Shl:
|
||||
case Instruction::Shr:
|
||||
return ConstantExpr::getShift(I->getOpcode(), Op0, Op1);
|
||||
case Instruction::GetElementPtr:
|
||||
std::vector<Constant*> IdxList;
|
||||
IdxList.reserve(I->getNumOperands()-1);
|
||||
|
@ -83,12 +83,6 @@ Value *llvm::MapValue(const Value *V, std::map<const Value*, Value*> &VM) {
|
||||
for (unsigned i = 1, e = CE->getNumOperands(); i != e; ++i)
|
||||
Idx.push_back(cast<Constant>(MapValue(CE->getOperand(i), VM)));
|
||||
return VMSlot = ConstantExpr::getGetElementPtr(MV, Idx);
|
||||
} else if (CE->getOpcode() == Instruction::Shl ||
|
||||
CE->getOpcode() == Instruction::Shr) {
|
||||
assert(CE->getNumOperands() == 2 && "Must be a shift!");
|
||||
Constant *MV1 = cast<Constant>(MapValue(CE->getOperand(0), VM));
|
||||
Constant *MV2 = cast<Constant>(MapValue(CE->getOperand(1), VM));
|
||||
return VMSlot = ConstantExpr::getShift(CE->getOpcode(), MV1, MV2);
|
||||
} else {
|
||||
assert(CE->getNumOperands() == 2 && "Must be binary operator?");
|
||||
Constant *MV1 = cast<Constant>(MapValue(CE->getOperand(0), VM));
|
||||
|
@ -324,12 +324,6 @@ static Value *RemapOperand(const Value *In,
|
||||
assert(CE->getOpcode() == Instruction::Cast);
|
||||
Value *V = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
|
||||
Result = ConstantExpr::getCast(cast<Constant>(V), CE->getType());
|
||||
} else if (CE->getOpcode() == Instruction::Shl ||
|
||||
CE->getOpcode() == Instruction::Shr) { // Shift
|
||||
Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
|
||||
Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap);
|
||||
Result = ConstantExpr::getShift(CE->getOpcode(), cast<Constant>(V1),
|
||||
cast<Constant>(V2));
|
||||
} else if (CE->getNumOperands() == 2) {
|
||||
// Binary operator...
|
||||
Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
|
||||
|
Loading…
Reference in New Issue
Block a user