[PATCH] D23568: [RISCV 10/10] Add fixups and relocations necessary to support %hi(), %lo(), %pcrel_hi()

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 16 08:47:29 PDT 2016


asb created this revision.
asb added reviewers: theraven, jyknight.
asb added a subscriber: llvm-commits.

%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).

I actually tried a couple ways of handling this and decided that introspecting the instruction format in RISCVMCCodeEmitter ended up cleanest. I'd be happy to hear any other suggestions though.

This completes the first batch of patches.

https://reviews.llvm.org/D23568

Files:
  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
  lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
  lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
  lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
  lib/Target/RISCV/RISCVInstrFormats.td
  lib/Target/RISCV/RISCVInstrInfo.td
  test/MC/RISCV/fixups.s
  test/MC/RISCV/hilo-constaddr.s
  test/MC/RISCV/relocations.s
  test/MC/RISCV/rv32i-invalid.s
  test/MC/RISCV/rv32i-valid.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23568.68194.patch
Type: text/x-patch
Size: 35499 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160816/1b66fa11/attachment.bin>


More information about the llvm-commits mailing list