"""Converts bytecode IR to CFG IR.""" import modelverse_jit.bytecode_ir as bytecode_ir import modelverse_jit.cfg_ir as cfg_ir class AnalysisState(object): """State that is common to the bytecode->CFG transformation of a function.""" def __init__(self): pass def analyze_if(self, instruction): raise NotImplementedError() def analyze_while(self, instruction): raise NotImplementedError() def analyze_return(self, instruction): raise NotImplementedError() def analyze_constant(self, instruction): raise NotImplementedError() def analyze_resolve(self, instruction): raise NotImplementedError() def analyze_declare(self, instruction): raise NotImplementedError() def analyze_global(self, instruction): raise NotImplementedError() def analyze_assign(self, instruction): raise NotImplementedError() def analyze_access(self, instruction): raise NotImplementedError() def analyze_output(self, instruction): raise NotImplementedError() def analyze_input(self, instruction): raise NotImplementedError() def analyze_call(self, instruction): raise NotImplementedError() def analyze_break(self, instruction): raise NotImplementedError() def analyze_continue(self, instruction): raise NotImplementedError() instruction_analyzers = { bytecode_ir.SelectInstruction : analyze_if, bytecode_ir.WhileInstruction : analyze_while, bytecode_ir.ReturnInstruction : analyze_return, bytecode_ir.ConstantInstruction : analyze_constant, bytecode_ir.ResolveInstruction : analyze_resolve, bytecode_ir.DeclareInstruction : analyze_declare, bytecode_ir.GlobalInstruction : analyze_global, bytecode_ir.AssignInstruction : analyze_assign, bytecode_ir.AccessInstruction : analyze_access, bytecode_ir.OutputInstruction : analyze_output, bytecode_ir.InputInstruction : analyze_input, bytecode_ir.CallInstruction : analyze_call, bytecode_ir.BreakInstruction : analyze_break, bytecode_ir.ContinueInstruction : analyze_continue }