mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
[mips] Distinguish 'R', 'ZC', and 'm' inline assembly memory constraint.
Summary: Previous behaviour of 'R' and 'm' has been preserved for now. They will be improved in subsequent commits. The offset permitted by ZC varies according to the subtarget since it is intended to match the restrictions of the pref, ll, and sc instructions. The restrictions on these instructions are: * For microMIPS: 12-bit signed offset. * For Mips32r6/Mips64r6: 9-bit signed offset. * Otherwise: 16-bit signed offset. Reviewers: vkalintiris Reviewed By: vkalintiris Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8414 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233063 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -437,7 +437,7 @@ bool MipsAsmPrinter::isBlockOnlyReachableByFallthrough(const MachineBasicBlock*
|
||||
|
||||
// Print out an operand for an inline asm expression.
|
||||
bool MipsAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant,const char *ExtraCode,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
// Does this asm operand have a single letter operand modifier?
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
@@ -539,18 +539,24 @@ bool MipsAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNum, unsigned AsmVariant,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
int Offset = 0;
|
||||
assert(OpNum + 1 < MI->getNumOperands() && "Insufficient operands");
|
||||
const MachineOperand &BaseMO = MI->getOperand(OpNum);
|
||||
const MachineOperand &OffsetMO = MI->getOperand(OpNum + 1);
|
||||
assert(BaseMO.isReg() && "Unexpected base pointer for inline asm memory operand.");
|
||||
assert(OffsetMO.isImm() && "Unexpected offset for inline asm memory operand.");
|
||||
int Offset = OffsetMO.getImm();
|
||||
|
||||
// Currently we are expecting either no ExtraCode or 'D'
|
||||
if (ExtraCode) {
|
||||
if (ExtraCode[0] == 'D')
|
||||
Offset = 4;
|
||||
Offset += 4;
|
||||
else
|
||||
return true; // Unknown modifier.
|
||||
// FIXME: M = high order bits
|
||||
// FIXME: L = low order bits
|
||||
}
|
||||
|
||||
const MachineOperand &MO = MI->getOperand(OpNum);
|
||||
assert(MO.isReg() && "unexpected inline asm memory operand");
|
||||
O << Offset << "($" << MipsInstPrinter::getRegisterName(MO.getReg()) << ")";
|
||||
O << Offset << "($" << MipsInstPrinter::getRegisterName(BaseMO.getReg()) << ")";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user