[PATCH] D150068: [X86][AsmParser] Refactor code in AsmParser

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 7 20:16:12 PDT 2023


skan marked an inline comment as done.
skan added inline comments.


================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86InstrOptimization.cpp:54
+
+bool X86::optimizeShiftRotateWithImmediateOne(MCInst &MI) {
+  auto E = MI.end();
----------------
craig.topper wrote:
> Not for this patch, but should we use this in X86MCInstLower and remove all the isel patterns that select the 1 immediate version?
> Not for this patch, but should we use this in X86MCInstLower and remove all the isel patterns that select the 1 immediate version?

Good idea! I can do it after this patch.


================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86InstrOptimization.cpp:55
+bool X86::optimizeShiftRotateWithImmediateOne(MCInst &MI) {
+  auto E = MI.end();
+  if (MI.begin() == E)
----------------
craig.topper wrote:
> Why bring iterators into this? Can't we use `getNumOperands() - 1`?
> Why bring iterators into this? Can't we use `getNumOperands() - 1`?




================
Comment at: llvm/lib/Target/X86/X86InstrAsmAlias.td:554
 
-/*  FIXME: This is disabled because the asm matcher is currently incapable of
- *  matching a fixed immediate like $1.
----------------
barannikov88 wrote:
> I think this can be done by implementing `validateTargetOperandClass` for `MCK__36_1` ($1).
> See how ARM does this.
> 
Thanks for the info! I added the comments to `optimizeShiftRotateWithImmediateOne`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150068



More information about the llvm-commits mailing list