summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-14 19:53:02 +0000
committerChris Lattner <sabre@nondot.org>2010-11-14 19:53:02 +0000
commit686a095d89ffb4c7792d0e0cd3cec47b1a7d8d25 (patch)
treed24d05331afefd196946e7dbc71e650d6a8fbbe7 /llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
parentb05ef7377acd6133d322f56384e1e97c6b315579 (diff)
downloadbcm5719-llvm-686a095d89ffb4c7792d0e0cd3cec47b1a7d8d25.tar.gz
bcm5719-llvm-686a095d89ffb4c7792d0e0cd3cec47b1a7d8d25.zip
stub out PPCMCInstLowering, add a new option that uses it and the new
instprinter when -enable-ppc-inst-printer is passed to llc. llvm-svn: 119061
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 833a83ede62..d1b54e408c6 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/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 @@ void PPCAsmPrinter::printPredicateOperand(const MachineInstr *MI, unsigned OpNo,
/// 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);
OpenPOWER on IntegriCloud