[all-commits] [llvm/llvm-project] 7f28e8: [RISCV] Implement RISCVInstrInfo::isAddImmediate (...

Alex Bradbury via All-commits all-commits at lists.llvm.org
Thu Nov 16 06:43:44 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7f28e8ced7ef36a51e5cbca08818288ab167a8ab
      https://github.com/llvm/llvm-project/commit/7f28e8ced7ef36a51e5cbca08818288ab167a8ab
  Author: Alex Bradbury <asb at igalia.com>
  Date:   2023-11-16 (Thu, 16 Nov 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
    M llvm/lib/Target/RISCV/RISCVInstrInfo.h
    M llvm/unittests/Target/RISCV/CMakeLists.txt
    A llvm/unittests/Target/RISCV/RISCVInstrInfoTest.cpp

  Log Message:
  -----------
  [RISCV] Implement RISCVInstrInfo::isAddImmediate (#72356)

This hook is called by the target-independent implementation of
TargetInstrInfo::describeLoadedValue. I've opted to test it via a C++
unit test, which although fiddly to set up seems the right way to test a
function with such clear intended semantics (rather than testing the
impact indirectly).

isAddImmediate will never recognise ADDIW as an add immediate which I
_think_ is conservatively correct, as the caller may not understand its
semantics vs ADDI.

Note that although the doc comment for isAddImmediate specifies its
behaviour solely in terms of physical registers, none of the current
in-tree implementations (including this one) bail out on virtual
registers (see #72357).




More information about the All-commits mailing list