adapted (some parts) to abi changes
[libfirm] / ir / be / beabi.h
1
2 /**
3  * Backend ABI implementation.
4  */
5
6 #ifndef _BEABI_H
7 #define _BEABI_H
8
9 #include "pset.h"
10 #include "firm_types.h"
11
12 #include "be.h"
13 #include "bearch.h"
14 #include "beabi_t.h"
15
16 struct _be_abi_call_flags_bits_t {
17         unsigned left_to_right         : 1;  /**< Arguments are from left to right. */
18         unsigned store_args_sequential : 1;  /**< Use sequential stores for arguments. */
19         unsigned try_omit_fp           : 1;  /**< Try to omit the frame pointer. */
20         unsigned fp_free               : 1;  /**< The function can use any register as frame pointer. */
21         unsigned call_has_imm          : 1;  /**< A call can take the callee's address as an immediate. */
22 };
23
24 union _be_abi_call_flags_t {
25         be_abi_call_flags_bits_t bits;
26         unsigned val;
27 };
28
29 struct _be_abi_callbacks_t {
30         void *(*init)(const be_abi_call_t *call, const arch_isa_t *isa, ir_graph *irg);
31
32         void (*done)(void *self);
33
34         ir_type *(*get_between_type)(void *self);
35
36         void (*regs_saved_by_me)(void *self, pset *regs);
37
38         const arch_register_t *(*prologue)(void *self, pmap *reg_map);
39
40         void (*epilogue)(void *self, ir_node *bl, ir_node **mem, pmap *reg_map);
41 };
42
43 void be_abi_call_set_flags(be_abi_call_t *call, be_abi_call_flags_t flags, const be_abi_callbacks_t *cb);
44 void be_abi_call_param_stack(be_abi_call_t *call, int pos);
45 void be_abi_call_param_reg(be_abi_call_t *call, int pos, const arch_register_t *reg);
46 void be_abi_call_res_reg(be_abi_call_t *call, int pos, const arch_register_t *reg);
47
48 be_abi_call_flags_t be_abi_call_get_flags(const be_abi_call_t *call);
49
50 be_abi_irg_t *be_abi_introduce(be_irg_t *bi);
51 void be_abi_fix_stack_bias(be_abi_irg_t *env);
52 void be_abi_fix_stack_nodes(be_abi_irg_t *env);
53 void be_abi_free(be_abi_irg_t *abi);
54
55 ir_node *be_abi_get_callee_save_irn(be_abi_irg_t *abi, const arch_register_t *reg);
56
57 #endif