From: Jacob Lifshay Date: Tue, 9 May 2023 07:27:19 +0000 (-0700) Subject: SetFX is not a normal function -- it can assign to its input X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a29d6d115ecfd0e020c60aa748dba52d4079adf6;p=openpower-isa.git SetFX is not a normal function -- it can assign to its input --- diff --git a/src/openpower/decoder/pseudo/parser.py b/src/openpower/decoder/pseudo/parser.py index 1e30b574..a88f9934 100644 --- a/src/openpower/decoder/pseudo/parser.py +++ b/src/openpower/decoder/pseudo/parser.py @@ -927,6 +927,19 @@ class PowerParser: name = arg.id if name in regs + fregs: read_regs.add(name) + if atom.id == "SetFX": + if len(trailer[1]) != 1 or \ + not isinstance(trailer[1][0], ast.Attribute): + raise_syntax_error( + "SetFX call must have only one argument that is an " + "attribute access -- like `SetFX(FPSCR.VXSNAN)`", + self.filename, trailer[2].lineno, trailer[2].lexpos, + self.input_text) + arg = trailer[1][0] + args = [arg.value, ast.Str(arg.attr)] + name = ast.Name("self", ast.Load()) + atom = ast.Attribute(name, atom, ast.Load()) + return ast.Call(atom, args, []) # special-case, these functions must NOT be made "self.xxxx" if atom.id not in SPECIAL_HELPERS: name = ast.Name("self", ast.Load())