[PATCH] D137233: Add support for the BranchRelaxation pass

Xiaodong Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 2 01:22:05 PDT 2022


XiaodongLoong created this revision.
Herald added subscribers: hiraditya, arichardson.
Herald added a project: All.
XiaodongLoong requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When the branch target is out of the range represented by the current
branch instruction's immediate, branch relaxation is required. There
are three types of immediate for branch instructions on LoongArch,
including simm16, simm21 and simm26. And the real branch target
address is PC + sext(simmXX << 2). In addition, the indirect branch
way is implemented to support larger branch target.

BranchRelaxation pass calls `RenumberBlocks` to renumber all of the
machine basic blocks in the function. So the machine basic blocks
number changed in some test cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137233

Files:
  llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
  llvm/lib/Target/LoongArch/LoongArchInstrInfo.h
  llvm/lib/Target/LoongArch/LoongArchTargetMachine.cpp
  llvm/test/CodeGen/LoongArch/analyze-branch.ll
  llvm/test/CodeGen/LoongArch/branch-relaxation.ll
  llvm/test/CodeGen/LoongArch/exception-pointer-register.ll
  llvm/test/CodeGen/LoongArch/jump-table.ll
  llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/loongarch_generated_funcs.ll.generated.expected
  llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/loongarch_generated_funcs.ll.nogenerated.expected

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137233.472529.patch
Type: text/x-patch
Size: 17890 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221102/3c1edd02/attachment.bin>


More information about the llvm-commits mailing list