ssa: move optimizations from P_BinaryOp to P_BinaryConstOp
[ajla.git] / ajla.h
blob50641011185401f61270318b21877faca7afa0d4
1 /*
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
9 * version.
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 #include "config-m.h"
21 #ifdef HAVE_SYS_TYPES_H
22 #include <sys/types.h>
23 #endif
24 #ifdef HAVE_MEMORY_H
25 #include <memory.h>
26 #endif
27 #include <stdarg.h>
28 #include <stddef.h>
29 #include <float.h>
30 #include <math.h>
31 #ifdef HAVE_QUADMATH_H
32 #include <quadmath.h>
33 #endif
34 #ifdef HAVE_STDLIB_H
35 #include <stdlib.h>
36 #endif
37 #ifdef HAVE_STRING_H
38 #include <string.h>
39 #endif
40 #ifdef HAVE_STRINGS_H
41 #include <strings.h>
42 #endif
43 #include <errno.h>
45 #include "debug.h"
46 #include "cfg.h"
47 #include "compiler.h"
48 #include "fn_impl.h"
49 #include "pcode-op.h"
50 #include "fileline.h"
51 #include "error.h"
52 #include "options.h"
53 #include "common.h"
55 extern extern_const bool dll;
56 extern int retval;
57 #define EXCEPTION_RETVAL 64
60 #if defined(FILE_COMPRESSION) && !defined(POINTER_COMPRESSION_POSSIBLE)
61 #define FILE_OMIT
62 #endif
64 #define u_name(n) cat(u_,n)
65 #define c_name(n) cat(c_,n)
67 #ifdef POINTER_COMPRESSION_POSSIBLE
68 extern uchar_efficient_t pointer_compression_enabled;
69 #define call(n) (pointer_compression_enabled ? c_name(n) : u_name(n))
70 #else
71 #define pointer_compression_enabled false
72 #define call(n) u_name(n)
73 #endif
76 #if !defined(FILE_COMPRESSION)
77 #define shared_var
78 #define shared_init(v) = v
79 #else
80 #define shared_var extern
81 #define shared_init(v)
82 #endif
85 #define switch_call(fn) \
86 void u_name(fn)(void); \
87 void c_name(fn)(void); \
88 static inline void fn(void) { call(fn)(); }
90 switch_call(codegen_init)
91 switch_call(codegen_done)
92 switch_call(data_init)
93 switch_call(data_done)
94 switch_call(array_index_init)
95 switch_call(array_index_done)
96 switch_call(function_init)
97 switch_call(function_done)
98 switch_call(pcode_init)
99 switch_call(pcode_done)
100 switch_call(save_init)
101 switch_call(save_done)
102 switch_call(module_init)
103 switch_call(module_done)
104 switch_call(ipio_init)
105 switch_call(ipio_done)
106 switch_call(ipret_init)
107 switch_call(ipret_done)
108 switch_call(task_init)
109 switch_call(task_done)
110 switch_call(task_run)
111 switch_call(program_run)
112 switch_call(bist)