stub out PPCMCInstLowering, add a new option that uses it and the new
instprinter when -enable-ppc-inst-printer is passed to llc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119061 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 833a83e..d1b54e4 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -20,6 +20,7 @@
 #include "PPC.h"
 #include "PPCPredicates.h"
 #include "PPCTargetMachine.h"
+#include "PPCMCInstLower.h"
 #include "PPCSubtarget.h"
 #include "llvm/Analysis/DebugInfo.h"
 #include "llvm/Constants.h"
@@ -35,6 +36,7 @@
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCInst.h"
 #include "llvm/MC/MCSectionMachO.h"
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCSymbol.h"
@@ -43,6 +45,7 @@
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Target/TargetRegistry.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -53,6 +56,11 @@
 #include "InstPrinter/PPCInstPrinter.h"
 using namespace llvm;
 
+// This option tells the asmprinter to use the new (experimental) MCInstPrinter
+// path.
+static cl::opt<bool> UseInstPrinter("enable-ppc-inst-printer",
+                                    cl::ReallyHidden);
+
 namespace {
   class PPCAsmPrinter : public AsmPrinter {
   protected:
@@ -544,6 +552,22 @@
 /// the current output stream.
 ///
 void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
+  if (UseInstPrinter) {
+    PPCMCInstLower MCInstLowering(OutContext, *Mang, *this);
+    
+    // Lower multi-instruction pseudo operations.
+    switch (MI->getOpcode()) {
+    default: break;
+    // TODO: implement me.
+    }
+
+    MCInst TmpInst;
+    MCInstLowering.Lower(MI, TmpInst);
+    OutStreamer.EmitInstruction(TmpInst);
+    return;
+  }
+  
+  
   SmallString<128> Str;
   raw_svector_ostream O(Str);