diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-11-15 02:46:57 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-11-15 02:46:57 +0000 |
| commit | edb9d84dcc4824865e86f963e52d67eb50dde7f5 (patch) | |
| tree | 30482808686a63895173c1da6b5d9953e31c8988 /llvm/lib/Target/PowerPC/InstPrinter | |
| parent | e75bb3496323f1e1f86acf5522c499a1a54ff95f (diff) | |
| download | bcm5719-llvm-edb9d84dcc4824865e86f963e52d67eb50dde7f5.tar.gz bcm5719-llvm-edb9d84dcc4824865e86f963e52d67eb50dde7f5.zip | |
add targetoperand flags for jump tables, constant pool and block address
nodes to indicate when ha16/lo16 modifiers should be used. This lets
us pass PowerPC/indirectbr.ll.
The one annoying thing about this patch is that the MCSymbolExpr isn't
expressive enough to represent ha16(label1-label2) which we need on
PowerPC. I have a terrible hack in the meantime, but this will have
to be revisited at some point.
Last major conversion item left is global variable references.
llvm-svn: 119105
Diffstat (limited to 'llvm/lib/Target/PowerPC/InstPrinter')
| -rw-r--r-- | llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp b/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp index 22907f52da7..0af16cfc8e3 100644 --- a/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp +++ b/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp @@ -270,17 +270,35 @@ void PPCInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, void PPCInstPrinter::printSymbolLo(const MCInst *MI, unsigned OpNo, raw_ostream &O) { if (MI->getOperand(OpNo).isImm()) - printS16ImmOperand(MI, OpNo, O); - else + return printS16ImmOperand(MI, OpNo, O); + + // FIXME: This is a terrible hack because we can't encode lo16() as an operand + // flag of a subtraction. See the FIXME in GetSymbolRef in PPCMCInstLower. + if (MI->getOperand(OpNo).isExpr() && + isa<MCBinaryExpr>(MI->getOperand(OpNo).getExpr())) { + O << "lo16("; printOperand(MI, OpNo, O); + O << ')'; + } else { + printOperand(MI, OpNo, O); + } } void PPCInstPrinter::printSymbolHi(const MCInst *MI, unsigned OpNo, raw_ostream &O) { if (MI->getOperand(OpNo).isImm()) - printS16ImmOperand(MI, OpNo, O); - else + return printS16ImmOperand(MI, OpNo, O); + + // FIXME: This is a terrible hack because we can't encode lo16() as an operand + // flag of a subtraction. See the FIXME in GetSymbolRef in PPCMCInstLower. + if (MI->getOperand(OpNo).isExpr() && + isa<MCBinaryExpr>(MI->getOperand(OpNo).getExpr())) { + O << "ha16("; printOperand(MI, OpNo, O); + O << ')'; + } else { + printOperand(MI, OpNo, O); + } } |

