[all-commits] [llvm/llvm-project] 3333c2: [llvm-ml] Improve indirect call parsing

Alan Zhao via All-commits all-commits at lists.llvm.org
Thu Apr 28 10:17:47 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3333c28fc0dc0485e0e08b9d7039e0a501884b7a
      https://github.com/llvm/llvm-project/commit/3333c28fc0dc0485e0e08b9d7039e0a501884b7a
  Author: Alan Zhao <ayzhao at google.com>
  Date:   2022-04-28 (Thu, 28 Apr 2022)

  Changed paths:
    M llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
    M llvm/lib/Target/X86/AsmParser/X86Operand.h
    A llvm/test/tools/llvm-ml/indirect_branch.asm

  Log Message:
  -----------
  [llvm-ml] Improve indirect call parsing

In MASM, if a QWORD symbol is passed to a jmp or call instruction in
64-bit mode or a DWORD or WORD symbol is passed in 32-bit mode, then
MSVC's assembler recognizes that as an indirect call. Additionally, if
the operand is qualified as a ptr, then that should also be an indirect
call.

Furthermore, in 64-bit mode, such operands are implicitly rip-relative
(in fact, MSVC's assembler ml64.exe does not allow explicitly specifying
rip as a base register.)

To keep this patch managable, this patch does not include:
* error messages for wrong operand types (e.g. passing a QWORD in 32-bit
  mode)
* resolving indirect calls if the symbol is declared after it's first
  use (llvm-ml currently only runs a single pass).
* imlementing the extern keyword (required to resolve
  https://crbug.com/762167.)

This patch is likely missing a bunch of edge cases, so please do point
them out in the review.

Reviewed By: epastor, hans, MaskRay

Committed By: epastor (on behalf of ayzhao)

Differential Revision: https://reviews.llvm.org/D124413




More information about the All-commits mailing list