Skip to content

Commit af43e87

Browse files
FlyGoattsbogend
authored andcommitted
MIPS: mipsregs: Parse fp and sp register by name in parse_r
parse_r helper is used to parse register number from oprand, it only handles oprand which use number to refer register before. However compiler may use $gp and $sp to reference register 29 and 30. Handle this situation by adding relevant match name. Fixes compilation error: {standard input}: Assembler messages: {standard input}:1937: Error: Unable to parse register name $fp Signed-off-by: Jiaxun Yang <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 188942f commit af43e87

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/mips/include/asm/mipsregs.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,11 +1422,13 @@ static inline int mm_insn_16bit(u16 insn)
14221422
*/
14231423

14241424
/* Match an individual register number and assign to \var */
1425-
#define _IFC_REG(n) \
1426-
".ifc \\r, $" #n "\n\t" \
1425+
#define _IFC_REG_NAME(name, n) \
1426+
".ifc \\r, $" #name "\n\t" \
14271427
"\\var = " #n "\n\t" \
14281428
".endif\n\t"
14291429

1430+
#define _IFC_REG(n) _IFC_REG_NAME(n, n)
1431+
14301432
#define _ASM_SET_PARSE_R \
14311433
".macro parse_r var r\n\t" \
14321434
"\\var = -1\n\t" \
@@ -1438,6 +1440,7 @@ static inline int mm_insn_16bit(u16 insn)
14381440
_IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23) \
14391441
_IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27) \
14401442
_IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31) \
1443+
_IFC_REG_NAME(sp, 29) _IFC_REG_NAME(fp, 30) \
14411444
".iflt \\var\n\t" \
14421445
".error \"Unable to parse register name \\r\"\n\t" \
14431446
".endif\n\t" \

0 commit comments

Comments
 (0)