[all-commits] [llvm/llvm-project] 95f924: [RISCV][MC] Implement evaluateBranch for auipc+jal...

Job Noorman via All-commits all-commits at lists.llvm.org
Thu Oct 19 23:36:28 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 95f924f30ae16be0d125646b9e4f1e33d4e5d08b
      https://github.com/llvm/llvm-project/commit/95f924f30ae16be0d125646b9e4f1e33d4e5d08b
  Author: Job Noorman <jnoorman at igalia.com>
  Date:   2023-10-20 (Fri, 20 Oct 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
    M llvm/test/tools/llvm-objdump/ELF/RISCV/branches.s
    A llvm/test/tools/llvm-objdump/ELF/RISCV/multi-instr-target.s
    M llvm/tools/llvm-objdump/llvm-objdump.cpp

  Log Message:
  -----------
  [RISCV][MC] Implement evaluateBranch for auipc+jalr pairs (#65480)

This patch implements `MCInstrAnalysis` state in order to be able
analyze auipc+jalr pairs inside `evaluateBranch`.

This is implemented as follows:
- State: array of currently known GPR values;
- Whenever an auipc is detected in `updateState`, update the state value
of RD with the immediate;
- Whenever a jalr is detected in `evaluateBranch`, check if the state
holds a value for RS1 and use that to compute its target.

Note that this is similar to how binutils implements it and the output
of llvm-objdump should now mostly match the one of GNU objdump.

This patch also updates the relevant llvm-objdump patches and adds a new
one testing the output for interleaved auipc+jalr pairs.




More information about the All-commits mailing list