• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef LIBABCKIT_IR_H
17 #define LIBABCKIT_IR_H
18 
19 #ifndef __cplusplus
20 #include <stdbool.h>
21 #include <stddef.h>
22 #include <stdint.h>
23 #else
24 #include <cstddef>
25 #include <cstdint>
26 #endif
27 
28 #include "./declarations.h"
29 #include "./api_version.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 enum AbckitIsaType {
36     /*
37      * For invalid input.
38      */
39     ABCKIT_ISA_TYPE_UNSUPPORTED,
40     /*
41      * For .abc files that use mainline ISA.
42      */
43     ABCKIT_ISA_TYPE_DYNAMIC,
44     /*
45      * Reserved for future versions.
46      */
47     ABCKIT_ISA_TYPE_STATIC,
48 };
49 
50 enum { ABCKIT_TRUE_SUCC_IDX = 0, ABCKIT_FALSE_SUCC_IDX = 1 };
51 
52 enum AbckitBitImmSize {
53     /*
54      * For invalid input.
55      */
56     BITSIZE_0 = 0,
57     BITSIZE_4 = 4,
58     BITSIZE_8 = 8,
59     BITSIZE_16 = 16,
60     BITSIZE_32 = 32,
61     /*
62      * For immediate overflow check.
63      */
64     BITSIZE_64 = 64
65 };
66 
67 /**
68  * @brief Struct that holds the pointers to the graph manipulation API.
69  */
70 struct AbckitGraphApi {
71     /**
72      * @brief Returns ISA type for given graph.
73      * @return ISA of the graph.
74      * @param [ in ] graph - Graph to read ISA type from.
75      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
76      */
77     enum AbckitIsaType (*gGetIsa)(AbckitGraph *graph);
78 
79     /**
80      * @brief Returns binary file from which the given `graph` was created.
81      * @return Pointer to the `AbckitFile` from which given `graph` was created.
82      * @param [ in ] graph - Graph to be inspected.
83      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
84      */
85     AbckitFile *(*gGetFile)(AbckitGraph *graph);
86 
87     /* ========================================
88      * Api for Graph manipulation
89      * ======================================== */
90 
91     /**
92      * @brief Returns start basic block of given `graph`.
93      * @return Pointer to start `AbckitBasicBlock`.
94      * @param [ in ] graph - Graph to be inspected.
95      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
96      */
97     AbckitBasicBlock *(*gGetStartBasicBlock)(AbckitGraph *graph);
98 
99     /**
100      * @brief Returns end basic block of given `graph`.
101      * @return Pointer to end `AbckitBasicBlock`.
102      * @param [ in ] graph - Graph to be inspected.
103      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
104      */
105     AbckitBasicBlock *(*gGetEndBasicBlock)(AbckitGraph *graph);
106 
107     /**
108      * @brief Returns number of basic blocks in given `graph`.
109      * @return Number of basic blocks in given `graph`.
110      * @param [ in ] graph - Graph to be inspected.
111      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
112      */
113     uint32_t (*gGetNumberOfBasicBlocks)(AbckitGraph *graph);
114 
115     /**
116      * @brief Enumerates basic blocks of the `graph` in reverse postorder, invoking callback `cb` for each basic block.
117      * @return `false` if was early exited. Otherwise - `true`.
118      * @param [ in ] graph - Graph to be inspected.
119      * @param [ in, out ] data - Pointer to the user-defined data that will be passed to the callback `cb` each time
120      * it is invoked.
121      * @param [ in ] cb - Callback that will be invoked. Should return `false` on early exit and `true` when iterations
122      * should continue.
123      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
124      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `cb` is NULL.
125      */
126     bool (*gVisitBlocksRpo)(AbckitGraph *graph, void *data, bool (*cb)(AbckitBasicBlock *basicBlock, void *data));
127 
128     /**
129      * @brief Returns basic blocks with given `id` of the given `graph`.
130      * @return Pointer to the `AbckitBasicBlock` with given `id`.
131      * @param [ in ] graph - Graph to be inspected.
132      * @param [ in ] id - ID of basic block.
133      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
134      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if there is no basic block with given `id` in `graph`.
135      */
136     AbckitBasicBlock *(*gGetBasicBlock)(AbckitGraph *graph, uint32_t id);
137 
138     /**
139      * @brief Returns parameter instruction under given `index` of the given `graph`.
140      * @return Pointer to the `AbckitInst` corresponding to parameter under given `index`.
141      * @param [ in ] graph - Graph to be inspected.
142      * @param [ in ] index - Index of the parameter.
143      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
144      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if there is no parameter under given `index` in `graph`.
145      */
146     AbckitInst *(*gGetParameter)(AbckitGraph *graph, uint32_t index);
147 
148     /**
149      * @brief Returns number of instruction parameters under given `graph`.
150      * @return uint32_t corresponding to number of instruction parameters.
151      * @param [ in ] graph - Graph to be inspected.
152      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
153      */
154     uint32_t (*gGetNumberOfParameters)(AbckitGraph *graph);
155 
156     /**
157      * @brief Wraps basic blocks from `tryFirstBB` to `tryLastBB` into try,
158      * inserts basic blocks from `catchBeginBB` to `catchEndBB` into graph.
159      * Basic blocks from `catchBeginBB` to `catchEndBB` are used for exception handling.
160      * @return None.
161      * @param [ in ] tryFirstBB - Start basic block to wrap into try.
162      * @param [ in ] tryLastBB - End basic block to wrap into try.
163      * @param [ in ] catchBeginBB - Start basic block to handle exception.
164      * @param [ in ] catchEndBB - End basic block to handle exception.
165      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `tryFirstBB` is NULL.
166      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `tryLastBB` is NULL.
167      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `catchBeginBB` is NULL.
168      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `catchEndBB` is NULL.
169      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitGraph`s owning input basic blocks differs.
170      */
171     void (*gInsertTryCatch)(AbckitBasicBlock *tryFirstBB, AbckitBasicBlock *tryLastBB, AbckitBasicBlock *catchBeginBB,
172                             AbckitBasicBlock *catchEndBB);
173 
174     /**
175      * @brief Dumps given `graph` into given file descriptor.
176      * @return None.
177      * @param [ in ] graph - Graph to be inspected.
178      * @param [ in ] fd - File descriptor where dump is written.
179      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
180      * @note Allocates
181      */
182     void (*gDump)(AbckitGraph *graph, int32_t fd);
183 
184     /**
185      * @brief Creates I32 constant instruction and inserts it in start basic block of given `graph`.
186      * @return Pointer to created `AbckitInst`.
187      * @param [ in ] graph - Graph in which instruction is inserted.
188      * @param [ in ] value - value of created constant instruction.
189      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
190      * @note Allocates
191      */
192     AbckitInst *(*gFindOrCreateConstantI32)(AbckitGraph *graph, int32_t value);
193 
194     /**
195      * @brief Creates I64 constant instruction and inserts it in start basic block of given `graph`.
196      * @return Pointer to created `AbckitInst`.
197      * @param [ in ] graph - Graph in which instruction is inserted.
198      * @param [ in ] value - value of created constant instruction.
199      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
200      * @note Allocates
201      */
202     AbckitInst *(*gFindOrCreateConstantI64)(AbckitGraph *graph, int64_t value);
203 
204     /**
205      * @brief Creates U64 constant instruction and inserts it in start basic block of given `graph`.
206      * @return Pointer to created `AbckitInst`.
207      * @param [ in ] graph - Graph in which instruction is inserted.
208      * @param [ in ] value - value of created constant instruction.
209      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
210      * @note Allocates
211      */
212     AbckitInst *(*gFindOrCreateConstantU64)(AbckitGraph *graph, uint64_t value);
213 
214     /**
215      * @brief Creates F64 constant instruction and inserts it in start basic block of given `graph`.
216      * @return Pointer to created `AbckitInst`.
217      * @param [ in ] graph - Graph in which instruction is inserted.
218      * @param [ in ] value - value of created constant instruction.
219      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
220      * @note Allocates
221      */
222     AbckitInst *(*gFindOrCreateConstantF64)(AbckitGraph *graph, double value);
223 
224     /**
225      * @brief Removes all basic blocks unreachable from start basic block.
226      * @return None.
227      * @param [ in ] graph - Graph to be modified.
228      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
229      */
230     void (*gRunPassRemoveUnreachableBlocks)(AbckitGraph *graph);
231 
232     /* ========================================
233      * Api for basic block manipulation
234      * ======================================== */
235 
236     /**
237      * @brief Creates empty basic block.
238      * @return Pointer to the created `AbckitBasicBlock`.
239      * @param [ in ] graph - Graph for which basic block is created.
240      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `graph` is NULL.
241      * @note Allocates
242      */
243     AbckitBasicBlock *(*bbCreateEmpty)(AbckitGraph *graph);
244 
245     /**
246      * @brief Returns ID of given `basicBlock`.
247      * @return ID of given `basicBlock`.
248      * @param [ in ] basicBlock - basic block to be inspected.
249      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
250      */
251     uint32_t (*bbGetId)(AbckitBasicBlock *basicBlock);
252 
253     /**
254      * @brief Returns graph owning given `basicBlock`.
255      * @return Pointer to `AbckitGraph`.
256      * @param [ in ] basicBlock - basic block to be inspected.
257      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
258      */
259     AbckitGraph *(*bbGetGraph)(AbckitBasicBlock *basicBlock);
260 
261     /**
262      * @brief Returns the number of basic blocks preceding the given `basicBlock`.
263      * @return Number of predecessor basic blocks.
264      * @param [ in ] basicBlock - basic block to be inspected.
265      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
266      */
267     uint64_t (*bbGetPredBlockCount)(AbckitBasicBlock *basicBlock);
268 
269     /**
270      * @brief Returns basic block predcessing to `basicBlock` under given `index`.
271      * @return Pointer to the `AbckitBasicBlock`.
272      * @param [ in ] basicBlock - basic block to be inspected.
273      * @param [ in ] index - Index of predecessor basic block.
274      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
275      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if there is no predecessor basic block under given `index`.
276      */
277     AbckitBasicBlock *(*bbGetPredBlock)(AbckitBasicBlock *basicBlock, uint32_t index);
278 
279     /**
280      * @brief Enumerates basic blocks preceding to the given `basicBlock`, invoking callback `cb` for each basic
281      * block.
282      * @return `false` if was early exited. Otherwise - `true`.
283      * @param [ in ] basicBlock - Basic block to be inspected.
284      * @param [ in, out ] data - Pointer to the user-defined data that will be passed to the callback `cb` each time
285      * it is invoked.
286      * @param [ in ] cb - Callback that will be invoked. Should return `false` on early exit and `true` when iterations
287      * should continue.
288      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
289      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `cb` is NULL.
290      */
291     bool (*bbVisitPredBlocks)(AbckitBasicBlock *basicBlock, void *data,
292                               bool (*cb)(AbckitBasicBlock *predBasicBlock, void *data));
293 
294     /**
295      * @brief Returns the number of basic blocks successing the given `basicBlock`.
296      * @return Number of successor basic blocks.
297      * @param [ in ] basicBlock - basic block to be inspected.
298      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
299      */
300     uint64_t (*bbGetSuccBlockCount)(AbckitBasicBlock *basicBlock);
301 
302     /**
303      * @brief Returns basic block successing to `basicBlock` under given `index`.
304      * @return Pointer to the `AbckitBasicBlock`.
305      * @param [ in ] basicBlock - basic block to be inspected.
306      * @param [ in ] index - Index of successor basic block.
307      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
308      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if there is no successor basic block under given `index`.
309      */
310     AbckitBasicBlock *(*bbGetSuccBlock)(AbckitBasicBlock *basicBlock, uint32_t index);
311 
312     /**
313      * @brief Inserts `succBlock` by `index` in `basicBlock` successors list
314      * and shifts the rest if there were successors with a larger index.
315      * @return None.
316      * @param [ in ] basicBlock - Basic block for which successor will be inserted.
317      * @param [ in ] succBlock - Basic block to be inserted.
318      * @param [ in ] index - Index by which the `succBlock` will be inserted.
319      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
320      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `succBlock` is NULL.
321      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `index` is larger than quantity of `basicBlock` successors.
322      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitGraphs`s owning `basicBlock` and `succBlock`
323      * differs.
324      * @note Allocates
325      */
326     void (*bbInsertSuccBlock)(AbckitBasicBlock *basicBlock, AbckitBasicBlock *succBlock, uint32_t index);
327 
328     /**
329      * @brief Appends successor to the end of `basicBlock` successors list.
330      * @return None.
331      * @param [ in ] basicBlock - Basic block for which successor will be inserted.
332      * @param [ in ] succBlock - Basic block to be inserted.
333      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
334      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `succBlock` is NULL.
335      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitGraphs`s owning `basicBlock` and `succBlock`
336      * differs.
337      */
338     void (*bbAppendSuccBlock)(AbckitBasicBlock *basicBlock, AbckitBasicBlock *succBlock);
339 
340     /**
341      * @brief Deletes the successor and shifts the rest if there were successors with a larger index.
342      * @return None.
343      * @param [ in ] basicBlock - Basic block for which successor will be deleted.
344      * @param [ in ] index - Index of successor to be deleted.
345      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
346      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `index` is larger than `basicBlock` successors quantity.
347      */
348     void (*bbDisconnectSuccBlock)(AbckitBasicBlock *basicBlock, uint32_t index);
349 
350     /**
351      * @brief Enumerates basic blocks successing to the given `basicBlock`, invoking callback `cb` for each basic block.
352      * @return `false` if was early exited. Otherwise - `true`.
353      * @param [ in ] basicBlock - Basic block to be inspected.
354      * @param [ in, out ] data - Pointer to the user-defined data that will be passed to the callback `cb` each time
355      * it is invoked.
356      * @param [ in ] cb - Callback that will be invoked. Should return `false` on early exit and `true` when iterations
357      * should continue.
358      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
359      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `cb` is NULL.
360      */
361     bool (*bbVisitSuccBlocks)(AbckitBasicBlock *basicBlock, void *data,
362                               bool (*cb)(AbckitBasicBlock *succBasicBlock, void *data));
363 
364     /**
365      * @brief Returns successor of `basicBlock` with index 0.
366      * @return Pinter to the `AbckitBasicBlock`.
367      * @param [ in ] basicBlock - Basic block to be inspected.
368      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
369      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` has no successors.
370      */
371     AbckitBasicBlock *(*bbGetTrueBranch)(AbckitBasicBlock *basicBlock);
372 
373     /**
374      * @brief Returns successor of `basicBlock` with index 1.
375      * @return Pinter to the `AbckitBasicBlock`.
376      * @param [ in ] basicBlock - Basic block to be inspected.
377      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
378      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` has less than one successor.
379      */
380     AbckitBasicBlock *(*bbGetFalseBranch)(AbckitBasicBlock *basicBlock);
381 
382     /**
383      * @brief Creates new basic block and moves all instructions after `inst` into new basic block.
384      * @return Pointer to newly create `AbckitBasicBlock`.
385      * @param [ in ] basicBlock - Block for which instruction is splitted.
386      * @param [ in ] inst - Instruction after which all instructions will be moved into new basic block.
387      * @param [ in ] makeEdge - If `true` connects old and new basic blocks.
388      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
389      * @note Allocates
390      */
391     AbckitBasicBlock *(*bbSplitBlockAfterInstruction)(AbckitBasicBlock *basicBlock, AbckitInst *inst, bool makeEdge);
392 
393     /**
394      * @brief Insert `inst` at the beginning of `basicBlock`.
395      * @return None.
396      * @param [ in ] basicBlock - Block for which instruction is appended.
397      * @param [ in ] inst - Instruction to insert.
398      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
399      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
400      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is constant.
401      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitGraphs`s owning `basicBlock` and `inst`
402      * differs.
403      * @note Allocates
404      */
405     void (*bbAddInstFront)(AbckitBasicBlock *basicBlock, AbckitInst *inst);
406 
407     /**
408      * @brief Appends `inst` at the end of `basicBlock`.
409      * @return None.
410      * @param [ in ] basicBlock - Block for which instruction is appended.
411      * @param [ in ] inst - Instruction to insert.
412      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
413      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
414      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is constant.
415      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitGraphs`s owning `basicBlock` and `inst`
416      * differs.
417      * @note Allocates
418      */
419     void (*bbAddInstBack)(AbckitBasicBlock *basicBlock, AbckitInst *inst);
420 
421     /**
422      * @brief Removes all instructions from `basicBlock`.
423      * @return None.
424      * @param [ in ] basicBlock - basic block to clear.
425      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
426      */
427     void (*bbRemoveAllInsts)(AbckitBasicBlock *basicBlock);
428 
429     /**
430      * @brief Returns first instruction from `basicBlock`.
431      * @return Pointer to the `AbckitInst`.
432      * @param [ in ] basicBlock - Basic block to be inspected.
433      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
434      */
435     AbckitInst *(*bbGetFirstInst)(AbckitBasicBlock *basicBlock);
436 
437     /**
438      * @brief Returns last instruction from `basicBlock`.
439      * @return Pointer to the `AbckitInst`.
440      * @param [ in ] basicBlock - Basic block to be inspected.
441      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
442      */
443     AbckitInst *(*bbGetLastInst)(AbckitBasicBlock *basicBlock);
444 
445     /**
446      * @brief Returns number of instruction in `basicBlock`.
447      * @return Number of instruction in `basicBlock`.
448      * @param [ in ] basicBlock - Basic block to be inspected.
449      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
450      */
451     uint32_t (*bbGetNumberOfInstructions)(AbckitBasicBlock *basicBlock);
452 
453     /**
454      * @brief Returns immediate dominator of `basicBlock`.
455      * @return Pinter to the `AbckitBasicBlock`.
456      * @param [ in ] basicBlock - Basic block to be inspected.
457      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
458      */
459     AbckitBasicBlock *(*bbGetImmediateDominator)(AbckitBasicBlock *basicBlock);
460 
461     /**
462      * @brief Checks that `basicBlock` is dominated by `dominator`
463      * @return True if `basicBlock` is dominated by `dominator`.
464      * @param [ in ] basicBlock - Basic block to be inspected.
465      * @param [ in ] dominator - Basic block to be inspected.
466      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
467      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `dominator` is NULL.
468      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitGraphs`s owning `basicBlock` and `dominator`
469      * differs.
470      */
471     bool (*bbCheckDominance)(AbckitBasicBlock *basicBlock, AbckitBasicBlock *dominator);
472 
473     /**
474      * @brief Enumerates basic blocks dominating to the given `basicBlock`, invoking callback `cb` for each basic block.
475      * @return `false` if was early exited. Otherwise - `true`.
476      * @param [ in ] basicBlock - Basic block to be inspected.
477      * @param [ in, out ] data - Pointer to the user-defined data that will be passed to the callback `cb` each time
478      * it is invoked.
479      * @param [ in ] cb - Callback that will be invoked. Should return `false` on early exit and `true` when iterations
480      * should continue.
481      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
482      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `cb` is NULL.
483      */
484     bool (*bbVisitDominatedBlocks)(AbckitBasicBlock *basicBlock, void *data,
485                                    bool (*cb)(AbckitBasicBlock *dominatedBasicBlock, void *data));
486 
487     /**
488      * @brief Tells if `basicBlock` is start basic block.
489      * @return `true` if `basicBlock` is start basic block, `false` otherwise.
490      * @param [ in ] basicBlock - Basic block to be inspected.
491      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
492      */
493     bool (*bbIsStart)(AbckitBasicBlock *basicBlock);
494 
495     /**
496      * @brief Tells if `basicBlock` is end basic block.
497      * @return `true` if `basicBlock` is end basic block, `false` otherwise.
498      * @param [ in ] basicBlock - Basic block to be inspected.
499      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
500      */
501     bool (*bbIsEnd)(AbckitBasicBlock *basicBlock);
502 
503     /**
504      * @brief Tells if `basicBlock` is loop head basic block.
505      * @return `true` if `basicBlock` is loop head basic block, `false` otherwise.
506      * @param [ in ] basicBlock - Basic block to be inspected.
507      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
508      */
509     bool (*bbIsLoopHead)(AbckitBasicBlock *basicBlock);
510 
511     /**
512      * @brief Tells if `basicBlock` is loop prehead basic block.
513      * @return `true` if `basicBlock` is loop prehead basic block, `false` otherwise.
514      * @param [ in ] basicBlock - Basic block to be inspected.
515      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
516      */
517     bool (*bbIsLoopPrehead)(AbckitBasicBlock *basicBlock);
518 
519     /**
520      * @brief Tells if `basicBlock` is try begin basic block.
521      * @return `true` if `basicBlock` is try begin basic block, `false` otherwise.
522      * @param [ in ] basicBlock - Basic block to be inspected.
523      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
524      */
525     bool (*bbIsTryBegin)(AbckitBasicBlock *basicBlock);
526 
527     /**
528      * @brief Tells if `basicBlock` is try basic block.
529      * @return `true` if `basicBlock` is try basic block, `false` otherwise.
530      * @param [ in ] basicBlock - Basic block to be inspected.
531      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
532      */
533     bool (*bbIsTry)(AbckitBasicBlock *basicBlock);
534 
535     /**
536      * @brief Tells if `basicBlock` is try end basic block.
537      * @return `true` if `basicBlock` is try end basic block, `false` otherwise.
538      * @param [ in ] basicBlock - Basic block to be inspected.
539      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
540      */
541     bool (*bbIsTryEnd)(AbckitBasicBlock *basicBlock);
542 
543     /**
544      * @brief Tells if `basicBlock` is catch begin basic block.
545      * @return `true` if `basicBlock` is catch begin basic block, `false` otherwise.
546      * @param [ in ] basicBlock - Basic block to be inspected.
547      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
548      */
549     bool (*bbIsCatchBegin)(AbckitBasicBlock *basicBlock);
550 
551     /**
552      * @brief Tells if `basicBlock` is catch basic block.
553      * @return `true` if `basicBlock` is catch basic block, `false` otherwise.
554      * @param [ in ] basicBlock - Basic block to be inspected.
555      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
556      */
557     bool (*bbIsCatch)(AbckitBasicBlock *basicBlock);
558 
559     /**
560      * @brief Dumps given `basicBlock` into given file descriptor.
561      * @return None.
562      * @param [ in ] basicBlock -  Basic block to be inspected.
563      * @param [ in ] fd - File descriptor where dump is written.
564      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
565      * @note Allocates
566      */
567     void (*bbDump)(AbckitBasicBlock *basicBlock, int32_t fd);
568 
569     /**
570      * @brief Creates phi instruction and inserts it into `basicBlock`.
571      * @return Pointer to created phi instruction.
572      * @param [ in ] basicBlock - Basic block where phi instruction will be inserted.
573      * @param [ in ] argCount - Number of phi inputs.
574      * @param [ in ] ... - Phi inputs, must be pointers to `AbckitInst`.
575      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `basicBlock` is NULL.
576      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `argCount` is zero.
577      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if types of phi inputs are inconsistent.
578      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if one of inputs is NULL.
579      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitGraph`s owning `basicBlock` and phi input
580      * instruction differs.
581      * @note Allocates
582      */
583     AbckitInst *(*bbCreatePhi)(AbckitBasicBlock *basicBlock, size_t argCount, ...);
584 
585     /**
586      * @brief Creates CatchPhi instruction and sets it at the beginning of basic block `catchBegin`.
587      * @return Pointer to created `AbckitInst`.
588      * @param [ in ] catchBegin - Basic block at the beginning of which the instruction will be inserted.
589      * @param [ in ] argCount - Number of instruction's inputs
590      * @param [ in ] ... - Instructions that are inputs of the new instruction.
591      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `catchBegin` is NULL.
592      * @note Set `ABCKIT_STATUS_WRONG_MODE` error if `graph` is not DYNAMIC.
593      */
594     AbckitInst *(*bbCreateCatchPhi)(AbckitBasicBlock *catchBegin, size_t argCount, ...);
595 
596     /**
597      * @brief Removes instruction from it's basic block.
598      * @return None.
599      * @param [ in ] inst - Instruction to be removed.
600      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
601      */
602     void (*iRemove)(AbckitInst *inst);
603 
604     /**
605      * @brief Returns ID of instruction.
606      * @return ID of instruction.
607      * @param [ in ] inst - Instruction to be inspected.
608      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
609      */
610     uint32_t (*iGetId)(AbckitInst *inst);
611 
612     /**
613      * @brief Returns instruction following `inst` from `inst`'s basic block.
614      * @return Pointer to next `AbckitInst`.
615      * @param [ in ] inst - Instruction to be inspected.
616      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
617      */
618     AbckitInst *(*iGetNext)(AbckitInst *inst);
619 
620     /**
621      * @brief Returns instruction preceding `inst` from `inst`'s basic block.
622      * @return Pointer to previous `AbckitInst`.
623      * @param [ in ] inst - Instruction to be inspected.
624      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
625      */
626     AbckitInst *(*iGetPrev)(AbckitInst *inst);
627 
628     /**
629      * @brief Inserts `newInst` instruction after `ref` instruction into `ref`'s basic block.
630      * @return None.
631      * @param [ in ] newInst - Instruction to be inserted.
632      * @param [ in ] ref - Instruction after which `newInst` will be inserted.
633      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `newInst` is NULL.
634      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `ref` is NULL.
635      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `newInst` is constant instruction.
636      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `ref` is constant instruction.
637      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitGraph`s owning `newInst` and `ref` differs.
638      * @note Allocates
639      */
640     void (*iInsertAfter)(AbckitInst *newInst, AbckitInst *ref);
641 
642     /**
643      * @brief Inserts `newInst` instruction before `ref` instruction into `ref`'s basic block.
644      * @return None.
645      * @param [ in ] newInst - Instruction to be inserted.
646      * @param [ in ] ref - Instruction before which `newInst` will be inserted.
647      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `newInst` is NULL.
648      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `ref` is NULL.
649      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `newInst` is constant instruction.
650      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `ref` is constant instruction.
651      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitGraph`s owning `newInst` and `ref` differs.
652      * @note Allocates
653      */
654     void (*iInsertBefore)(AbckitInst *newInst, AbckitInst *ref);
655 
656     /**
657      * @brief Returns the type of the `inst` result.
658      * @return Pointer to the `AbckitType`.
659      * @param [ in ] inst - Instruction to be inspected.
660      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
661      * @note Allocates
662      */
663     AbckitType *(*iGetType)(AbckitInst *inst);
664 
665     /**
666      * @brief Returns basic block that owns `inst`.
667      * @return Pointer to the `AbckitBasicBlock`.
668      * @param [ in ] inst - Instruction to be inspected.
669      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
670      */
671     AbckitBasicBlock *(*iGetBasicBlock)(AbckitInst *inst);
672 
673     /**
674      * @brief Returns graph that owns `inst`.
675      * @return Pointer to the `AbckitGraph`.
676      * @param [ in ] inst - Instruction to be inspected.
677      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
678      */
679     AbckitGraph *(*iGetGraph)(AbckitInst *inst);
680 
681     /**
682      * @brief Checks that `inst` is dominated by `dominator`.
683      * @return `true` if `inst` is dominated by `dominator`, `false` otherwise.
684      * @param [ in ] inst - Instruction to be inspected.
685      * @param [ in ] dominator - Instruction to be inspected.
686      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
687      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `dominator` is NULL.
688      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitGraph`s owning `inst` and `dominator` differs.
689      */
690     bool (*iCheckDominance)(AbckitInst *inst, AbckitInst *dominator);
691 
692     /**
693      * @brief Checks if `inst` is "call" instruction.
694      * @return `true` if `inst` is "call" instruction, `false` otherwise.
695      * @param [ in ] inst - Instruction to be inspected.
696      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
697      */
698     bool (*iCheckIsCall)(AbckitInst *inst);
699 
700     /**
701      * @brief Returns number of `inst` users.
702      * @return Number of `inst` users.
703      * @param [ in ] inst - Instruction to be inspected.
704      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
705      */
706     uint32_t (*iGetUserCount)(AbckitInst *inst);
707 
708     /**
709      * @brief Enumerates `insts` user instructions, invoking callback `cb` for each user instruction.
710      * @return `false` if was early exited. Otherwise - `true`.
711      * @param [ in ] inst - Instruction to be inspected.
712      * @param [ in, out ] data - Pointer to the user-defined data that will be passed to the callback `cb` each time
713      * it is invoked.
714      * @param [ in ] cb - Callback that will be invoked. Should return `false` on early exit and `true` when iterations
715      * should continue.
716      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
717      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `cb` is NULL.
718      */
719     bool (*iVisitUsers)(AbckitInst *inst, void *data, bool (*cb)(AbckitInst *user, void *data));
720 
721     /**
722      * @brief Returns number of `inst` inputs.
723      * @return Number of `inst` inputs.
724      * @param [ in ] inst - Instruction to be inspected.
725      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
726      */
727     uint32_t (*iGetInputCount)(AbckitInst *inst);
728 
729     /**
730      * @brief Returns `inst` input under given `index`.
731      * @return Pointer to the input `AbckitInst`.
732      * @param [ in ] inst - Instruction to be inspected.
733      * @param [ in ] index - Index of input to be returned.
734      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
735      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `index` is larger than number of `inst` inputs.
736      */
737     AbckitInst *(*iGetInput)(AbckitInst *inst, uint32_t index);
738 
739     /**
740      * @brief Enumerates `insts` input instructions, invoking callback `cb` for each input instruction.
741      * @return `false` if was early exited. Otherwise - `true`.
742      * @param [ in ] inst - Instruction to be inspected.
743      * @param [ in, out ] data - Pointer to the user-defined data that will be passed to the callback `cb` each time
744      * it is invoked.
745      * @param [ in ] cb - Callback that will be invoked. Should return `false` on early exit and `true` when iterations
746      * should continue.
747      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
748      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `cb` is NULL.
749      */
750     bool (*iVisitInputs)(AbckitInst *inst, void *data, bool (*cb)(AbckitInst *input, size_t inputIdx, void *data));
751 
752     /**
753      * @brief Sets `inst` input, overwrites existing input.
754      * @return None.
755      * @param [ in ] inst - Instruction to be modified.
756      * @param [ in ] input - Input instruction to be set.
757      * @param [ in ] index - Index of input to be set.
758      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
759      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `input` is NULL.
760      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitGraph`s owning `inst` and `input` differs.
761      */
762     void (*iSetInput)(AbckitInst *inst, AbckitInst *input, uint32_t index);
763 
764     /**
765      * @brief Sets input instructions for `inst` starting from index 0, overwrites existing inputs.
766      * @return None.
767      * @param [ in ] inst - Instruction to be modified.
768      * @param [ in ] argCount - Number of input instructions.
769      * @param [ in ] ... - Instructions to be set as input for `inst`.
770      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
771      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if one of inst inputs are NULL.
772      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitGraph`s owning `inst` and input inst differs.
773      */
774     void (*iSetInputs)(AbckitInst *inst, size_t argCount, ...);
775 
776     /**
777      * @brief Appends `input` instruction to `inst` inputs.
778      * @return None.
779      * @param [ in ] inst - Instruction to be modified.
780      * @param [ in ] input - Instruction to be appended as input.
781      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
782      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `input` is NULL.
783      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is not applicable for input appending.
784      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitGraph`s owning `inst` and `input` differs.
785      * @note Allocates
786      */
787     void (*iAppendInput)(AbckitInst *inst, AbckitInst *input);
788 
789     /**
790      * @brief Dumps given `inst` into given file descriptor.
791      * @return None.
792      * @param [ in ] inst - Instruction to be inspected.
793      * @param [ in ] fd - File descriptor where dump is written.
794      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
795      * @note Allocates
796      */
797     void (*iDump)(AbckitInst *inst, int32_t fd);
798 
799     /**
800      * @brief Returns `inst` function operand.
801      * @return Pointer to the `AbckitCoreFunction`.
802      * @param [ in ] inst - Instruction to be inspected.
803      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
804      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` has no function operand.
805      */
806     AbckitCoreFunction *(*iGetFunction)(AbckitInst *inst);
807 
808     /**
809      * @brief Sets `inst` function operand.
810      * @return None.
811      * @param [ in ] inst - Instruction to be modified.
812      * @param [ in ] function - Function to be set as `inst` operand.
813      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
814      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `function` is NULL.
815      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` has no function operand.
816      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitFile`s owning `inst` and `function` differs.
817      */
818     void (*iSetFunction)(AbckitInst *inst, AbckitCoreFunction *function);
819 
820     /**
821      * @brief Returns `inst` immediate under given `index`.
822      * @return uint64_t .
823      * @param [ in ] inst - Instruction to be inspected.
824      * @param [ in ] index - Index of immediate.
825      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
826      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` has no immediates.
827      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `index` larger than `inst` immediates number.
828      */
829     uint64_t (*iGetImmediate)(AbckitInst *inst, size_t index);
830 
831     /**
832      * @brief Sets `inst` immediate under given `index` with value `imm`.
833      * @return None.
834      * @param [ in ] inst - Instruction to be modified.
835      * @param [ in ] index - Index of immediate to be set.
836      * @param [ in ] imm - Value of immediate to be set.
837      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
838      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` has no immediates.
839      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `index` larger than `inst` immediates number.
840      */
841     void (*iSetImmediate)(AbckitInst *inst, size_t index, uint64_t imm);
842 
843     /**
844      * @brief Returns size in bits of `inst` immediate under given `index`.
845      * @return Size of `inst` immediate under given `index` in bits.
846      * @param [ in ] inst - Instruction to be inspected.
847      * @param [ in ] index - Index of immediate to get size.
848      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
849      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` has no immediates.
850      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `index` larger than `inst` immediates number.
851      */
852     enum AbckitBitImmSize (*iGetImmediateSize)(AbckitInst *inst, size_t index);
853 
854     /**
855      * @brief Returns number of `inst` immediates.
856      * @return Number of `inst` immediates.
857      * @param [ in ] inst - Instruction to be inspected.
858      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
859      */
860     uint64_t (*iGetImmediateCount)(AbckitInst *inst);
861 
862     /**
863      * @brief Returns `inst` literal array operand.
864      * @return Pointer to the `AbckitLiteralArray`.
865      * @param [ in ] inst - Instruction to be inspected.
866      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
867      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` has no literal array operand.
868      */
869     AbckitLiteralArray *(*iGetLiteralArray)(AbckitInst *inst);
870 
871     /**
872      * @brief Sets `inst` literal array operand.
873      * @return None.
874      * @param [ in ] inst - Instruction to be modified.
875      * @param [ in ] la - Literal array to be set as operand.
876      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
877      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `la` is NULL.
878      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` has no literal array operand.
879      * @note Set `ABCKIT_STATUS_WRONG_CTX` error if corresponding `AbckitFile`s owning `inst` and `la` differs.
880      */
881     void (*iSetLiteralArray)(AbckitInst *inst, AbckitLiteralArray *la);
882 
883     /**
884      * @brief Returns `inst` string operand.
885      * @return Pointer to the `AbckitString`.
886      * @param [ in ] inst - Instruction to be inspected.
887      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
888      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` has no string operand.
889      */
890     AbckitString *(*iGetString)(AbckitInst *inst);
891 
892     /**
893      * @brief Sets `inst` string operand.
894      * @return None.
895      * @param [ in ] inst - Instruction to be inspected.
896      * @param [ in ] s - String to be set as operand.
897      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
898      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `s` is NULL.
899      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` has no string operand.
900      */
901     void (*iSetString)(AbckitInst *inst, AbckitString *s);
902 
903     /**
904      * @brief Returns value of I32 constant `inst`.
905      * @return Value of `inst`.
906      * @param [ in ] inst - Instruction to be inspected.
907      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
908      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is not a constant instruction.
909      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is not I32 constant instruction.
910      */
911     int32_t (*iGetConstantValueI32)(AbckitInst *inst);
912 
913     /**
914      * @brief Returns value of I64 constant `inst`.
915      * @return Value of `inst`.
916      * @param [ in ] inst - Instruction to be inspected.
917      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
918      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is not a constant instruction.
919      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is not I64 constant instruction.
920      */
921     int64_t (*iGetConstantValueI64)(AbckitInst *inst);
922 
923     /**
924      * @brief Returns value of U64 constant `inst`.
925      * @return Value of `inst`.
926      * @param [ in ] inst - Instruction to be inspected.
927      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
928      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is not a constant instruction.
929      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is not U64 constant instruction.
930      */
931     uint64_t (*iGetConstantValueU64)(AbckitInst *inst);
932 
933     /**
934      * @brief Returns value of F64 constant `inst`.
935      * @return Value of `inst`.
936      * @param [ in ] inst - Instruction to be inspected.
937      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is NULL.
938      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is not a constant instruction.
939      * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `inst` is not F64 constant instruction.
940      */
941     double (*iGetConstantValueF64)(AbckitInst *inst);
942 };
943 
944 /**
945  * @brief Instantiates API for Abckit graph manipulation.
946  * @return Instance of the `AbckitGraphApi` struct with valid function pointers.
947  * @param [ in ] version - Version of the API to instantiate.
948  * @note Set `ABCKIT_STATUS_UNKNOWN_API_VERSION` error if `version` value is not in the `AbckitApiVersion` enum.
949  */
950 struct AbckitGraphApi const *AbckitGetGraphApiImpl(enum AbckitApiVersion version);
951 
952 #ifdef __cplusplus
953 }
954 #endif
955 
956 #endif /* LIBABCKIT_IR_H */
957