[llvm-branch-commits] [MC] Move MCTargetOptions pointer from MCContext to MCAsmInfo (PR #180464)

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Feb 8 20:18:19 PST 2026


https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/180464

Except MC-internal `MCAsmInfo()` uses, MCAsmInfo is always constructed
with `const MCTargetOptions &` via `TargetRegistry::createMCAsmInfo`
(https://reviews.llvm.org/D41349). Store the pointer in MCAsmInfo and
change `MCContext::getTargetOptions()` to retrieve it from there,
removing the `MCTargetOptions const *TargetOptions` member from
MCContext.

MCContext's constructor still accepts an MCTargetOptions parameter
for now. An assert verifies it matches MCAsmInfo's copy when provided.
A subsequent change will remove this parameter and update all callers.

In addition, assert that MCTargetOptions is non-null in the MCAssembler
constructor and remove the now-unnecessary null checks in
ELFObjectWriter.





More information about the llvm-branch-commits mailing list