Instead of creating the MCSymbolRefExpr's manually, we can use evaluateRelocExpr().
This gives us the ability to correctly handle MCBinaryExpr's for LASym.
Details
- Reviewers
dsanders
Diff Detail
Event Timeline
lib/Target/Mips/AsmParser/MipsAsmParser.cpp | ||
---|---|---|
2599–2600 | Despite it's name, I don't think this is really evaluating expressions. It seems to be simplifying them. | |
2599–2658 | This code seems suspicious. For example, the MCBinaryExpr path tries to apply the RelocStr to both sides of the operator but it's easy to think of cases where this is incorrect. For example %hi(symbol+1) is not equivalent to %hi(symbol) + %hi(1) when symbol==0. The former results in %hi(1) = 0 while the latter results in %hi(0) + %hi(1) = 1. | |
test/MC/Mips/mips-expansions.s | ||
41–57 | These look wrong to me. I'd expect the same expression inside both the %hi and %lo's like so: |
lib/Target/Mips/AsmParser/MipsAsmParser.cpp | ||
---|---|---|
2599–2658 | It's true that this function needs to be revised a bit, but I don't think it should be a blocker for this patch, as long as the output is semantically equivalent to GAS' (see my reply to the comment below). | |
test/MC/Mips/mips-expansions.s | ||
41–57 | AFAICT the examples you give do not match GAS' output. |
Despite it's name, I don't think this is really evaluating expressions. It seems to be simplifying them.