[llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Fri Apr 2 14:34:38 PST 2004
Changes in directory llvm/lib/Target/SparcV9:
SparcV9PreSelection.cpp updated: 1.29 -> 1.30
---
Log message:
Add support for constant select expressions. Clarify the assertion failure msg.
---
Diffs of the changes: (+17 -3)
Index: llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp:1.29 llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp:1.30
--- llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp:1.29 Thu Mar 11 13:23:15 2004
+++ llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp Fri Apr 2 11:52:29 2004
@@ -104,7 +104,7 @@
Instruction& insertBefore)
{
Value *getArg1, *getArg2;
-
+
switch(CE->getOpcode())
{
case Instruction::Cast:
@@ -124,11 +124,25 @@
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);
More information about the llvm-commits
mailing list