[PATCH] D60526: [X86AsmPrinter] refactor to limit use of Modifier. NFC

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 11:33:47 PDT 2019


nickdesaulniers created this revision.
nickdesaulniers added reviewers: craig.topper, echristo.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

The Modifier memory operands is used in 2 cases of memory references
(H & P ExtraCodes). Rather than pass around the likely nullptr Modifier,
refactor the handling of the Modifier out from printOperand().

The refactorings in this patch:

- Don't forward declare printOperand, move its definition up.
  - The diff makes it look like there's a change to printPCRelImm (narrator: there's not).
- Create printModifiedOperand()
  - Move logic for Modifier to there from printOperand
  - Use printModifiedOperand in 3 call sites that actually create Modifiers.
- Remove now unused Modifier parameter from printOperand
- Remove default parameter from printLeaMemReference as it only has 1 call site that explicitly passes a parameter.
- Remove default parameter from printMemReference, make call lone call site explicitly pass nullptr.
- Drop Modifier parameter from printIntelMemReference, as Intel style memory references don't support the Modifiers in question.

This will allow future changes to printOperand() to make it a pure virtual
method on the base AsmPrinter class, allowing for more generic handling
of some architecture generic constraints. X86AsmPrinter was the only
derived class of AsmPrinter to have additional parameters on its
printOperand function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D60526

Files:
  llvm/lib/Target/X86/X86AsmPrinter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60526.194557.patch
Type: text/x-patch
Size: 7361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190410/e9736e2c/attachment.bin>


More information about the llvm-commits mailing list