diff options
author | Brian Gaeke <gaeke@uiuc.edu> | 2004-04-02 17:52:29 +0000 |
---|---|---|
committer | Brian Gaeke <gaeke@uiuc.edu> | 2004-04-02 17:52:29 +0000 |
commit | 142e22a5f497ff33baff6819c8a7d686fa28c7f5 (patch) | |
tree | f562b28ce4cd975dbaf89096c921b85064a751d9 | |
parent | fb4b96e77e2930bf3d0c148f1c3685b6a4434666 (diff) |
Add support for constant select expressions. Clarify the assertion failure msg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12613 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/SparcV9/SparcV9PreSelection.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/Target/SparcV9/SparcV9PreSelection.cpp b/lib/Target/SparcV9/SparcV9PreSelection.cpp index 90a5fa782c..9677b45a2e 100644 --- a/lib/Target/SparcV9/SparcV9PreSelection.cpp +++ b/lib/Target/SparcV9/SparcV9PreSelection.cpp @@ -104,7 +104,7 @@ static Instruction* DecomposeConstantExpr(ConstantExpr* CE, Instruction& insertBefore) { Value *getArg1, *getArg2; - + switch(CE->getOpcode()) { case Instruction::Cast: @@ -124,11 +124,25 @@ static Instruction* DecomposeConstantExpr(ConstantExpr* CE, return new GetElementPtrInst(getArg1, std::vector<Value*>(CE->op_begin()+1, CE->op_end()), "constantGEP", &insertBefore); - + + case Instruction::Select: { + Value *C, *S1, *S2; + C = CE->getOperand (0); + if (ConstantExpr* CEarg = dyn_cast<ConstantExpr> (C)) + C = DecomposeConstantExpr (CEarg, insertBefore); + S1 = CE->getOperand (1); + if (ConstantExpr* CEarg = dyn_cast<ConstantExpr> (S1)) + S1 = DecomposeConstantExpr (CEarg, insertBefore); + S2 = CE->getOperand (2); + if (ConstantExpr* CEarg = dyn_cast<ConstantExpr> (S2)) + S2 = DecomposeConstantExpr (CEarg, insertBefore); + return new SelectInst (C, S1, S2); + } + default: // must be a binary operator assert(CE->getOpcode() >= Instruction::BinaryOpsBegin && CE->getOpcode() < Instruction::BinaryOpsEnd && - "Unrecognized opcode in ConstantExpr"); + "Unhandled opcode in ConstantExpr"); getArg1 = CE->getOperand(0); if (ConstantExpr* CEarg = dyn_cast<ConstantExpr>(getArg1)) getArg1 = DecomposeConstantExpr(CEarg, insertBefore); |