#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();
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);
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);
/// 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':
}
-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");
-}
-