becopyheur4: Clean up co_mst_irn_init().
[libfirm] / ir / be / ia32 / ia32_common_transform.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief       This file implements the common parts of IR transformation from
9  *              firm into ia32-Firm.
10  * @author      Matthias Braun, Sebastian Buchwald
11  */
12 #ifndef FIRM_BE_IA32_IA32_COMMON_TRANSFORM_H
13 #define FIRM_BE_IA32_IA32_COMMON_TRANSFORM_H
14
15 #include "firm_types.h"
16 #include "bearch_ia32_t.h"
17
18 /**
19  * An assembler constraint.
20  */
21 typedef struct constraint_t constraint_t;
22 struct constraint_t {
23         const arch_register_class_t *cls;
24         unsigned                     allowed_registers;
25         char                         all_registers_allowed;
26         char                         memory_possible;
27         char                         immediate_type;
28         int                          same_as;
29 };
30
31 extern ir_heights_t *ia32_heights;
32 extern int           ia32_no_pic_adjust;
33
34 ir_type *ia32_get_prim_type(const ir_mode *mode);
35
36 /**
37  * Get an atomic entity that is initialized with a tarval forming
38  * a given constant.
39  */
40 ir_entity *ia32_create_float_const_entity(ia32_isa_t *isa, ir_tarval *tv,
41                                           ident *name);
42
43 /**
44  * Creates an immediate.
45  *
46  * @param irg            The IR graph the node belongs to.
47  * @param symconst       if set, create a SymConst immediate
48  * @param symconst_sign  sign for the symconst
49  * @param val            integer value for the immediate
50  */
51 ir_node *ia32_create_Immediate(ir_graph *irg, ir_entity *symconst, int symconst_sign, long val);
52
53 /**
54  * returns register by name (used for determining clobber specifications in
55  * asm instructions)
56  */
57 const arch_register_t *ia32_get_clobber_register(const char *clobber);
58
59 /**
60  * Return true if a mode can be stored in the GP register set.
61  */
62 int ia32_mode_needs_gp_reg(ir_mode *mode);
63
64 /**
65  * generates code for a ASM node
66  */
67 ir_node *ia32_gen_ASM(ir_node *node);
68
69 /**
70  * Transforms a CopyB node.
71  *
72  * @return The transformed node.
73  */
74 ir_node *ia32_gen_CopyB(ir_node *node);
75
76 /**
77  * Transform the Thread Local Storage Proj.
78  */
79 ir_node *ia32_gen_Proj_tls(ir_node *node);
80
81 /**
82  * This function just sets the register for the Unknown node
83  * as this is not done during register allocation because Unknown
84  * is an "ignore" node.
85  */
86 ir_node *ia32_gen_Unknown(ir_node *node);
87
88 const arch_register_req_t *ia32_parse_clobber(const char *clobber);
89
90 /**
91  * Checks whether other node inputs depend on the am_candidate (via mem-proj).
92  */
93 int ia32_prevents_AM(ir_node *const block, ir_node *const am_candidate,
94                        ir_node *const other);
95
96 ir_node *ia32_try_create_Immediate(ir_node *node, char immediate_constraint_type);
97
98 #endif