Rename TargetAsmParser to MCTargetAsmParser and TargetAsmLexer to MCTargetAsmLexer...
[oota-llvm.git] / lib / Target / PowerPC / InstPrinter / PPCInstPrinter.cpp
index 0af16cfc8e37ee36bad47adaa678dd695afb850f..8f34b19925ee40d7c34484c57553c8eabdb4c334 100644 (file)
 
 #define DEBUG_TYPE "asm-printer"
 #include "PPCInstPrinter.h"
-#include "PPCPredicates.h"
+#include "MCTargetDesc/PPCBaseInfo.h"
+#include "MCTargetDesc/PPCPredicates.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCInst.h"
-//#include "llvm/MC/MCAsmInfo.h"
-//#include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 #define GET_INSTRUCTION_NAME
-#define PPCAsmPrinter PPCInstPrinter
-#define MachineInstr MCInst
 #include "PPCGenAsmWriter.inc"
 
 StringRef PPCInstPrinter::getOpcodeName(unsigned Opcode) const {
   return getInstructionName(Opcode);
 }
 
+void PPCInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
+  OS << getRegisterName(RegNo);
+}
 
 void PPCInstPrinter::printInst(const MCInst *MI, raw_ostream &O) {
-  // TODO: pseudo ops.
-  
   // Check for slwi/srwi mnemonics.
   if (MI->getOpcode() == PPC::RLWINM) {
     unsigned char SH = MI->getOperand(2).getImm();
@@ -188,10 +186,7 @@ void PPCInstPrinter::printMemRegImm(const MCInst *MI, unsigned OpNo,
                                     raw_ostream &O) {
   printSymbolLo(MI, OpNo, O);
   O << '(';
-  assert(MI->getOperand(OpNo+1).isReg() && "Bad operand");
-  // FIXME: Simplify.
-  if (MI->getOperand(OpNo+1).isReg() &&
-      MI->getOperand(OpNo+1).getReg() == PPC::R0)
+  if (MI->getOperand(OpNo+1).getReg() == PPC::R0)
     O << "0";
   else
     printOperand(MI, OpNo+1, O);
@@ -206,10 +201,7 @@ void PPCInstPrinter::printMemRegImmShifted(const MCInst *MI, unsigned OpNo,
     printSymbolLo(MI, OpNo, O);
   O << '(';
   
-  assert(MI->getOperand(OpNo+1).isReg() && "Bad operand");
-  // FIXME: Simplify.
-  if (MI->getOperand(OpNo+1).isReg() &&
-      MI->getOperand(OpNo+1).getReg() == PPC::R0)
+  if (MI->getOperand(OpNo+1).getReg() == PPC::R0)
     O << "0";
   else
     printOperand(MI, OpNo+1, O);
@@ -234,7 +226,7 @@ void PPCInstPrinter::printMemRegReg(const MCInst *MI, unsigned OpNo,
 
 /// stripRegisterPrefix - This method strips the character prefix from a
 /// register name so that only the number is left.  Used by for linux asm.
-const char *stripRegisterPrefix(const char *RegName) {
+static const char *stripRegisterPrefix(const char *RegName) {
   switch (RegName[0]) {
   case 'r':
   case 'f':
@@ -302,16 +294,3 @@ void PPCInstPrinter::printSymbolHi(const MCInst *MI, unsigned OpNo,
 }
 
 
-void PPCInstPrinter::PrintSpecial(const MCInst *MI, raw_ostream &O,
-                                  const char *Modifier) {
-  assert(0 && "FIXME: PrintSpecial should be dead");
-}
-void PPCInstPrinter::printPICLabel(const MCInst *MI, unsigned OpNo,
-                                   raw_ostream &O) {
-  assert(0 && "FIXME: printPICLabel should be dead");
-}
-void PPCInstPrinter::printTOCEntryLabel(const MCInst *MI, unsigned OpNo,
-                                        raw_ostream &O) {
-  assert(0 && "FIXME: printTOCEntryLabel should be dead");
-}
-