forked from OSchip/llvm-project
[AsmPrinter] refactor to remove remove AsmVariant. NFC
Summary: The InlineAsm::AsmDialect is only required for X86; no architecture makes use of it and as such it gets passed around between arch-specific and general code while being unused for all architectures but X86. Since the AsmDialect is queried from a MachineInstr, which we also pass around, remove the additional AsmDialect parameter and query for it deep in the X86AsmPrinter only when needed/as late as possible. This refactor should help later planned refactors to AsmPrinter, as this difference in the X86AsmPrinter makes it harder to make AsmPrinter more generic. Reviewers: craig.topper Subscribers: jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, javed.absar, sbc100, jgravelle-google, eraman, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, llvm-commits, peter.smith, srhines Tags: #llvm Differential Revision: https://reviews.llvm.org/D60488 llvm-svn: 358101
This commit is contained in:
parent
0a8228fd28
commit
5277b3ff25
|
@ -594,16 +594,14 @@ public:
|
|||
/// specified assembler variant. Targets should override this to format as
|
||||
/// appropriate. This method can return true if the operand is erroneous.
|
||||
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &OS);
|
||||
const char *ExtraCode, raw_ostream &OS);
|
||||
|
||||
/// Print the specified operand of MI, an INLINEASM instruction, using the
|
||||
/// specified assembler variant as an address. Targets should override this to
|
||||
/// format as appropriate. This method can return true if the operand is
|
||||
/// erroneous.
|
||||
virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &OS);
|
||||
const char *ExtraCode, raw_ostream &OS);
|
||||
|
||||
/// Let the target do anything it needs to do before emitting inlineasm.
|
||||
/// \p StartInfo - the subtarget info before parsing inline asm
|
||||
|
|
|
@ -169,9 +169,8 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MCSubtargetInfo &STI,
|
|||
}
|
||||
|
||||
static void EmitMSInlineAsmStr(const char *AsmStr, const MachineInstr *MI,
|
||||
MachineModuleInfo *MMI, int InlineAsmVariant,
|
||||
AsmPrinter *AP, unsigned LocCookie,
|
||||
raw_ostream &OS) {
|
||||
MachineModuleInfo *MMI, AsmPrinter *AP,
|
||||
unsigned LocCookie, raw_ostream &OS) {
|
||||
// Switch to the inline assembly variant.
|
||||
OS << "\t.intel_syntax\n\t";
|
||||
|
||||
|
@ -263,11 +262,9 @@ static void EmitMSInlineAsmStr(const char *AsmStr, const MachineInstr *MI,
|
|||
++OpNo; // Skip over the ID number.
|
||||
|
||||
if (InlineAsm::isMemKind(OpFlags)) {
|
||||
Error = AP->PrintAsmMemoryOperand(MI, OpNo, InlineAsmVariant,
|
||||
/*Modifier*/ nullptr, OS);
|
||||
Error = AP->PrintAsmMemoryOperand(MI, OpNo, /*Modifier*/ nullptr, OS);
|
||||
} else {
|
||||
Error = AP->PrintAsmOperand(MI, OpNo, InlineAsmVariant,
|
||||
/*Modifier*/ nullptr, OS);
|
||||
Error = AP->PrintAsmOperand(MI, OpNo, /*Modifier*/ nullptr, OS);
|
||||
}
|
||||
}
|
||||
if (Error) {
|
||||
|
@ -284,9 +281,9 @@ static void EmitMSInlineAsmStr(const char *AsmStr, const MachineInstr *MI,
|
|||
}
|
||||
|
||||
static void EmitGCCInlineAsmStr(const char *AsmStr, const MachineInstr *MI,
|
||||
MachineModuleInfo *MMI, int InlineAsmVariant,
|
||||
int AsmPrinterVariant, AsmPrinter *AP,
|
||||
unsigned LocCookie, raw_ostream &OS) {
|
||||
MachineModuleInfo *MMI, int AsmPrinterVariant,
|
||||
AsmPrinter *AP, unsigned LocCookie,
|
||||
raw_ostream &OS) {
|
||||
int CurVariant = -1; // The number of the {.|.|.} region we are in.
|
||||
const char *LastEmitted = AsmStr; // One past the last character emitted.
|
||||
unsigned NumOperands = MI->getNumOperands();
|
||||
|
@ -441,11 +438,10 @@ static void EmitGCCInlineAsmStr(const char *AsmStr, const MachineInstr *MI,
|
|||
}
|
||||
} else {
|
||||
if (InlineAsm::isMemKind(OpFlags)) {
|
||||
Error = AP->PrintAsmMemoryOperand(MI, OpNo, InlineAsmVariant,
|
||||
Modifier[0] ? Modifier : nullptr,
|
||||
OS);
|
||||
Error = AP->PrintAsmMemoryOperand(
|
||||
MI, OpNo, Modifier[0] ? Modifier : nullptr, OS);
|
||||
} else {
|
||||
Error = AP->PrintAsmOperand(MI, OpNo, InlineAsmVariant,
|
||||
Error = AP->PrintAsmOperand(MI, OpNo,
|
||||
Modifier[0] ? Modifier : nullptr, OS);
|
||||
}
|
||||
}
|
||||
|
@ -515,13 +511,11 @@ void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const {
|
|||
|
||||
// The variant of the current asmprinter.
|
||||
int AsmPrinterVariant = MAI->getAssemblerDialect();
|
||||
InlineAsm::AsmDialect InlineAsmVariant = MI->getInlineAsmDialect();
|
||||
AsmPrinter *AP = const_cast<AsmPrinter*>(this);
|
||||
if (InlineAsmVariant == InlineAsm::AD_ATT)
|
||||
EmitGCCInlineAsmStr(AsmStr, MI, MMI, InlineAsmVariant, AsmPrinterVariant,
|
||||
AP, LocCookie, OS);
|
||||
if (MI->getInlineAsmDialect() == InlineAsm::AD_ATT)
|
||||
EmitGCCInlineAsmStr(AsmStr, MI, MMI, AsmPrinterVariant, AP, LocCookie, OS);
|
||||
else
|
||||
EmitMSInlineAsmStr(AsmStr, MI, MMI, InlineAsmVariant, AP, LocCookie, OS);
|
||||
EmitMSInlineAsmStr(AsmStr, MI, MMI, AP, LocCookie, OS);
|
||||
|
||||
// Emit warnings if we use reserved registers on the clobber list, as
|
||||
// that might give surprising results.
|
||||
|
@ -607,8 +601,7 @@ void AsmPrinter::PrintSpecial(const MachineInstr *MI, raw_ostream &OS,
|
|||
/// instruction, using the specified assembler variant. Targets should
|
||||
/// override this to format as appropriate.
|
||||
bool AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
// Does this asm operand have a single letter operand modifier?
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
if (ExtraCode[1] != 0) return true; // Unknown modifier.
|
||||
|
@ -638,7 +631,6 @@ bool AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
}
|
||||
|
||||
bool AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
// Target doesn't support this yet!
|
||||
return true;
|
||||
|
|
|
@ -153,11 +153,9 @@ private:
|
|||
raw_ostream &O);
|
||||
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
|
||||
void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
|
||||
|
||||
|
@ -491,12 +489,11 @@ bool AArch64AsmPrinter::printAsmRegInClass(const MachineOperand &MO,
|
|||
}
|
||||
|
||||
bool AArch64AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
const MachineOperand &MO = MI->getOperand(OpNum);
|
||||
|
||||
// First try the generic code, which knows about modifiers like 'c' and 'n'.
|
||||
if (!AsmPrinter::PrintAsmOperand(MI, OpNum, AsmVariant, ExtraCode, O))
|
||||
if (!AsmPrinter::PrintAsmOperand(MI, OpNum, ExtraCode, O))
|
||||
return false;
|
||||
|
||||
// Does this asm operand have a single letter operand modifier?
|
||||
|
@ -508,7 +505,7 @@ bool AArch64AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
|||
default:
|
||||
return true; // Unknown modifier.
|
||||
case 'a': // Print 'a' modifier
|
||||
PrintAsmMemoryOperand(MI, OpNum, AsmVariant, ExtraCode, O);
|
||||
PrintAsmMemoryOperand(MI, OpNum, ExtraCode, O);
|
||||
return false;
|
||||
case 'w': // Print W register
|
||||
case 'x': // Print X register
|
||||
|
@ -575,7 +572,6 @@ bool AArch64AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
|||
|
||||
bool AArch64AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNum,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
if (ExtraCode && ExtraCode[0] && ExtraCode[0] != 'a')
|
||||
|
|
|
@ -1122,10 +1122,9 @@ void AMDGPUAsmPrinter::getAmdKernelCode(amd_kernel_code_t &Out,
|
|||
}
|
||||
|
||||
bool AMDGPUAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
// First try the generic code, which knows about modifiers like 'c' and 'n'.
|
||||
if (!AsmPrinter::PrintAsmOperand(MI, OpNo, AsmVariant, ExtraCode, O))
|
||||
if (!AsmPrinter::PrintAsmOperand(MI, OpNo, ExtraCode, O))
|
||||
return false;
|
||||
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
|
|
|
@ -134,8 +134,7 @@ public:
|
|||
const MachineBasicBlock *MBB) const override;
|
||||
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
|
||||
protected:
|
||||
mutable std::vector<std::string> DisasmLines, HexLines;
|
||||
|
|
|
@ -255,8 +255,7 @@ GetARMJTIPICJumpTableLabel(unsigned uid) const {
|
|||
}
|
||||
|
||||
bool ARMAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
// Does this asm operand have a single letter operand modifier?
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
if (ExtraCode[1] != 0) return true; // Unknown modifier.
|
||||
|
@ -264,7 +263,7 @@ bool ARMAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
|||
switch (ExtraCode[0]) {
|
||||
default:
|
||||
// See if this is a generic print operand
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNum, AsmVariant, ExtraCode, O);
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNum, ExtraCode, O);
|
||||
case 'a': // Print as a memory address.
|
||||
if (MI->getOperand(OpNum).isReg()) {
|
||||
O << "["
|
||||
|
@ -443,8 +442,7 @@ bool ARMAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
|||
}
|
||||
|
||||
bool ARMAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNum, unsigned AsmVariant,
|
||||
const char *ExtraCode,
|
||||
unsigned OpNum, const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
// Does this asm operand have a single letter operand modifier?
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
|
|
|
@ -76,11 +76,9 @@ public:
|
|||
void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O);
|
||||
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
|
||||
void emitInlineAsmEnd(const MCSubtargetInfo &StartInfo,
|
||||
const MCSubtargetInfo *EndInfo) const override;
|
||||
|
|
|
@ -46,12 +46,10 @@ public:
|
|||
const char *Modifier = 0);
|
||||
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
|
||||
void EmitInstruction(const MachineInstr *MI) override;
|
||||
|
||||
|
@ -85,11 +83,10 @@ void AVRAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
}
|
||||
|
||||
bool AVRAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
// Default asm printer can only deal with some extra codes,
|
||||
// so try it first.
|
||||
bool Error = AsmPrinter::PrintAsmOperand(MI, OpNum, AsmVariant, ExtraCode, O);
|
||||
bool Error = AsmPrinter::PrintAsmOperand(MI, OpNum, ExtraCode, O);
|
||||
|
||||
if (Error && ExtraCode && ExtraCode[0]) {
|
||||
if (ExtraCode[1] != 0)
|
||||
|
@ -137,8 +134,7 @@ bool AVRAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
|||
}
|
||||
|
||||
bool AVRAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNum, unsigned AsmVariant,
|
||||
const char *ExtraCode,
|
||||
unsigned OpNum, const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
llvm_unreachable("This branch is not implemented yet");
|
||||
|
|
|
@ -43,11 +43,9 @@ public:
|
|||
bool doInitialization(Module &M) override;
|
||||
void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O);
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
|
||||
void EmitInstruction(const MachineInstr *MI) override;
|
||||
};
|
||||
|
@ -104,7 +102,6 @@ void BPFAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
|
|||
}
|
||||
|
||||
bool BPFAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned /*AsmVariant*/,
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
if (ExtraCode && ExtraCode[0])
|
||||
return true; // BPF does not have special modifiers
|
||||
|
@ -114,8 +111,7 @@ bool BPFAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
}
|
||||
|
||||
bool BPFAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNum, unsigned AsmVariant,
|
||||
const char *ExtraCode,
|
||||
unsigned OpNum, const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
assert(OpNum + 1 < MI->getNumOperands() && "Insufficient operands");
|
||||
const MachineOperand &BaseMO = MI->getOperand(OpNum);
|
||||
|
|
|
@ -113,7 +113,6 @@ bool HexagonAsmPrinter::isBlockOnlyReachableByFallthrough(
|
|||
|
||||
/// PrintAsmOperand - Print out an operand for an inline asm expression.
|
||||
bool HexagonAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &OS) {
|
||||
// Does this asm operand have a single letter operand modifier?
|
||||
|
@ -124,7 +123,7 @@ bool HexagonAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
switch (ExtraCode[0]) {
|
||||
default:
|
||||
// See if this is a generic print operand
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNo, AsmVariant, ExtraCode, OS);
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNo, ExtraCode, OS);
|
||||
case 'c': // Don't print "$" before a global var name or constant.
|
||||
// Hexagon never has a prefix.
|
||||
printOperand(MI, OpNo, OS);
|
||||
|
@ -160,7 +159,6 @@ bool HexagonAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
|
||||
bool HexagonAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
if (ExtraCode && ExtraCode[0])
|
||||
|
|
|
@ -52,11 +52,9 @@ class TargetMachine;
|
|||
|
||||
void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &OS) override;
|
||||
const char *ExtraCode, raw_ostream &OS) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &OS) override;
|
||||
const char *ExtraCode, raw_ostream &OS) override;
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
|
|
@ -48,8 +48,7 @@ public:
|
|||
|
||||
void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O);
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
void EmitInstruction(const MachineInstr *MI) override;
|
||||
bool isBlockOnlyReachableByFallthrough(
|
||||
const MachineBasicBlock *MBB) const override;
|
||||
|
@ -108,7 +107,6 @@ void LanaiAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
|
|||
|
||||
// PrintAsmOperand - Print out an operand for an inline asm expression.
|
||||
bool LanaiAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned /*AsmVariant*/,
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
// Does this asm operand have a single letter operand modifier?
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
|
|
|
@ -52,10 +52,8 @@ namespace {
|
|||
void printSrcMemOperand(const MachineInstr *MI, int OpNum,
|
||||
raw_ostream &O);
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNo, unsigned AsmVariant,
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
void EmitInstruction(const MachineInstr *MI) override;
|
||||
|
||||
|
@ -128,7 +126,6 @@ void MSP430AsmPrinter::printSrcMemOperand(const MachineInstr *MI, int OpNum,
|
|||
/// PrintAsmOperand - Print out an operand for an inline asm expression.
|
||||
///
|
||||
bool MSP430AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
// Does this asm operand have a single letter operand modifier?
|
||||
if (ExtraCode && ExtraCode[0])
|
||||
|
@ -139,7 +136,7 @@ bool MSP430AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
}
|
||||
|
||||
bool MSP430AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNo, unsigned AsmVariant,
|
||||
unsigned OpNo,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
|
|
|
@ -510,8 +510,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,
|
||||
raw_ostream &O) {
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
// Does this asm operand have a single letter operand modifier?
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
if (ExtraCode[1] != 0) return true; // Unknown modifier.
|
||||
|
@ -520,7 +519,7 @@ bool MipsAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
|||
switch (ExtraCode[0]) {
|
||||
default:
|
||||
// See if this is a generic print operand
|
||||
return AsmPrinter::PrintAsmOperand(MI,OpNum,AsmVariant,ExtraCode,O);
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNum, ExtraCode, O);
|
||||
case 'X': // hex const int
|
||||
if ((MO.getType()) != MachineOperand::MO_Immediate)
|
||||
return true;
|
||||
|
@ -616,7 +615,7 @@ bool MipsAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
|
|||
}
|
||||
|
||||
bool MipsAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNum, unsigned AsmVariant,
|
||||
unsigned OpNum,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
assert(OpNum + 1 < MI->getNumOperands() && "Insufficient operands");
|
||||
|
|
|
@ -145,11 +145,9 @@ public:
|
|||
bool isBlockOnlyReachableByFallthrough(
|
||||
const MachineBasicBlock* MBB) const override;
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
|
||||
void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
|
||||
void printMemOperandEA(const MachineInstr *MI, int opNum, raw_ostream &O);
|
||||
|
|
|
@ -2203,7 +2203,6 @@ void NVPTXAsmPrinter::printMCExpr(const MCExpr &Expr, raw_ostream &OS) {
|
|||
/// PrintAsmOperand - Print out an operand for an inline asm expression.
|
||||
///
|
||||
bool NVPTXAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
if (ExtraCode[1] != 0)
|
||||
|
@ -2212,7 +2211,7 @@ bool NVPTXAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
switch (ExtraCode[0]) {
|
||||
default:
|
||||
// See if this is a generic print operand
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNo, AsmVariant, ExtraCode, O);
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNo, ExtraCode, O);
|
||||
case 'r':
|
||||
break;
|
||||
}
|
||||
|
@ -2223,9 +2222,10 @@ bool NVPTXAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool NVPTXAsmPrinter::PrintAsmMemoryOperand(
|
||||
const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant,
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
bool NVPTXAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNo,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
if (ExtraCode && ExtraCode[0])
|
||||
return true; // Unknown modifier
|
||||
|
||||
|
|
|
@ -230,13 +230,11 @@ private:
|
|||
void printReturnValStr(const Function *, raw_ostream &O);
|
||||
void printReturnValStr(const MachineFunction &MF, raw_ostream &O);
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &) override;
|
||||
const char *ExtraCode, raw_ostream &) override;
|
||||
void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
|
||||
const char *Modifier = nullptr);
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &) override;
|
||||
const char *ExtraCode, raw_ostream &) override;
|
||||
|
||||
const MCExpr *lowerConstantForGV(const Constant *CV, bool ProcessingGeneric);
|
||||
void printMCExpr(const MCExpr &Expr, raw_ostream &OS);
|
||||
|
|
|
@ -102,11 +102,9 @@ public:
|
|||
void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
|
||||
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
|
||||
void EmitEndOfAsmFile(Module &M) override;
|
||||
|
||||
|
@ -224,7 +222,6 @@ void PPCAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
/// PrintAsmOperand - Print out an operand for an inline asm expression.
|
||||
///
|
||||
bool PPCAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
// Does this asm operand have a single letter operand modifier?
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
|
@ -233,7 +230,7 @@ bool PPCAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
switch (ExtraCode[0]) {
|
||||
default:
|
||||
// See if this is a generic print operand
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNo, AsmVariant, ExtraCode, O);
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNo, ExtraCode, O);
|
||||
case 'c': // Don't print "$" before a global var name or constant.
|
||||
break; // PPC never has a prefix.
|
||||
case 'L': // Write second word of DImode reference.
|
||||
|
@ -277,7 +274,6 @@ bool PPCAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
// assembler operand.
|
||||
|
||||
bool PPCAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
|
|
|
@ -42,11 +42,9 @@ public:
|
|||
void EmitInstruction(const MachineInstr *MI) override;
|
||||
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &OS) override;
|
||||
const char *ExtraCode, raw_ostream &OS) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &OS) override;
|
||||
const char *ExtraCode, raw_ostream &OS) override;
|
||||
|
||||
void EmitToStreamer(MCStreamer &S, const MCInst &Inst);
|
||||
bool emitPseudoExpansionLowering(MCStreamer &OutStreamer,
|
||||
|
@ -83,13 +81,9 @@ void RISCVAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||
}
|
||||
|
||||
bool RISCVAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode, raw_ostream &OS) {
|
||||
if (AsmVariant != 0)
|
||||
report_fatal_error("There are no defined alternate asm variants");
|
||||
|
||||
// First try the generic code, which knows about modifiers like 'c' and 'n'.
|
||||
if (!AsmPrinter::PrintAsmOperand(MI, OpNo, AsmVariant, ExtraCode, OS))
|
||||
if (!AsmPrinter::PrintAsmOperand(MI, OpNo, ExtraCode, OS))
|
||||
return false;
|
||||
|
||||
if (!ExtraCode) {
|
||||
|
@ -110,12 +104,9 @@ bool RISCVAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
}
|
||||
|
||||
bool RISCVAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNo, unsigned AsmVariant,
|
||||
unsigned OpNo,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &OS) {
|
||||
if (AsmVariant != 0)
|
||||
report_fatal_error("There are no defined alternate asm variants");
|
||||
|
||||
if (!ExtraCode) {
|
||||
const MachineOperand &MO = MI->getOperand(OpNo);
|
||||
// For now, we only support register memory operands in registers and
|
||||
|
@ -127,7 +118,7 @@ bool RISCVAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
|||
return false;
|
||||
}
|
||||
|
||||
return AsmPrinter::PrintAsmMemoryOperand(MI, OpNo, AsmVariant, ExtraCode, OS);
|
||||
return AsmPrinter::PrintAsmMemoryOperand(MI, OpNo, ExtraCode, OS);
|
||||
}
|
||||
|
||||
// Force static initialization.
|
||||
|
|
|
@ -59,11 +59,9 @@ namespace {
|
|||
}
|
||||
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
|
||||
void LowerGETPCXAndEmitMCInsts(const MachineInstr *MI,
|
||||
const MCSubtargetInfo &STI);
|
||||
|
@ -405,7 +403,6 @@ void SparcAsmPrinter::printMemOperand(const MachineInstr *MI, int opNum,
|
|||
/// PrintAsmOperand - Print out an operand for an inline asm expression.
|
||||
///
|
||||
bool SparcAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
|
@ -414,7 +411,7 @@ bool SparcAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
switch (ExtraCode[0]) {
|
||||
default:
|
||||
// See if this is a generic print operand
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNo, AsmVariant, ExtraCode, O);
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNo, ExtraCode, O);
|
||||
case 'f':
|
||||
case 'r':
|
||||
break;
|
||||
|
@ -427,7 +424,7 @@ bool SparcAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
}
|
||||
|
||||
bool SparcAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNo, unsigned AsmVariant,
|
||||
unsigned OpNo,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
if (ExtraCode && ExtraCode[0])
|
||||
|
|
|
@ -617,9 +617,7 @@ EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) {
|
|||
OutStreamer->EmitValue(Expr, Size);
|
||||
}
|
||||
|
||||
bool SystemZAsmPrinter::PrintAsmOperand(const MachineInstr *MI,
|
||||
unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
bool SystemZAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &OS) {
|
||||
if (ExtraCode && *ExtraCode == 'n') {
|
||||
|
@ -636,7 +634,6 @@ bool SystemZAsmPrinter::PrintAsmOperand(const MachineInstr *MI,
|
|||
|
||||
bool SystemZAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &OS) {
|
||||
SystemZInstPrinter::printAddress(MI->getOperand(OpNo).getReg(),
|
||||
|
|
|
@ -36,11 +36,9 @@ public:
|
|||
void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) override;
|
||||
void EmitEndOfAsmFile(Module &M) override;
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &OS) override;
|
||||
const char *ExtraCode, raw_ostream &OS) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &OS) override;
|
||||
const char *ExtraCode, raw_ostream &OS) override;
|
||||
|
||||
bool doInitialization(Module &M) override {
|
||||
SM.reset();
|
||||
|
|
|
@ -387,14 +387,11 @@ void WebAssemblyAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||
}
|
||||
|
||||
bool WebAssemblyAsmPrinter::PrintAsmOperand(const MachineInstr *MI,
|
||||
unsigned OpNo, unsigned AsmVariant,
|
||||
unsigned OpNo,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &OS) {
|
||||
if (AsmVariant != 0)
|
||||
report_fatal_error("There are no defined alternate asm variants");
|
||||
|
||||
// First try the generic code, which knows about modifiers like 'c' and 'n'.
|
||||
if (!AsmPrinter::PrintAsmOperand(MI, OpNo, AsmVariant, ExtraCode, OS))
|
||||
if (!AsmPrinter::PrintAsmOperand(MI, OpNo, ExtraCode, OS))
|
||||
return false;
|
||||
|
||||
if (!ExtraCode) {
|
||||
|
@ -430,19 +427,15 @@ bool WebAssemblyAsmPrinter::PrintAsmOperand(const MachineInstr *MI,
|
|||
|
||||
bool WebAssemblyAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &OS) {
|
||||
if (AsmVariant != 0)
|
||||
report_fatal_error("There are no defined alternate asm variants");
|
||||
|
||||
// The current approach to inline asm is that "r" constraints are expressed
|
||||
// as local indices, rather than values on the operand stack. This simplifies
|
||||
// using "r" as it eliminates the need to push and pop the values in a
|
||||
// particular order, however it also makes it impossible to have an "m"
|
||||
// constraint. So we don't support it.
|
||||
|
||||
return AsmPrinter::PrintAsmMemoryOperand(MI, OpNo, AsmVariant, ExtraCode, OS);
|
||||
return AsmPrinter::PrintAsmMemoryOperand(MI, OpNo, ExtraCode, OS);
|
||||
}
|
||||
|
||||
// Force static initialization.
|
||||
|
|
|
@ -65,11 +65,9 @@ public:
|
|||
void EmitFunctionBodyStart() override;
|
||||
void EmitInstruction(const MachineInstr *MI) override;
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &OS) override;
|
||||
const char *ExtraCode, raw_ostream &OS) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &OS) override;
|
||||
const char *ExtraCode, raw_ostream &OS) override;
|
||||
|
||||
MVT getRegType(unsigned RegNo) const;
|
||||
std::string regToString(const MachineOperand &MO);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
|
||||
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#include "llvm/IR/Mangler.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
|
@ -200,7 +201,7 @@ static void printSymbolOperand(X86AsmPrinter &P, const MachineOperand &MO,
|
|||
|
||||
static void printOperand(X86AsmPrinter &P, const MachineInstr *MI,
|
||||
unsigned OpNo, raw_ostream &O,
|
||||
const char *Modifier = nullptr, unsigned AsmVariant = 0);
|
||||
const char *Modifier = nullptr);
|
||||
|
||||
/// printPCRelImm - This is used to print an immediate value that ends up
|
||||
/// being encoded as a pc-relative value. These print slightly differently, for
|
||||
|
@ -224,14 +225,14 @@ static void printPCRelImm(X86AsmPrinter &P, const MachineInstr *MI,
|
|||
}
|
||||
|
||||
static void printOperand(X86AsmPrinter &P, const MachineInstr *MI,
|
||||
unsigned OpNo, raw_ostream &O, const char *Modifier,
|
||||
unsigned AsmVariant) {
|
||||
unsigned OpNo, raw_ostream &O, const char *Modifier) {
|
||||
const MachineOperand &MO = MI->getOperand(OpNo);
|
||||
const bool IsATT = MI->getInlineAsmDialect() == InlineAsm::AD_ATT;
|
||||
switch (MO.getType()) {
|
||||
default: llvm_unreachable("unknown operand type!");
|
||||
case MachineOperand::MO_Register: {
|
||||
// FIXME: Enumerating AsmVariant, so we can remove magic number.
|
||||
if (AsmVariant == 0) O << '%';
|
||||
if (IsATT)
|
||||
O << '%';
|
||||
unsigned Reg = MO.getReg();
|
||||
if (Modifier && strncmp(Modifier, "subreg", strlen("subreg")) == 0) {
|
||||
unsigned Size = (strcmp(Modifier+6,"64") == 0) ? 64 :
|
||||
|
@ -244,12 +245,14 @@ static void printOperand(X86AsmPrinter &P, const MachineInstr *MI,
|
|||
}
|
||||
|
||||
case MachineOperand::MO_Immediate:
|
||||
if (AsmVariant == 0) O << '$';
|
||||
if (IsATT)
|
||||
O << '$';
|
||||
O << MO.getImm();
|
||||
return;
|
||||
|
||||
case MachineOperand::MO_GlobalAddress: {
|
||||
if (AsmVariant == 0) O << '$';
|
||||
if (IsATT)
|
||||
O << '$';
|
||||
printSymbolOperand(P, MO, O);
|
||||
break;
|
||||
}
|
||||
|
@ -327,8 +330,7 @@ static void printMemReference(X86AsmPrinter &P, const MachineInstr *MI,
|
|||
|
||||
static void printIntelMemReference(X86AsmPrinter &P, const MachineInstr *MI,
|
||||
unsigned Op, raw_ostream &O,
|
||||
const char *Modifier = nullptr,
|
||||
unsigned AsmVariant = 1) {
|
||||
const char *Modifier = nullptr) {
|
||||
const MachineOperand &BaseReg = MI->getOperand(Op+X86::AddrBaseReg);
|
||||
unsigned ScaleVal = MI->getOperand(Op+X86::AddrScaleAmt).getImm();
|
||||
const MachineOperand &IndexReg = MI->getOperand(Op+X86::AddrIndexReg);
|
||||
|
@ -337,7 +339,7 @@ static void printIntelMemReference(X86AsmPrinter &P, const MachineInstr *MI,
|
|||
|
||||
// If this has a segment register, print it.
|
||||
if (SegReg.getReg()) {
|
||||
printOperand(P, MI, Op+X86::AddrSegmentReg, O, Modifier, AsmVariant);
|
||||
printOperand(P, MI, Op + X86::AddrSegmentReg, O, Modifier);
|
||||
O << ':';
|
||||
}
|
||||
|
||||
|
@ -345,7 +347,7 @@ static void printIntelMemReference(X86AsmPrinter &P, const MachineInstr *MI,
|
|||
|
||||
bool NeedPlus = false;
|
||||
if (BaseReg.getReg()) {
|
||||
printOperand(P, MI, Op+X86::AddrBaseReg, O, Modifier, AsmVariant);
|
||||
printOperand(P, MI, Op + X86::AddrBaseReg, O, Modifier);
|
||||
NeedPlus = true;
|
||||
}
|
||||
|
||||
|
@ -353,13 +355,13 @@ static void printIntelMemReference(X86AsmPrinter &P, const MachineInstr *MI,
|
|||
if (NeedPlus) O << " + ";
|
||||
if (ScaleVal != 1)
|
||||
O << ScaleVal << '*';
|
||||
printOperand(P, MI, Op+X86::AddrIndexReg, O, Modifier, AsmVariant);
|
||||
printOperand(P, MI, Op + X86::AddrIndexReg, O, Modifier);
|
||||
NeedPlus = true;
|
||||
}
|
||||
|
||||
if (!DispSpec.isImm()) {
|
||||
if (NeedPlus) O << " + ";
|
||||
printOperand(P, MI, Op+X86::AddrDisp, O, Modifier, AsmVariant);
|
||||
printOperand(P, MI, Op + X86::AddrDisp, O, Modifier);
|
||||
} else {
|
||||
int64_t DispVal = DispSpec.getImm();
|
||||
if (DispVal || (!IndexReg.getReg() && !BaseReg.getReg())) {
|
||||
|
@ -422,7 +424,6 @@ static bool printAsmMRegister(X86AsmPrinter &P, const MachineOperand &MO,
|
|||
/// PrintAsmOperand - Print out an operand for an inline asm expression.
|
||||
///
|
||||
bool X86AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant,
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
// Does this asm operand have a single letter operand modifier?
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
|
@ -433,7 +434,7 @@ bool X86AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
switch (ExtraCode[0]) {
|
||||
default:
|
||||
// See if this is a generic print operand
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNo, AsmVariant, ExtraCode, O);
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNo, ExtraCode, O);
|
||||
case 'a': // This is an address. Currently only 'i' and 'r' are expected.
|
||||
switch (MO.getType()) {
|
||||
default:
|
||||
|
@ -509,15 +510,14 @@ bool X86AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
}
|
||||
}
|
||||
|
||||
printOperand(*this, MI, OpNo, O, /*Modifier*/ nullptr, AsmVariant);
|
||||
printOperand(*this, MI, OpNo, O, /*Modifier*/ nullptr);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool X86AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNo, unsigned AsmVariant,
|
||||
bool X86AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
if (AsmVariant) {
|
||||
if (MI->getInlineAsmDialect() == InlineAsm::AD_Intel) {
|
||||
printIntelMemReference(*this, MI, OpNo, O);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -123,11 +123,9 @@ public:
|
|||
}
|
||||
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &OS) override;
|
||||
const char *ExtraCode, raw_ostream &OS) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &OS) override;
|
||||
const char *ExtraCode, raw_ostream &OS) override;
|
||||
|
||||
bool doInitialization(Module &M) override {
|
||||
SMShadowTracker.reset(0);
|
||||
|
|
|
@ -66,11 +66,9 @@ namespace {
|
|||
}
|
||||
void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) override;
|
||||
const char *ExtraCode, raw_ostream &O) override;
|
||||
|
||||
void emitArrayBound(MCSymbol *Sym, const GlobalVariable *GV);
|
||||
void EmitGlobalVariable(const GlobalVariable *GV) override;
|
||||
|
@ -232,8 +230,7 @@ void XCoreAsmPrinter::printOperand(const MachineInstr *MI, int opNum,
|
|||
/// PrintAsmOperand - Print out an operand for an inline asm expression.
|
||||
///
|
||||
bool XCoreAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant,const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
const char *ExtraCode, raw_ostream &O) {
|
||||
// Print the operand if there is no operand modifier.
|
||||
if (!ExtraCode || !ExtraCode[0]) {
|
||||
printOperand(MI, OpNo, O);
|
||||
|
@ -241,13 +238,13 @@ bool XCoreAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
}
|
||||
|
||||
// Otherwise fallback on the default implementation.
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNo, AsmVariant, ExtraCode, O);
|
||||
return AsmPrinter::PrintAsmOperand(MI, OpNo, ExtraCode, O);
|
||||
}
|
||||
|
||||
bool XCoreAsmPrinter::
|
||||
PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
|
||||
unsigned AsmVariant, const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
bool XCoreAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
unsigned OpNum,
|
||||
const char *ExtraCode,
|
||||
raw_ostream &O) {
|
||||
if (ExtraCode && ExtraCode[0]) {
|
||||
return true; // Unknown modifier.
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue