make firm compilable with a c++ compiler
[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  * @version     $Id: ia32_common_transform.h 20999 2008-08-05 16:48:29Z beck $
26  */
27 #ifndef FIRM_BE_IA32_IA32_COMMON_TRANSFORM_H
28 #define FIRM_BE_IA32_IA32_COMMON_TRANSFORM_H
29
30 #include "firm_types.h"
31 #include "bearch_ia32_t.h"
32
33 /**
34  * An assembler constraint.
35  */
36 typedef struct constraint_t constraint_t;
37 struct constraint_t {
38         const arch_register_class_t *cls;
39         unsigned                     allowed_registers;
40         char                         all_registers_allowed;
41         char                         memory_possible;
42         char                         immediate_type;
43         int                          same_as;
44 };
45
46 extern ir_heights_t *heights;
47 extern int           no_pic_adjust;
48
49 /**
50  * Get an atomic entity that is initialized with a tarval forming
51  * a given constant.
52  *
53  * @param cnst             the node representing the constant
54  */
55 ir_entity *create_float_const_entity(ir_node *cnst);
56
57 /**
58  * Creates an immediate.
59  *
60  * @param symconst       if set, create a SymConst immediate
61  * @param symconst_sign  sign for the symconst
62  * @param val            integer value for the immediate
63  */
64 ir_node *ia32_create_Immediate(ir_entity *symconst, int symconst_sign, long val);
65
66 /**
67  * returns register by name (used for determining clobber specifications in
68  * asm instructions)
69  */
70 const arch_register_t *ia32_get_clobber_register(const char *clobber);
71
72 /**
73  * Return true if a mode can be stored in the GP register set.
74  */
75 int ia32_mode_needs_gp_reg(ir_mode *mode);
76
77 /**
78  * generates code for a ASM node
79  */
80 ir_node *gen_ASM(ir_node *node);
81
82 /**
83  * Transforms a CopyB node.
84  *
85  * @return The transformed node.
86  */
87 ir_node *gen_CopyB(ir_node *node);
88
89 /**
90  * Transform the Thread Local Storage Proj.
91  */
92 ir_node *gen_Proj_tls(ir_node *node);
93
94 /**
95  * This function just sets the register for the Unknown node
96  * as this is not done during register allocation because Unknown
97  * is an "ignore" node.
98  */
99 ir_node *gen_Unknown(ir_node *node);
100
101 const arch_register_req_t *make_register_req(const constraint_t *constraint,
102                 int n_outs, const arch_register_req_t **out_reqs, int pos);
103
104 const arch_register_req_t *parse_clobber(const char *clobber);
105
106 /**
107  * Checks whether other node inputs depend on the am_candidate (via mem-proj).
108  */
109 int prevents_AM(ir_node *const block, ir_node *const am_candidate,
110                        ir_node *const other);
111
112 ir_node *try_create_Immediate(ir_node *node, char immediate_constraint_type);
113
114 #endif