aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-10-21 00:11:27 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-10-21 00:11:27 +0000
commit0f66de4cb1e6f103f3d7a5bdb4524f30a0de9ee3 (patch)
tree867d51c1cf84814e5e5939c312929011772ed735 /lib
parent1c7ceed86f92915c5244032d7ed36fe4f31c3904 (diff)
downloadexternal_llvm-0f66de4cb1e6f103f3d7a5bdb4524f30a0de9ee3.zip
external_llvm-0f66de4cb1e6f103f3d7a5bdb4524f30a0de9ee3.tar.gz
external_llvm-0f66de4cb1e6f103f3d7a5bdb4524f30a0de9ee3.tar.bz2
Add simple operand printing stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp15
-rw-r--r--lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.h8
2 files changed, 19 insertions, 4 deletions
diff --git a/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp b/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp
index 4612a08..243a5e1 100644
--- a/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp
+++ b/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp
@@ -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!");
+ }
+}
diff --git a/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.h b/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.h
index 93a9f75..1047f48 100644
--- a/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.h
+++ b/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.h
@@ -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) {
}