2 * Copyright (C) 2024 Mikulas Patocka
4 * This file is part of Ajla.
6 * Ajla is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, either version 3 of the License, or (at your option) any later
11 * Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * Ajla. If not, see <https://www.gnu.org/licenses/>.
19 private unit compiler.optimize.evaluate;
23 fn evaluate_binary(srctype dsttype : pcode_t, op : pcode_t, arg1 arg2 : list(pcode_t)) : list(pcode_t);
24 fn evaluate_unary(srctype dsttype : pcode_t, op : pcode_t, arg1 : list(pcode_t)) : list(pcode_t);
25 fn load_optimized_pcode(path_idx : pcode_t, unit_name : bytes, program : bool, fn_idx : list(pcode_t)) : list(pcode_t);
29 fn evaluate_binary(srctype dsttype : pcode_t, op : pcode_t, arg1 arg2 : list(pcode_t)) : list(pcode_t)
31 var result : list(pcode_t);
32 pcode IO IO_Evaluate 1 5 0 =result srctype dsttype op arg1 arg2;
36 fn evaluate_unary(srctype dsttype : pcode_t, op : pcode_t, arg1 : list(pcode_t)) : list(pcode_t)
38 var result : list(pcode_t);
39 pcode IO IO_Evaluate 1 4 0 =result srctype dsttype op arg1;
43 fn load_optimized_pcode(path_idx : pcode_t, unit_name : bytes, program : bool, fn_idx : list(pcode_t)) : list(pcode_t)
45 var result : list(pcode_t);
46 pcode IO IO_Load_Optimized_Pcode 1 4 0 =result path_idx unit_name program fn_idx;