Add simple operand printing stuff

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84704 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov 2009-10-21 00:11:27 +00:00
parent 13853e233b
commit b5a921679f
2 changed files with 19 additions and 4 deletions

View File

@ -33,3 +33,18 @@ using namespace llvm;
void MSP430InstPrinter::printInst(const MCInst *MI) {
printInstruction(MI);
}
void MSP430InstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
const char *Modifier) {
assert((Modifier == 0 || Modifier[0] == 0) && "Cannot print modifiers");
const MCOperand &Op = MI->getOperand(OpNo);
if (Op.isReg()) {
O << getRegisterName(Op.getReg());
} else if (Op.isImm()) {
O << '#' << Op.getImm();
} else {
assert(Op.isExpr() && "unknown operand kind in printOperand");
assert(0 && "Unimplemented!");
}
}

View File

@ -16,7 +16,7 @@
#include "llvm/MC/MCInstPrinter.h"
namespace llvm
namespace llvm
{
class MCOperand;
@ -34,10 +34,10 @@ namespace llvm
static const char *getRegisterName(unsigned RegNo);
void printOperand(const MCInst *MI, unsigned OpNo,
const char *Modifier = 0) {
}
const char *Modifier = 0);
void printSrcMemOperand(const MCInst *MI, unsigned OpNo,
const char *Modifier = 0) {
const char *Modifier = 0) {
}
void printCCOperand(const MCInst *MI, unsigned OpNo) {
}