regs = ['RA', 'RS', 'RB', 'RC', 'RT']
fregs = ['FRA', 'FRS', 'FRB', 'FRC', 'FRT', 'FRS']
-HELPERS = {
- "EXTS",
- "EXTS128",
- "EXTS64",
- "EXTZ64",
- "FPADD32",
- "FPADD64",
- "FPCOS32",
- "FPDIV32",
- "FPDIV64",
- "FPMUL32",
- "FPMUL64",
- "FPMULADD32",
- "FPSIN32",
- "FPSUB32",
- "FPSUB64",
- "MASK",
- "MASK32",
- "MULS",
- "ROTL32",
- "ROTL64",
- "SHL64",
- "SINGLE",
- "SVSTATE_NEXT",
- "TRAP",
-}
+SPECIAL_HELPERS = {'concat', 'MEM', 'GPR', 'FPR', 'SPR'}
def Assign(autoassign, assignname, left, right, iea_mode):
names = []
name = arg.id
if name in regs + fregs:
read_regs.add(name)
- # special-case, these functions must be made "self.xxxx"
- if atom.id in HELPERS:
+ # special-case, these functions must NOT be made "self.xxxx"
+ if atom.id not in SPECIAL_HELPERS:
name = ast.Name("self", ast.Load())
atom = ast.Attribute(name, atom, ast.Load())
return ast.Call(atom, trailer[1], [])
| expr_stmt"""
if isinstance(p[1], ast.Call):
p[0] = ast.Expr(p[1])
- elif isinstance(p[1], ast.Name) and p[1].id in HELPERS:
+ elif isinstance(p[1], ast.Name) and p[1].id not in SPECIAL_HELPERS:
fname = p[1].id
name = ast.Name("self", ast.Load())
name = ast.Attribute(name, fname, ast.Load())
# self.lexer.input(code)
result = self.parser.parse(code, lexer=self.lexer, debug=self.debug)
if self.helper:
- result = [ast.ClassDef("ISACallerFnHelper", [], [], result, decorator_list=[])]
+ result = [ast.ClassDef("ISACallerFnHelper", ["ISACallerHelper"], [], result, decorator_list=[])]
return ast.Module(result)
header = """\
# auto-generated by pyfnwriter.py, do not edit or commit
-from openpower.decoder.isa.caller import inject
-from openpower.decoder.helpers import (EXTS, EXTS64, EXTZ64, ROTL64, ROTL32,
- MASK, MASK32,
- ne, eq, gt, ge, lt, le, ltu, gtu, length,
- trunc_divs, trunc_rems, MULS, DIVS, MODS,
- EXTS128, undefined,
- SINGLE,
- FPADD32, FPSUB32, FPMUL32, FPDIV32,
- FPADD64, FPSUB64, FPMUL64, FPDIV64,
- )
+from openpower.decoder.helpers import ISACallerHelper
from openpower.decoder.selectable_int import SelectableInt
from openpower.decoder.selectable_int import selectconcat as concat
# go through all instructions
pcode = function['pcode']
print(pcode)
- pycode = convert_to_pure_python(pcode)
+ pycode = convert_to_pure_python(pcode, True)
f.write(pycode)
def write_isa_class(self):
# auto-generated by pywriter.py, do not edit or commit
from openpower.decoder.isa.caller import inject, instruction_info
-from openpower.decoder.helpers import (EXTS, EXTS64, EXTZ64, ROTL64, ROTL32,
- MASK, MASK32,
+from openpower.decoder.helpers import (
ne, eq, gt, ge, lt, le, ltu, gtu, length,
- trunc_divs, trunc_rems, MULS, DIVS, MODS,
- EXTS128, undefined,
- bitrev, SHL64,
RANGE,
ISACallerHelper,
)
from openpower.decoder.selectable_int import SelectableInt
from openpower.decoder.selectable_int import selectconcat as concat
from openpower.decoder.orderedset import OrderedSet
-from openpower.decoder.isafunctions.bcd import BCD_TO_DPD, DPD_TO_BCD
+from openpower.decoder.isafunctions.all import ISACallerFnHelper
"""
FPMULADD32,
FPSIN32, FPCOS32,
)
-from openpower.decoder.isafunctions.fpfromint import INT2FP
-from openpower.decoder.isafunctions.double2single import DOUBLE
"""