OSDN Git Service

[RISCV] Add common fixups and relocations
authorAlex Bradbury <asb@lowrisc.org>
Thu, 28 Sep 2017 08:26:24 +0000 (08:26 +0000)
committerAlex Bradbury <asb@lowrisc.org>
Thu, 28 Sep 2017 08:26:24 +0000 (08:26 +0000)
commit5f9771e74224e09e75166cb13bb2bd6e66837e67
tree954ae532b98dc2c732f7747818d7d84e170a8e08
parente3cc458019caadbf84dcc86e39afd723ac9ce013
[RISCV] Add common fixups and relocations

%lo(), %hi(), and %pcrel_hi() are supported and test cases have been added to
ensure the appropriate fixups and relocations are generated. I've added an
instruction format field which is used in RISCVMCCodeEmitter to, for
instance, tell whether it should emit a lo12_i fixup or a lo12_s fixup
(RISC-V has two 12-bit immediate encodings depending on the instruction
type).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314389 91177308-0d34-0410-b5e6-96231b3b80d8
17 files changed:
lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
lib/Target/RISCV/MCTargetDesc/CMakeLists.txt
lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp
lib/Target/RISCV/MCTargetDesc/RISCVFixupKinds.h [new file with mode: 0644]
lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp [new file with mode: 0644]
lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h [new file with mode: 0644]
lib/Target/RISCV/RISCVInstrFormats.td
lib/Target/RISCV/RISCVInstrInfo.td
test/MC/RISCV/fixups-diagnostics.s [new file with mode: 0644]
test/MC/RISCV/fixups.s [new file with mode: 0644]
test/MC/RISCV/hilo-constaddr.s [new file with mode: 0644]
test/MC/RISCV/relocations.s [new file with mode: 0644]
test/MC/RISCV/rv32i-invalid.s
test/MC/RISCV/rv32i-valid.s