%hi($tmp) and %lo($tmp) relocations for Mips backend, where $tmp = sym1 - sym2
mseaborn at chromium.org
Fri Dec 20 02:39:07 PST 2013
On 16 December 2013 13:31, Sasa Stankovic <Sasa.Stankovic at rt-rk.com> wrote:
> Hi Mark,
> The patch is attached.
Thanks, that seems cleaner. I have two more questions:
1) Would it make sense to move this new logic into EvaluateAsRelocatable(),
so that if EvaluateAsRelocatable() is called on a symbol S where S = sym2 -
sym1, then it returns an MCValue containing just a constant rather than
returning MCValue::get(sym2, sym1, 0)? Then the new logic would be applied
in more cases -- it would apply to other callers of EvaluateAsRelocatable().
Actually, it appears the way to do that would just be to remove the
"SRE->getKind() == MCSymbolRefExpr::VK_None" check from
MCExpr::EvaluateAsRelocatableImpl()'s handling of SymbolRef in MCExpr.cpp.
Isn't your patch roughly equivalent to that? Are there cases where that
check is necessary for correctness? Removing it doesn't seem to cause any
tests to fail.
2) Why is it that you handle cases like:
.set diff, label2 - label1
lui $2, %lo(diff)
but not cases where that is written more directly as:
lui $2, %lo(label2 - label1)
(which still gives the UNREACHABLE error I described earlier in the
thread)? Is it just because the former is easier to implement? If so, is
that just a quirk of how these cases are handled via different code paths
I don't know the MC layer well enough to know whether the patch is OK to
commit. CC'ing James Grosbach (based on CODE_OWNERS.TXT).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits