[PATCH] D142083: [X86][NFC] Move MemoryFoldTable2Addr MemoryFoldTable0~4 into X86InstrFoldTables.def

Bing Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 00:51:13 PST 2023


yubing added inline comments.


================
Comment at: llvm/lib/Target/X86/X86InstrFoldTables.def:1
+static const X86MemoryFoldTableEntry MemoryFoldTable2Addr[] = {
+{X86::ADD16ri8_DB,X86::ADD16mi8,TB_NO_REVERSE},
----------------
craig.topper wrote:
> skan wrote:
> > We should not define a C++ array in a def file.
> > Try sth like
> > ```
> > #ifndef X86_MEM_FOLD_2ADDR
> > #define X86_MEM_FOLD_2ADDR(REG,MEM,FLAG)
> > X86_MEM_FOLD_2ADDR(ADD16ri8_DB,ADD16mi8,TB_NO_REVERSE)
> > X86_MEM_FOLD_2ADDR(ADD16ri_DB,ADD16mi,TB_NO_REVERSE)
> > #endif
> > #undef X86_MEM_FOLD_2ADDR
> > ```
> > 
> > And in X86InstrFoldTables.cpp
> > 
> > ```
> > static const X86MemoryFoldTableEntry MemoryFoldTable2Addr[] = {
> > #define X86_MEM_FOLD_2ADDR (REG,MEM,FLAG) {X86::REG, X86::MEM, FLAG},
> > }
> > ```
> > 
> Could make it a .inc file instead of .def?
but currently we still have some small difference between auto-gen table and the table in this file.
we will finally replace it with inc in the future patch


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142083/new/

https://reviews.llvm.org/D142083



More information about the llvm-commits mailing list