ADd support for select instructions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12316 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 396cc69..e78eef6 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -140,6 +140,7 @@
     void visitBinaryOperator(Instruction &I);
 
     void visitCastInst (CastInst &I);
+    void visitSelectInst(SelectInst &I);
     void visitCallInst (CallInst &I);
     void visitCallSite (CallSite CS);
     void visitShiftInst(ShiftInst &I) { visitBinaryOperator(I); }
@@ -1185,6 +1186,17 @@
   writeOperand(I.getOperand(0));
 }
 
+void CWriter::visitSelectInst(SelectInst &I) {
+  Out << "((";
+  writeOperand(I.getCondition());
+  Out << ") ? (";
+  writeOperand(I.getTrueValue());
+  Out << ") : (";
+  writeOperand(I.getFalseValue());
+  Out << "))";    
+}
+
+
 void CWriter::lowerIntrinsics(Module &M) {
   for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F)
     for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB)