<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 16 December 2013 13:31, Sasa Stankovic <span dir="ltr"><<a href="mailto:Sasa.Stankovic@rt-rk.com" target="_blank">Sasa.Stankovic@rt-rk.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Mark,<br>
<br>
The patch is attached.<br></blockquote></div><br></div><div class="gmail_extra">Thanks, that seems cleaner.  I have two more questions:<br><br></div><div class="gmail_extra">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().<br>

<br></div><div class="gmail_extra">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.<br>

</div><div class="gmail_extra"><br></div><div class="gmail_extra">2) Why is it that you handle cases like:<br><br></div><div class="gmail_extra">.set diff, label2 - label1<br>lui $2, %lo(diff)<br><br></div><div class="gmail_extra">

but not cases where that is written more directly as:<br><br></div><div class="gmail_extra">lui $2, %lo(label2 - label1)<br><br></div><div class="gmail_extra">(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 in MC?<br>

<br></div><div class="gmail_extra">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).<br><br>Cheers,<br>Mark<br><br></div></div>