diff options
author | Chris Lattner <sabre@nondot.org> | 2010-11-14 21:20:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-11-14 21:20:46 +0000 |
commit | 1520fd60950c1c347457b225dbbd72224d4fcd19 (patch) | |
tree | 19b6c74df4a3c1f6997806735a026aa4d485309d /lib/Target/PowerPC/InstPrinter | |
parent | db2c50907f9423767b423aca313e2182ee7b71c4 (diff) | |
download | llvm-1520fd60950c1c347457b225dbbd72224d4fcd19.tar.gz llvm-1520fd60950c1c347457b225dbbd72224d4fcd19.tar.bz2 llvm-1520fd60950c1c347457b225dbbd72224d4fcd19.tar.xz |
implement basic support for symbol operand lowering,
and printing support for call operands. Down to 77 failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119078 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/InstPrinter')
-rw-r--r-- | lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp | 13 | ||||
-rw-r--r-- | lib/Target/PowerPC/InstPrinter/PPCInstPrinter.h | 6 |
2 files changed, 17 insertions, 2 deletions
diff --git a/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp b/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp index 2e5060b019..8f7ebfff91 100644 --- a/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp +++ b/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp @@ -88,6 +88,19 @@ void PPCInstPrinter::printS16X4ImmOperand(const MCInst *MI, unsigned OpNo, #endif } +void PPCInstPrinter::printBranchOperand(const MCInst *MI, unsigned OpNo, + raw_ostream &O) { + if (!MI->getOperand(OpNo).isImm()) + return printOperand(MI, OpNo, O); + + // Branches can take an immediate operand. This is used by the branch + // selection pass to print $+8, an eight byte displacement from the PC. + O << "$+" << MI->getOperand(OpNo).getImm()*4; +} + + + + void PPCInstPrinter::printcrbitm(const MCInst *MI, unsigned OpNo, raw_ostream &O) { unsigned CCReg = MI->getOperand(OpNo).getReg(); diff --git a/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.h b/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.h index 3d67efa027..9a3e82cdaf 100644 --- a/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.h +++ b/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.h @@ -51,8 +51,10 @@ public: void printS16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); void printU16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); void printS16X4ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); - void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} - void printCallOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} + void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); + void printCallOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) { + printOperand(MI, OpNo, O); + } void printAbsAddrOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} void printcrbitm(const MCInst *MI, unsigned OpNo, raw_ostream &O); |