diff options
author | Hal Finkel <hfinkel@anl.gov> | 2012-11-05 18:18:42 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2012-11-05 18:18:42 +0000 |
commit | 4f24c621d97c14740a47635341270c188e5c87ea (patch) | |
tree | 4396bdedbf686888628fa8b17ee94c864e68bee7 /llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | |
parent | 5f04d84459d0146b8548b16ae4e807b7fda67e6f (diff) | |
download | bcm5719-llvm-4f24c621d97c14740a47635341270c188e5c87ea.tar.gz bcm5719-llvm-4f24c621d97c14740a47635341270c188e5c87ea.zip |
Add support for the PowerPC-specific inline asm Z constraint and y modifier.
The Z constraint specifies an r+r memory address, and the y modifier expands
to the "r, r" in the asm string. For this initial implementation, the base
register is forced to r0 (which has the special meaning of 0 for r+r addressing
on PowerPC) and the full address is taken in the second register. In the
future, this should be improved.
llvm-svn: 167388
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index 72395bb2839..4387730fcc1 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -284,8 +284,22 @@ bool PPCAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &O) { - if (ExtraCode && ExtraCode[0]) - return true; // Unknown modifier. + if (ExtraCode && ExtraCode[0]) { + if (ExtraCode[1] != 0) return true; // Unknown modifier. + + switch (ExtraCode[0]) { + default: return true; // Unknown modifier. + case 'y': // A memory reference for an X-form instruction + { + const char *RegName = "r0"; + if (!Subtarget.isDarwin()) RegName = stripRegisterPrefix(RegName); + O << RegName << ", "; + printOperand(MI, OpNo, O); + return false; + } + } + } + assert(MI->getOperand(OpNo).isReg()); O << "0("; printOperand(MI, OpNo, O); |