]> granicus.if.org Git - llvm/commit
[X86AsmPrinter] refactor to limit use of Modifier. NFC
authorNick Desaulniers <ndesaulniers@google.com>
Wed, 10 Apr 2019 19:01:44 +0000 (19:01 +0000)
committerNick Desaulniers <ndesaulniers@google.com>
Wed, 10 Apr 2019 19:01:44 +0000 (19:01 +0000)
commit0a9115aac13aef24f017c17e174a451d23b55e77
tree299081c7631f73d1a970f838f6e9d9492380fe84
parentb7bce147ad2e8ca4d81ebd3368398cf48aa50ffe
[X86AsmPrinter] refactor to limit use of Modifier. NFC

Summary:
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.

Reviewers: craig.topper, echristo

Reviewed By: echristo

Subscribers: hiraditya, llvm-commits, srhines

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60526

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358122 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86AsmPrinter.cpp