ia32_common_transform.h 3.26 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
 *
 * This file is part of libFirm.
 *
 * This file may be distributed and/or modified under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation and appearing in the file LICENSE.GPL included in the
 * packaging of this file.
 *
 * Licensees holding valid libFirm Professional Edition licenses may use
 * this file in accordance with the libFirm Commercial License.
 * Agreement provided with the Software.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE.
 */

/**
 * @file
 * @brief       This file implements the common parts of IR transformation from
 *              firm into ia32-Firm.
Matthias Braun's avatar
Matthias Braun committed
24
 * @author      Matthias Braun, Sebastian Buchwald
25
26
27
28
29
 * @version     $Id: ia32_common_transform.h 20999 2008-08-05 16:48:29Z beck $
 */
#ifndef FIRM_BE_IA32_IA32_COMMON_TRANSFORM_H
#define FIRM_BE_IA32_IA32_COMMON_TRANSFORM_H

30
#include "firm_types.h"
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "bearch_ia32_t.h"

/**
 * An assembler constraint.
 */
typedef struct constraint_t constraint_t;
struct constraint_t {
	const arch_register_class_t *cls;
	unsigned                     allowed_registers;
	char                         all_registers_allowed;
	char                         memory_possible;
	char                         immediate_type;
	int                          same_as;
};

extern ia32_code_gen_t *env_cg;
47
48
extern ir_heights_t    *heights;
extern int              no_pic_adjust;
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

/**
 * Get an atomic entity that is initialized with a tarval forming
 * a given constant.
 *
 * @param cnst             the node representing the constant
 */
ir_entity *create_float_const_entity(ir_node *cnst);

/**
 * Creates an immediate.
 *
 * @param symconst       if set, create a SymConst immediate
 * @param symconst_sign  sign for the symconst
 * @param val            integer value for the immediate
 */
65
ir_node *ia32_create_Immediate(ir_entity *symconst, int symconst_sign, long val);
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

/**
 * returns register by name (used for determining clobber specifications in
 * asm instructions)
 */
const arch_register_t *ia32_get_clobber_register(const char *clobber);

/**
 * Return true if a mode can be stored in the GP register set.
 */
int ia32_mode_needs_gp_reg(ir_mode *mode);

/**
 * generates code for a ASM node
 */
ir_node *gen_ASM(ir_node *node);

83
84
85
86
87
/**
 * Transforms a CopyB node.
 *
 * @return The transformed node.
 */
88
89
90
91
92
93
ir_node *gen_CopyB(ir_node *node);

/**
 * Transform the Thread Local Storage Proj.
 */
ir_node *gen_Proj_tls(ir_node *node);
94

95
96
97
98
99
100
101
102
103
104
105
106
/**
 * This function just sets the register for the Unknown node
 * as this is not done during register allocation because Unknown
 * is an "ignore" node.
 */
ir_node *gen_Unknown(ir_node *node);

const arch_register_req_t *make_register_req(const constraint_t *constraint,
		int n_outs, const arch_register_req_t **out_reqs, int pos);

const arch_register_req_t *parse_clobber(const char *clobber);

107
108
109
110
111
112
/**
 * Checks whether other node inputs depend on the am_candidate (via mem-proj).
 */
int prevents_AM(ir_node *const block, ir_node *const am_candidate,
                       ir_node *const other);

113
114
ir_node *try_create_Immediate(ir_node *node, char immediate_constraint_type);

115
#endif