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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 00:55:37 PST 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/X86/X86InstrFoldTables.def:1
+static const X86MemoryFoldTableEntry MemoryFoldTable2Addr[] = {
+{X86::ADD16ri8_DB,X86::ADD16mi8,TB_NO_REVERSE},
----------------
yubing wrote:
> 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
.inc doesn't mean it has to come from tablegen.  In llvm, .def is full of macros. You can name a file .inc in the the source directories.


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