[PATCH] D19716: [mips] Use MipsMCExpr instead of MCSymbolRefExpr for all relocations.

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 02:15:09 PDT 2016


dsanders created this revision.
dsanders added a reviewer: sdardis.
dsanders added a subscriber: llvm-commits.
dsanders added a dependency: D19714: [mips][ias] Split expandMemInst between MipsAsmParser and MipsTargetStreamer. Almost NFC..
Herald added subscribers: sdardis, dsanders.

This is much closer to the way MIPS relocation expressions work
(%hi(foo + 2) rather than %hi(foo) + 2) and removes the need for the
various bodges in MipsAsmParser::evaluateRelocExpr().

Removing those bodges ensures that the constant stored in MCValue is the
full 32 or 64-bit (depending on ABI) offset from the symbol. This will be used
to correct the %hi/%lo matching needed to sort the relocation table correctly.

As part of this:
* Gave MCExpr::print() the ability to omit parenthesis when emitting a
  symbol reference inside a MipsMCExpr operator like %hi(X). Without this
  we print things like %lo(($L1)).
* %hi(%neg(%gprel(X))) is now three MipsMCExpr's instead of one. Most of
  the related special cases have been removed or moved to MipsMCExpr. We
  can remove the rest as we gain support for the less common relocations
  when they are not part of this specific combination.
* Renamed MipsMCExpr::VariantKind and the enum prefix ('VK_') to avoid confusion
  with MCSymbolRefExpr::VariantKind and its prefix (also 'VK_').
* fixup_Mips_GOT_Local and fixup_Mips_GOT_Global were found to be identical
  and merged into fixup_Mips_GOT.
* MO_GOT16 and MO_GOT turned out to be identical and have been merged into
  MO_GOT.
* VK_Mips_GOT and VK_Mips_GOT16 turned out to be the same thing so they
  have been merged into MEK_GOT

Depends on D19714.

http://reviews.llvm.org/D19716

Files:
  include/llvm/MC/MCExpr.h
  lib/MC/ELFObjectWriter.cpp
  lib/MC/MCELFStreamer.cpp
  lib/MC/MCExpr.cpp
  lib/Target/Mips/AsmParser/MipsAsmParser.cpp
  lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp
  lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
  lib/Target/Mips/MCTargetDesc/MipsBaseInfo.h
  lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
  lib/Target/Mips/MCTargetDesc/MipsFixupKinds.h
  lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
  lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp
  lib/Target/Mips/MCTargetDesc/MipsMCExpr.h
  lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
  lib/Target/Mips/MipsISelLowering.cpp
  lib/Target/Mips/MipsMCInstLower.cpp
  lib/Target/Mips/MipsMCInstLower.h
  test/MC/Mips/cprestore-noreorder.s
  test/MC/Mips/cprestore-reorder.s
  test/MC/Mips/expansion-jal-sym-pic.s
  test/MC/Mips/expr1.s
  test/MC/Mips/macro-la.s
  test/MC/Mips/micromips-expansions.s
  test/MC/Mips/micromips-relocations.s
  test/MC/Mips/mips-expansions.s
  test/MC/Mips/mips32r6/relocations.s
  test/MC/Mips/mips64r6/relocations.s
  test/MC/Mips/mips_directives.s
  test/MC/Mips/relocation.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19716.55552.patch
Type: text/x-patch
Size: 109754 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160429/82e7ec33/attachment.bin>


More information about the llvm-commits mailing list