benode_t.h 2.66 KB
Newer Older
Sebastian Hack's avatar
Sebastian Hack committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/**
 * @file   benode_t.h
 * @date   17.05.2005
 * @author Sebastian Hack
 *
 * Backend node support.
 *
 * Copyright (C) 2005 Universitaet Karlsruhe
 * Released under the GPL
 */

#ifndef _BENODE_T_H
#define _BENODE_T_H

15
16
#include "pmap.h"

Sebastian Hack's avatar
Sebastian Hack committed
17
18
19
#include "irmode.h"
#include "irnode.h"

20
#include "be_t.h"
Sebastian Hack's avatar
Sebastian Hack committed
21
22
#include "bearch.h"

23
24
25
26
27
28
29
30
31
32
33
34
struct _be_node_factory_t {
  const arch_isa_if_t *isa;

  struct obstack      obst;
  set                 *ops;
  pmap                *irn_op_map;
  pmap                *reg_req_map;

  arch_irn_handler_t  handler;
  arch_irn_ops_t      irn_ops;
};

Sebastian Hack's avatar
Sebastian Hack committed
35
36
typedef struct _be_node_factory_t 			be_node_factory_t;

Sebastian Hack's avatar
Sebastian Hack committed
37
be_node_factory_t *be_node_factory_init(be_node_factory_t *factory, const arch_isa_t *isa);
Sebastian Hack's avatar
Sebastian Hack committed
38
39
40
41
42

const arch_irn_handler_t *be_node_get_irn_handler(const be_node_factory_t *f);

ir_node *new_Spill(const be_node_factory_t *factory,
    const arch_register_class_t *cls,
43
    ir_graph *irg, ir_node *bl, ir_node *node_to_spill, ir_node *ctx);
Sebastian Hack's avatar
Sebastian Hack committed
44
45

ir_node *new_Reload(const be_node_factory_t *factory,
Sebastian Hack's avatar
Sebastian Hack committed
46
47
    const arch_register_class_t *cls, ir_graph *irg,
    ir_node *bl, ir_mode *mode, ir_node *spill_node);
Sebastian Hack's avatar
Sebastian Hack committed
48
49
50
51
52
53
54
55
56

ir_node *new_Perm(const be_node_factory_t *factory,
    const arch_register_class_t *cls,
    ir_graph *irg, ir_node *bl, int arity, ir_node **in);

ir_node *new_Copy(const be_node_factory_t *factory,
    const arch_register_class_t *cls,
    ir_graph *irg, ir_node *block, ir_node *in);

Sebastian Hack's avatar
Sebastian Hack committed
57
58
59
ir_node *be_spill(
		const be_node_factory_t *factory,
		const arch_env_t *arch_env,
60
61
		ir_node *irn,
		ir_node *spill_ctx);
Sebastian Hack's avatar
Sebastian Hack committed
62
63
64
65
66
67

ir_node *be_reload(
		const be_node_factory_t *factory,
		const arch_env_t *arch_env,
		const arch_register_class_t *cls,
		ir_node *irn, int pos, ir_mode *mode, ir_node *spill);
Sebastian Hack's avatar
Sebastian Hack committed
68

69
70
71
72
int be_is_Spill(const ir_node *irn);
int be_is_Reload(const ir_node *irn);
int be_is_Copy(const ir_node *irn);
int be_is_Perm(const ir_node *irn);
Sebastian Hack's avatar
Sebastian Hack committed
73

74
75
76
77
78
79
void set_Spill_offset(ir_node *irn, unsigned offset);
unsigned get_Spill_offset(ir_node *irn);

ir_node *get_Spill_context(const ir_node *irn);


80
81
82
83
84
85
86
87
88
89
90
91
92
93
/**
 * Modify the output register requirements of a Perm.
 * This function incur register constraints to an output value of a Perm.
 * This is used when handling register constraints in general,
 * see beconstrperm.c
 */
void be_set_Perm_out_req(ir_node *irn, int pos, const arch_register_req_t *req);

/**
 * Insert a Perm node after a specific node in the schedule.
 * The Perm permutes over all values live at the given node.
 * This means that all liveness intervals are cut apart at this
 * location in the program.
 */
Sebastian Hack's avatar
Sebastian Hack committed
94
95
96
97
ir_node *insert_Perm_after(const be_main_env_t *env,
						   const arch_register_class_t *cls,
						   dom_front_info_t *dom_front,
						   ir_node *pos);
Sebastian Hack's avatar
Sebastian Hack committed
98

Sebastian Hack's avatar
Sebastian Hack committed
99
#endif /* _BENODE_T_H */