Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rec apply_cmd arch prog = function
- | AnalysisAst f -> (
- match prog with
- | Ast p as p' -> f p; p'
- | _ -> failwith "need explicit translation to AST"
- )
- | AnalysisModeAst f -> (
- match prog with
- | Ast p as p' -> f (Input.get_arch arch) p; p'
- | _ -> failwith "need explicit translation to AST"
- )
- | AnalysisAstCfg f -> (
- match prog with
- | AstCfg p as p' -> f p; p'
- | _ -> failwith "need explicit translation to AST CFG"
- )
- | AnalysisModeAstCfg f -> (
- match prog with
- | AstCfg p as p' -> f (Input.get_arch arch) p; p'
- | _ -> failwith "need explicit translation to AST CFG"
- )
- | AnalysisSsa f -> (
- match prog with
- | Ssa p as p' -> f p; p'
- | _ -> failwith "need explicit translation to SSA"
- )
- | TransformAst f -> (
- match prog with
- | Ast p -> Ast(f p)
- | _ -> failwith "need explicit translation to AST"
- )
- | TransformModeAst f -> (
- match prog with
- | Ast p -> Ast(f (Input.get_arch arch) p)
- | _ -> failwith "need explicit translation to AST"
- )
- | TransformAstCfg f -> (
- match prog with
- | AstCfg p -> AstCfg(f p)
- | _ -> failwith "need explicit translation to AST CFG"
- )
- | TransformSsa f -> (
- match prog with
- | Ssa p -> Ssa(f p)
- | _ -> failwith "need explicit translation to SSA"
- )
- | ToCfg -> (
- match prog with
- | Ast p -> AstCfg(Cfg_ast.of_prog p)
- | Ssa p -> AstCfg(Cfg_ssa.to_astcfg p)
- | AstCfg _ as p -> prerr_endline "Warning: null transformation"; p
- )
- | ToAst -> (
- match prog with
- | AstCfg p -> Ast(Cfg_ast.to_prog p)
- | p -> apply_cmd arch (apply_cmd arch p ToCfg) ToAst
- )
- | ToSsa -> (
- match prog with
- | AstCfg p -> Ssa(Cfg_ssa.of_astcfg ~tac:!tac p)
- | p -> apply_cmd arch (apply_cmd arch p ToCfg) ToSsa
- );;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement