From: Craig Topper Date: Mon, 4 Feb 2019 21:24:13 +0000 (+0000) Subject: [CodeGen][ARC][SystemZ][WebAssembly] Use MachineInstr::isInlineAsm in more places... X-Git-Tag: llvmorg-10-init~12846 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c45e39b35f2d91012b70f35aa0addd2ec4afd496;p=platform%2Fupstream%2Fllvm.git [CodeGen][ARC][SystemZ][WebAssembly] Use MachineInstr::isInlineAsm in more places instead of just comparing opcode. NFCI I'm looking at adding a second INLINEASM opcode for better modeling asm-goto as a terminator. Using the existing predicate will reduce teh number of places that will need to use the new opcode. llvm-svn: 353095 --- diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h index 352334d..faeb66e 100644 --- a/llvm/include/llvm/CodeGen/MachineInstr.h +++ b/llvm/include/llvm/CodeGen/MachineInstr.h @@ -1014,7 +1014,7 @@ public: bool isInlineAsm() const { return getOpcode() == TargetOpcode::INLINEASM; } bool isMSInlineAsm() const { - return getOpcode() == TargetOpcode::INLINEASM && getInlineAsmDialect(); + return isInlineAsm() && getInlineAsmDialect() == InlineAsm::AD_Intel; } bool isStackAligningInlineAsm() const; diff --git a/llvm/lib/Target/ARC/ARCInstrInfo.cpp b/llvm/lib/Target/ARC/ARCInstrInfo.cpp index be657da5..d71db50 100644 --- a/llvm/lib/Target/ARC/ARCInstrInfo.cpp +++ b/llvm/lib/Target/ARC/ARCInstrInfo.cpp @@ -388,7 +388,7 @@ unsigned ARCInstrInfo::insertBranch(MachineBasicBlock &MBB, } unsigned ARCInstrInfo::getInstSizeInBytes(const MachineInstr &MI) const { - if (MI.getOpcode() == TargetOpcode::INLINEASM) { + if (MI.isInlineAsm()) { const MachineFunction *MF = MI.getParent()->getParent(); const char *AsmStr = MI.getOperand(0).getSymbolName(); return getInlineAsmLength(AsmStr, *MF->getTarget().getMCAsmInfo()); diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp index b0b0332..7b85a1f 100644 --- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp +++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp @@ -1505,7 +1505,7 @@ bool SystemZInstrInfo::expandPostRAPseudo(MachineInstr &MI) const { } unsigned SystemZInstrInfo::getInstSizeInBytes(const MachineInstr &MI) const { - if (MI.getOpcode() == TargetOpcode::INLINEASM) { + if (MI.isInlineAsm()) { const MachineFunction *MF = MI.getParent()->getParent(); const char *AsmStr = MI.getOperand(0).getSymbolName(); return getInlineAsmLength(AsmStr, *MF->getTarget().getMCAsmInfo()); diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp index dfd33b9..8494737 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp @@ -316,7 +316,7 @@ bool WebAssemblyExplicitLocals::runOnMachineFunction(MachineFunction &MF) { // with inline asm register operands is to provide local indices as // immediates. if (MO.isDef()) { - assert(MI.getOpcode() == TargetOpcode::INLINEASM); + assert(MI.isInlineAsm()); unsigned LocalId = getLocalId(Reg2Local, CurLocal, OldReg); // If this register operand is tied to another operand, we can't // change it to an immediate. Untie it first. @@ -334,7 +334,7 @@ bool WebAssemblyExplicitLocals::runOnMachineFunction(MachineFunction &MF) { // Our contract with inline asm register operands is to provide local // indices as immediates. - if (MI.getOpcode() == TargetOpcode::INLINEASM) { + if (MI.isInlineAsm()) { unsigned LocalId = getLocalId(Reg2Local, CurLocal, OldReg); // Untie it first if this reg operand is tied to another operand. MI.untieRegOperand(MI.getOperandNo(&MO)); diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp index e2675b5..6463e26 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp @@ -789,11 +789,11 @@ bool WebAssemblyRegStackify::runOnMachineFunction(MachineFunction &MF) { MachineInstr *Insert = &*MII; // Don't nest anything inside an inline asm, because we don't have // constraints for $push inputs. - if (Insert->getOpcode() == TargetOpcode::INLINEASM) + if (Insert->isInlineAsm()) continue; // Ignore debugging intrinsics. - if (Insert->getOpcode() == TargetOpcode::DBG_VALUE) + if (Insert->isDebugValue()) continue; // Iterate through the inputs in reverse order, since we'll be pulling @@ -821,7 +821,7 @@ bool WebAssemblyRegStackify::runOnMachineFunction(MachineFunction &MF) { // Don't nest an INLINE_ASM def into anything, because we don't have // constraints for $pop outputs. - if (Def->getOpcode() == TargetOpcode::INLINEASM) + if (Def->isInlineAsm()) continue; // Argument instructions represent live-in registers and not real