[PATCH] D155357: [RISCV] Allow delayed decision for ADD/SUB relocations

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 10:03:52 PDT 2023


MaskRay added a comment.

In D155357#4518986 <https://reviews.llvm.org/D155357#4518986>, @asb wrote:

> One piece of this I'm struggling to follow a bit is evaluateKnownAbsolute and `InSet`. This `InSet` parameter doesn't have much in the way of documentation. I'm sure it's obvious to someone working in this code regularly, but could you please clarify the intended meaning of this parameter?

Even if I have stared at the code for quite some time, `InSet` is not so obvious to me...

My current understanding is:

Some expressions cannot use relocations (e.g., `.size` and `.fill` directives). They set `InSet` as a parameter in various methods in `llvm/lib/MC/`.
This makes expression evaluation different based on the context and should be generally avoided if possible.
This issue is aggravated by the fact that LLVMMC seems to misuse `InSet` and make `InSet` affect the behavior in situations where it doesn't need to.
Unfortunately, the uses are a bit messy. Additionally, `InSet` appears to be used as a workaround for Mach-O in some places, specifically related to its `.subsections_via_symbols` mechanism.

---

We can probably add this explanation above `MCExpr::evaluateAsAbsolute`. In some situations `InSet` can be removed. I'll try to clean this up further when I get more time.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155357/new/

https://reviews.llvm.org/D155357



More information about the llvm-commits mailing list