diff options
| author | John Criswell <criswell@uiuc.edu> | 2005-05-11 21:16:42 +0000 |
|---|---|---|
| committer | John Criswell <criswell@uiuc.edu> | 2005-05-11 21:16:42 +0000 |
| commit | 72002e87cc7bcd2e1be60ffa158cd61c88c80696 (patch) | |
| tree | 03871f02b957dbc6ca8bfe53542da81e8dbc6042 /llvm/lib/Target | |
| parent | 991ce367980b4d9980c13a387c0d3a39290f3ba4 (diff) | |
| download | bcm5719-llvm-72002e87cc7bcd2e1be60ffa158cd61c88c80696.tar.gz bcm5719-llvm-72002e87cc7bcd2e1be60ffa158cd61c88c80696.zip | |
Added support for decomposing constant expressions containing shr and shl
instructions.
Review of this commit would be greatly appreciated.
llvm-svn: 21876
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp b/llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp index 7e801243ae3..a13019e2061 100644 --- a/llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp +++ b/llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp @@ -146,6 +146,30 @@ static Instruction* DecomposeConstantExpr(ConstantExpr* CE, return new SelectInst (C, S1, S2, "constantSelect", &insertBefore); } + case Instruction::Shr: { + getArg1 = CE->getOperand(0); + if (ConstantExpr* CEarg = dyn_cast<ConstantExpr>(getArg1)) + getArg1 = DecomposeConstantExpr(CEarg, insertBefore); + getArg2 = CE->getOperand(1); + if (ConstantExpr* CEarg = dyn_cast<ConstantExpr>(getArg2)) + getArg2 = DecomposeConstantExpr(CEarg, insertBefore); + return new ShiftInst (static_cast<Instruction::OtherOps>(CE->getOpcode()), + getArg1, getArg2, + "constantShr:" + getArg1->getName(), &insertBefore); + } + + case Instruction::Shl: { + getArg1 = CE->getOperand(0); + if (ConstantExpr* CEarg = dyn_cast<ConstantExpr>(getArg1)) + getArg1 = DecomposeConstantExpr(CEarg, insertBefore); + getArg2 = CE->getOperand(1); + if (ConstantExpr* CEarg = dyn_cast<ConstantExpr>(getArg2)) + getArg2 = DecomposeConstantExpr(CEarg, insertBefore); + return new ShiftInst (static_cast<Instruction::OtherOps>(CE->getOpcode()), + getArg1, getArg2, + "constantShl:" + getArg1->getName(), &insertBefore); + } + default: // must be a binary operator assert(CE->getOpcode() >= Instruction::BinaryOpsBegin && CE->getOpcode() < Instruction::BinaryOpsEnd && |

