Fix PR149 - support constant shift expressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10167 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 98fc05b..fdd9b4b 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -396,6 +396,8 @@
case Instruction::SetLE:
case Instruction::SetGT:
case Instruction::SetGE:
+ case Instruction::Shl:
+ case Instruction::Shr:
Out << "(";
printConstant(CE->getOperand(0));
switch (CE->getOpcode()) {
@@ -410,6 +412,8 @@
case Instruction::SetLE: Out << " <= "; break;
case Instruction::SetGT: Out << " > "; break;
case Instruction::SetGE: Out << " >= "; break;
+ case Instruction::Shl: Out << " << "; break;
+ case Instruction::Shr: Out << " >> "; break;
default: assert(0 && "Illegal opcode here!");
}
printConstant(CE->getOperand(1));
diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp
index 98fc05b..fdd9b4b 100644
--- a/lib/Target/CBackend/Writer.cpp
+++ b/lib/Target/CBackend/Writer.cpp
@@ -396,6 +396,8 @@
case Instruction::SetLE:
case Instruction::SetGT:
case Instruction::SetGE:
+ case Instruction::Shl:
+ case Instruction::Shr:
Out << "(";
printConstant(CE->getOperand(0));
switch (CE->getOpcode()) {
@@ -410,6 +412,8 @@
case Instruction::SetLE: Out << " <= "; break;
case Instruction::SetGT: Out << " > "; break;
case Instruction::SetGE: Out << " >= "; break;
+ case Instruction::Shl: Out << " << "; break;
+ case Instruction::Shr: Out << " >> "; break;
default: assert(0 && "Illegal opcode here!");
}
printConstant(CE->getOperand(1));