blob: fc1e53f38752b9850799d50b7a4ea54fe9206c22 [file] [log] [blame]
Chris Lattnerfd603822009-10-19 19:56:26 +00001//===-- ARMInstPrinter.cpp - Convert ARM MCInst to assembly syntax --------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This class prints an ARM MCInst to a .s file.
11//
12//===----------------------------------------------------------------------===//
13
14#define DEBUG_TYPE "asm-printer"
15#include "ARMInstPrinter.h"
16#include "llvm/MC/MCInst.h"
17//#include "llvm/MC/MCAsmInfo.h"
18//#include "llvm/MC/MCExpr.h"
19//#include "llvm/Support/ErrorHandling.h"
20#include "llvm/Support/FormattedStream.h"
21#include "ARMGenInstrNames.inc"
22using namespace llvm;
23
24// Include the auto-generated portion of the assembly writer.
25#define MachineInstr MCInst
26#define ARMAsmPrinter ARMInstPrinter // FIXME: REMOVE.
27#define NO_ASM_WRITER_BOILERPLATE
28#include "ARMGenAsmWriter.inc"
29#undef MachineInstr
30#undef ARMAsmPrinter
31
32void ARMInstPrinter::printInst(const MCInst *MI) { printInstruction(MI); }
33
Chris Lattner8bc86cb2009-10-19 20:59:55 +000034void ARMInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
35 const char *Modifier) {
36 assert((Modifier == 0 || Modifier[0] == 0) && "Cannot print modifiers");
37
38 const MCOperand &Op = MI->getOperand(OpNo);
39 if (Op.isReg()) {
40 O << getRegisterName(Op.getReg());
41 } else if (Op.isImm()) {
42 O << '#' << Op.getImm();
43 } else {
44 assert(Op.isExpr() && "unknown operand kind in printOperand");
45 assert(0 && "UNIMP");
46 //O << '$';
47 //Op.getExpr()->print(O, &MAI);
48 }
49}