diff options
| author | Nick Desaulniers <ndesaulniers@google.com> | 2019-04-10 16:38:43 +0000 | 
|---|---|---|
| committer | Nick Desaulniers <ndesaulniers@google.com> | 2019-04-10 16:38:43 +0000 | 
| commit | 5277b3ff25185b78dfd060e3bdca4d9bcf40b7c5 (patch) | |
| tree | 5a45d6eaa68b21a50e30b8db91885f49a5287a3e /llvm/lib/Target/WebAssembly | |
| parent | 0a8228fd28eefc058521eb24df001560d556a89e (diff) | |
| download | bcm5719-llvm-5277b3ff25185b78dfd060e3bdca4d9bcf40b7c5.tar.gz bcm5719-llvm-5277b3ff25185b78dfd060e3bdca4d9bcf40b7c5.zip | |
[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
Diffstat (limited to 'llvm/lib/Target/WebAssembly')
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp | 13 | ||||
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.h | 6 | 
2 files changed, 5 insertions, 14 deletions
| diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp index 2e6de3cd9f2..fb037b7c7b5 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp @@ -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. diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.h b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.h index 963bfbd0d82..4e55c81dec3 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.h +++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.h @@ -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); | 

