[PATCH] D60577: [X86AsmPrinter] refactor static functions into private methods. NFC

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 11 13:40:45 PDT 2019


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

A lot of the code for printing special cases of operands in this
translation unit are static functions. While I too have suffered many
years of abuse at the hands of C, we should prefer functions in a
private namespace, or even better private methods.  Particularly when
you start passing around *this as your first argument, which is a code
smell.

This will help make generic vs arch specific asm printing easier, as it
brings X86AsmPrinter more inline with other arch's derived AsmPrinters.
We will then be able to more easily move architecture generic code to
the base class, and architecture specific code to the derived classes.

Some other small refactorings while we're here:

- the parameter Op is now consistently OpNo
- add spaces around binary expressions. I know we're not millionaires but c'mon.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D60577

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60577.194742.patch
Type: text/x-patch
Size: 15839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190411/0f0e9a84/attachment.bin>


More information about the llvm-commits mailing list