bearch_sparc_t.h 2.66 KB
Newer Older
Hannes Rapp's avatar
Hannes Rapp committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * 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   declarations for SPARC backend -- private header
Matthias Braun's avatar
Matthias Braun committed
23
 * @author  Hannes Rapp, Matthias Braun
Michael Beck's avatar
Michael Beck committed
24
 * @version $Id$
Hannes Rapp's avatar
Hannes Rapp committed
25
 */
26
27
#ifndef FIRM_BE_SPARC_BEARCH_SPARC_T_H
#define FIRM_BE_SPARC_BEARCH_SPARC_T_H
Hannes Rapp's avatar
Hannes Rapp committed
28

29
#include <stdbool.h>
Hannes Rapp's avatar
Hannes Rapp committed
30
31
#include "sparc_nodes_attr.h"
#include "be.h"
32

Hannes Rapp's avatar
Hannes Rapp committed
33
typedef struct sparc_transform_env_t  sparc_transform_env_t;
34
35
36
typedef struct sparc_isa_t            sparc_isa_t;

struct sparc_isa_t {
37
38
	arch_env_t  base;      /**< must be derived from arch_env_t */
    pmap       *constants;
Hannes Rapp's avatar
Hannes Rapp committed
39
40
41
42
43
44
45
46
47
48
49
50
51
52
};

/**
 * this is a struct to minimize the number of parameters
 * for transformation walker
 */
struct sparc_transform_env_t {
	dbg_info *dbg;      /**< The node debug info */
	ir_graph *irg;      /**< The irg, the node should be created in */
	ir_node  *block;    /**< The block, the node should belong to */
	ir_node  *irn;      /**< The irn, to be transformed */
	ir_mode  *mode;     /**< The mode of the irn */
};

53
54
extern const arch_irn_ops_t sparc_irn_ops;

55
/**
56
 * SPARC ABI requires some space which is always available at the top of
57
58
 * the stack. It contains:
 * 16*4 bytes space for spilling the register window
59
60
 * 1*4 byte   holding a pointer to space for aggregate returns (the space is
 *            always reserved, regardless whether we have an aggregate return
61
62
 *            or not)
 * 6*4 bytes  Space for spilling parameters 0-5. For the cases when someone
63
 *            takes the address of a parameter. I guess this is also there so
64
65
66
67
68
 *            the implementation of va_args gets easier -> We can simply store
 *            param 0-5 in this spaces and then handle va_next by simply
 *            incrementing the stack pointer
 */
#define SPARC_MIN_STACKSIZE 92
69
70
71
72
73
74
75
#define SPARC_IMMEDIATE_MIN -4096
#define SPARC_IMMEDIATE_MAX  4095

static inline bool sparc_is_value_imm_encodeable(int32_t value)
{
	return SPARC_IMMEDIATE_MIN <= value && value <= SPARC_IMMEDIATE_MAX;
}
76

77
78
void sparc_finish(ir_graph *irg);

79
80
void sparc_introduce_prolog_epilog(ir_graph *irg);

81
82
void sparc_lower_64bit(void);

Hannes Rapp's avatar
Hannes Rapp committed
83
#endif