ssa: avoid duplicate logic in simplify_instr
[ajla.git] / obj_reg.h
blobcf7dca34b24b6c7c2c85377dd1dd8f005003ee7f
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 #ifndef AJLA_OBJ_REG_H
20 #define AJLA_OBJ_REG_H
22 typedef enum {
23 OBJ_TYPE_MUTEX,
24 OBJ_TYPE_RWMUTEX,
25 OBJ_TYPE_COND,
26 OBJ_TYPE_THREAD,
27 OBJ_TYPE_TLS,
28 OBJ_TYPE_HANDLE,
29 N_OBJ_TYPES
30 } obj_type;
32 typedef uintptr_t obj_id;
34 bool obj_registry_enable_debugging_option(const char *option, size_t l);
36 #if !defined(DEBUG_OBJECT_POSSIBLE)
38 #define obj_registry_start_recursion() do { } while (0)
39 #define obj_registry_end_recursion() do { } while (0)
41 #define obj_registry_insert(type, id, pos) do { } while (0)
42 #define obj_registry_remove(type, id, pos) do { } while (0)
43 #define obj_registry_verify(type, id, pos) do { obj_type avoid_warning = (id); avoid_warning = avoid_warning + 1; } while (0)
45 #define obj_registry_init() do { } while (0)
46 #define obj_registry_init_multithreaded() do { } while (0)
47 #define obj_registry_done_multithreaded() do { } while (0)
48 #define obj_registry_done() do { } while (0)
50 #else
52 void obj_registry_insert(obj_type type, obj_id id, position_t position);
53 void obj_registry_remove(obj_type type, obj_id id, position_t position);
54 void obj_registry_verify(obj_type type, obj_id id, position_t position);
56 bool obj_registry_start_recursion(void);
57 void obj_registry_end_recursion(void);
59 void obj_registry_init(void);
60 void obj_registry_init_multithreaded(void);
61 void obj_registry_done_multithreaded(void);
62 void obj_registry_done(void);
64 #endif
66 #endif