OSDN Git Service

[RISCV] Generate address sequences suitable for mcmodel=medium
authorAlex Bradbury <asb@lowrisc.org>
Mon, 1 Apr 2019 14:42:56 +0000 (14:42 +0000)
committerAlex Bradbury <asb@lowrisc.org>
Mon, 1 Apr 2019 14:42:56 +0000 (14:42 +0000)
commit2e53035953bc220a5ceaa03239968b18bfddd57b
treed8dd864a57dd2d47cd127ee498cfbf1dc86f6cce
parentb602cf0752d7655dee0eb72dd6184dbd2ae34040
[RISCV] Generate address sequences suitable for mcmodel=medium

This patch adds an implementation of a PC-relative addressing sequence to be
used when -mcmodel=medium is specified. With absolute addressing, a 'medium'
codemodel may cause addresses to be out of range. This is because while
'medium' implies a 2 GiB addressing range, this 2 GiB can be at any offset as
opposed to 'small', which implies the first 2 GiB only.

Note that LLVM/Clang currently specifies code models differently to GCC, where
small and medium imply the same functionality as GCC's medlow and medany
respectively.

Differential Revision: https://reviews.llvm.org/D54143
Patch by Lewis Revill.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357393 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/MachineBasicBlock.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/Target/RISCV/RISCVExpandPseudoInsts.cpp
lib/Target/RISCV/RISCVISelLowering.cpp
lib/Target/RISCV/RISCVISelLowering.h
lib/Target/RISCV/RISCVInstrInfo.cpp
lib/Target/RISCV/RISCVMCInstLower.cpp
lib/Target/RISCV/Utils/RISCVBaseInfo.h
test/CodeGen/RISCV/codemodel-lowering.ll [new file with mode: 0644]