[PATCH] D124413: [llvm-ml] Improve indirect call parsing
Eric Astor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 25 13:39:02 PDT 2022
epastor added inline comments.
================
Comment at: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp:2642
+ if (Parser.isParsingMasm()) {
+ bool IsUnconditionalBranch =
+ Name.equals_insensitive("jmp") || Name.equals_insensitive("call");
----------------
Why do we need to set the DefaultBaseReg unconditionally for the unconditional branches? Aren't they only implicitly RIP-relative if referencing a named symbol (i.e., one with known type, which is what the SM.getElementSize() below is testing)?
(Also, I'm a little surprised if the conditional branches have different handling, though anything's possible.)
================
Comment at: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp:2655
+ StringRef DispName = SRE->getSymbol().getName();
+ if (!Parser.lookUpData(DispName, ATI)) {
+ StringRef TypeName = ATI.Name;
----------------
Rather than lookUpData, can't we just use the type info that's already available in SM? (getType if you want the name, and others if you want other information.) There's even a chance this might account for the QWORD PTR "cast" already.
================
Comment at: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp:2658
+ if (is64BitMode()) {
+ if (TypeName.equals_insensitive("QWORD"))
+ MaybeDirectBranchDest = false;
----------------
Can't we check the type size, rather than the name? If it's actually special-cased on these types alone, then maybe we should consider marking the type info with a special flag rather than handling the mnemonic here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124413/new/
https://reviews.llvm.org/D124413
More information about the llvm-commits
mailing list