[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)
commit9d3f12501a4594421a8d07053dd9dbaa652c7418
treed802b5c35d624cb00ed2c3e7578b4afa6f3195df
parent07f1e2e2b3880bfc3e470bb111c31028371ab8f3
[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

llvm-svn: 314389
17 files changed:
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/lib/Target/RISCV/MCTargetDesc/CMakeLists.txt
llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVFixupKinds.h [new file with mode: 0644]
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp [new file with mode: 0644]
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h [new file with mode: 0644]
llvm/lib/Target/RISCV/RISCVInstrFormats.td
llvm/lib/Target/RISCV/RISCVInstrInfo.td
llvm/test/MC/RISCV/fixups-diagnostics.s [new file with mode: 0644]
llvm/test/MC/RISCV/fixups.s [new file with mode: 0644]
llvm/test/MC/RISCV/hilo-constaddr.s [new file with mode: 0644]
llvm/test/MC/RISCV/relocations.s [new file with mode: 0644]
llvm/test/MC/RISCV/rv32i-invalid.s
llvm/test/MC/RISCV/rv32i-valid.s