[llvm-commits] [llvm] r85312 - /llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp

Chris Lattner sabre at nondot.org
Tue Oct 27 14:24:48 PDT 2009


Author: lattner
Date: Tue Oct 27 16:24:48 2009
New Revision: 85312

URL: http://llvm.org/viewvc/llvm-project?rev=85312&view=rev
Log:
cppbackend support for indbr

Modified:
    llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp

Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=85312&r1=85311&r2=85312&view=diff

==============================================================================
--- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original)
+++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Tue Oct 27 16:24:48 2009
@@ -1118,13 +1118,13 @@
       break;
     }
     case Instruction::Switch: {
-      const SwitchInst* sw = cast<SwitchInst>(I);
+      const SwitchInst *SI = cast<SwitchInst>(I);
       Out << "SwitchInst* " << iName << " = SwitchInst::Create("
           << opNames[0] << ", "
           << opNames[1] << ", "
-          << sw->getNumCases() << ", " << bbname << ");";
+          << SI->getNumCases() << ", " << bbname << ");";
       nl(Out);
-      for (unsigned i = 2; i < sw->getNumOperands(); i += 2 ) {
+      for (unsigned i = 2; i != SI->getNumOperands(); i += 2) {
         Out << iName << "->addCase("
             << opNames[i] << ", "
             << opNames[i+1] << ");";
@@ -1132,6 +1132,17 @@
       }
       break;
     }
+    case Instruction::IndBr: {
+      const IndBrInst *IBI = cast<IndBrInst>(I);
+      Out << "IndBrInst *" << iName << " = IndBrInst::Create("
+          << opNames[0] << ", " << IBI->getNumDestinations() << ");";
+      nl(Out);
+      for (unsigned i = 1; i != IBI->getNumOperands(); ++i) {
+        Out << iName << "->addDestination(" << opNames[i] << ");";
+        nl(Out);
+      }
+      break;
+    }
     case Instruction::Invoke: {
       const InvokeInst* inv = cast<InvokeInst>(I);
       Out << "std::vector<Value*> " << iName << "_params;";





More information about the llvm-commits mailing list