pass
+class Reserve(Literal, choices=("RESERVE", "RESERVE_LENGTH", "RESERVE_ADDR")):
+ pass
+
+
+class Overflow(Literal, choices=("overflow",)):
+ pass
+
+
+class Special(Literal, choices=(
+ "CR", "LR", "CTR", "TAR", "FPSCR", "MSR",
+ "SVSTATE", "SVREMAP", "SRR0", "SRR1",
+ "SVSHAPE0", "SVSHAPE1", "SVSHAPE2", "SVSHAPE3",
+ )):
+ pass
+
+
+class XLEN(Literal, choices=("XLEN",)):
+ pass
+
+
class IntLiteral(Literal):
pass
"""
atom : NAME
"""
- p[0] = p[1]
+ # Note: GPR and FPR are handled separately.
+ specials = {frozenset(cls):cls for cls in (
+ pc_ast.CR3,
+ pc_ast.CR5,
+ pc_ast.XER,
+ pc_ast.Reserve,
+ pc_ast.Overflow,
+ pc_ast.Special,
+ pc_ast.XLEN,
+ )}
+ value = str(p[1])
+ for (variants, cls) in specials.items():
+ if value in variants:
+ p[0] = cls(value)
+ break
+ else:
+ p[0] = p[1]
def p_atom_number(self, p):
"""