target/hexagon: Fix disassembly of extended GP-relative accesses
PATCH 1/1 target/hexagon: Fix disassembly of extended GP-relative accesses
A GP-relative load or store with a constant extender is an absolute
access: the semantics read GP as 0 when insn->extension_valid is set, and the extended immediate is the full address. The printed form kept the "gp+" base, so for example
R0 = memw(gp+##0x48c30)
was shown for an instruction that accesses 0x48c30 and does not use GP.
Only print the "gp+" base when there is no extender.
--- target/hexagon/gen_printinsn.py | 7 +++++++ 1 file changed, 7 insertions(+)
target/hexagon/gen_printinsn.py +7 -0
@@ -125,6 +125,10 @@ def main(): beh = hex_common.absimmre.sub(r"#%s0x%x", beh) beh = hex_common.relimmre.sub(r"PC+%s%d", beh) beh = spacify(beh) + + gp_relative = "(gp+" in beh + if gp_relative: + beh = beh.replace("(gp+", "(%s") # Print out a literal "%s" at the end, used to match empty string # so C won't complain at us if "A_VECX" in hex_common.attribdict[tag]:
@@ -158,6 +162,9 @@ def main(): ri += 1 else: # immediate + if gp_relative: + f.write(', insn->extension_valid ? "" : "gp+"') + gp_relative = False if immlett.isupper(): if extendable_upper_imm: if immlett in "rR":
Signature · 1 line
2.34.1
Quoted 9 lines · Brian Cain
A GP-relative load or store with a constant extender is an absolute
access: the semantics read GP as 0 wheninsn->extension_validis set, and the extended immediate is the full address. The printed form kept the "gp+" base, so for exampleR0 = memw(gp+##0x48c30)was shown for an instruction that accesses
0x48c30and does not use GP.
Quoted 8 lines
Only print the "gp+" base when there is no extender.
Signed-off-by Brian Cain <[email protected]>--- target/hexagon/gen_printinsn.py | 7 +++++++ 1 file changed, 7 insertions(+)
Quoted 9 lines · Brian Cain
A GP-relative load or store with a constant extender is an absolute
access: the semantics read GP as 0 wheninsn->extension_validis set, and the extended immediate is the full address. The printed form kept the "gp+" base, so for exampleR0 = memw(gp+##0x48c30)was shown for an instruction that accesses
0x48c30and does not use GP.
Quoted 7 lines
Only print the "gp+" base when there is no extender.
Signed-off-by Brian Cain <[email protected]>--- target/hexagon/gen_printinsn.py | 7 +++++++ 1 file changed, 7 insertions(+)