[all-commits] [llvm/llvm-project] 18e09d: [Mips] Rework relocation expression parsing

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun Mar 2 11:27:38 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 18e09da2552d99a641b8257e22b4067730cdb2bc
      https://github.com/llvm/llvm-project/commit/18e09da2552d99a641b8257e22b4067730cdb2bc
  Author: Fangrui Song <i at maskray.me>
  Date:   2025-03-02 (Sun, 02 Mar 2025)

  Changed paths:
    M llvm/include/llvm/MC/MCAsmInfo.h
    M llvm/include/llvm/MC/MCAsmMacro.h
    M llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h
    M llvm/lib/MC/MCParser/AsmLexer.cpp
    M llvm/lib/MC/MCParser/AsmParser.cpp
    M llvm/lib/MC/MCParser/MCAsmLexer.cpp
    M llvm/lib/MC/MCParser/MasmParser.cpp
    M llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
    M llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp
    M llvm/test/MC/Mips/expr1.s
    M llvm/test/MC/Mips/macro-aliases-invalid-wrong-error.s

  Log Message:
  -----------
  [Mips] Rework relocation expression parsing

A relocation expression might be used in an immediate operand or a
memory offset. https://reviews.llvm.org/D23110 , which intended to
generalize chained relocation operators (%hi(%neg(%gp_rel(x)))),
inappropriated introduced intrusive changes to the generic code. This
patch drops the intrusive changes and significantly simplifies the code.
The new style is similar to pre-D23110 but much cleaner.

Some weird expressions allowed by gas are not supported for simplicity,
e.g. "%lo foo", "(%lo(foo))", "%lo(foo)+1".
"(%lo(foo))", while previously parsed, is not used in practice.
"%lo(foo)+1" and "%lo(2*4)+foo" were previously parsed but would lead to
an error anyway as the expression is not relocatable
(`evaluateSymbolicAdd` does not fold the Add when RefKind are
different).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list