bestate: Remove unnecessary test.
[libfirm] / ir / be / ia32 / ia32_common_transform.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief       This file implements the common parts of IR transformation from
23  *              firm into ia32-Firm.
24  * @author      Matthias Braun, Sebastian Buchwald
25  */
26 #ifndef FIRM_BE_IA32_IA32_COMMON_TRANSFORM_H
27 #define FIRM_BE_IA32_IA32_COMMON_TRANSFORM_H
28
29 #include "firm_types.h"
30 #include "bearch_ia32_t.h"
31
32 /**
33  * An assembler constraint.
34  */
35 typedef struct constraint_t constraint_t;
36 struct constraint_t {
37         const arch_register_class_t *cls;
38         unsigned                     allowed_registers;
39         char                         all_registers_allowed;
40         char                         memory_possible;
41         char                         immediate_type;
42         int                          same_as;
43 };
44
45 extern ir_heights_t *ia32_heights;
46 extern int           ia32_no_pic_adjust;
47
48 ir_type *ia32_get_prim_type(const ir_mode *mode);
49
50 /**
51  * Get an atomic entity that is initialized with a tarval forming
52  * a given constant.
53  */
54 ir_entity *ia32_create_float_const_entity(ia32_isa_t *isa, ir_tarval *tv,
55                                           ident *name);
56
57 /**
58  * Creates an immediate.
59  *
60  * @param irg            The IR graph the node belongs to.
61  * @param symconst       if set, create a SymConst immediate
62  * @param symconst_sign  sign for the symconst
63  * @param val            integer value for the immediate
64  */
65 ir_node *ia32_create_Immediate(ir_graph *irg, ir_entity *symconst, int symconst_sign, long val);
66
67 /**
68  * returns register by name (used for determining clobber specifications in
69  * asm instructions)
70  */
71 const arch_register_t *ia32_get_clobber_register(const char *clobber);
72
73 /**
74  * Return true if a mode can be stored in the GP register set.
75  */
76 int ia32_mode_needs_gp_reg(ir_mode *mode);
77
78 /**
79  * generates code for a ASM node
80  */
81 ir_node *ia32_gen_ASM(ir_node *node);
82
83 /**
84  * Transforms a CopyB node.
85  *
86  * @return The transformed node.
87  */
88 ir_node *ia32_gen_CopyB(ir_node *node);
89
90 /**
91  * Transform the Thread Local Storage Proj.
92  */
93 ir_node *ia32_gen_Proj_tls(ir_node *node);
94
95 /**
96  * This function just sets the register for the Unknown node
97  * as this is not done during register allocation because Unknown
98  * is an "ignore" node.
99  */
100 ir_node *ia32_gen_Unknown(ir_node *node);
101
102 const arch_register_req_t *ia32_parse_clobber(const char *clobber);
103
104 /**
105  * Checks whether other node inputs depend on the am_candidate (via mem-proj).
106  */
107 int ia32_prevents_AM(ir_node *const block, ir_node *const am_candidate,
108                        ir_node *const other);
109
110 ir_node *ia32_try_create_Immediate(ir_node *node, char immediate_constraint_type);
111
112 #endif