Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
7a689378
Commit
7a689378
authored
Mar 30, 2006
by
Michael Beck
Browse files
be_Call has now dbg_info argument and call type attribute
fixed memory leak some comments added
parent
84e02128
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/be/benode.c
View file @
7a689378
...
@@ -84,28 +84,34 @@ typedef struct {
...
@@ -84,28 +84,34 @@ typedef struct {
be_req_t
in_req
;
be_req_t
in_req
;
}
be_reg_data_t
;
}
be_reg_data_t
;
/** The generic be nodes attribute type. */
typedef
struct
{
typedef
struct
{
int
max_reg_data
;
int
max_reg_data
;
be_reg_data_t
*
reg_data
;
be_reg_data_t
*
reg_data
;
}
be_node_attr_t
;
}
be_node_attr_t
;
/** The be_Stack attribute type. */
typedef
struct
{
typedef
struct
{
be_node_attr_t
node_attr
;
be_node_attr_t
node_attr
;
int
offset
;
/**< The offset by which the stack shall be increased/decreased. */
int
offset
;
/**< The offset by which the stack shall be increased/decreased. */
be_stack_dir_t
dir
;
/**< The direction in which the stack shall be modified (expand or shrink). */
be_stack_dir_t
dir
;
/**< The direction in which the stack shall be modified (expand or shrink). */
}
be_stack_attr_t
;
}
be_stack_attr_t
;
/** The be_Frame attribute type. */
typedef
struct
{
typedef
struct
{
be_node_attr_t
node_attr
;
be_node_attr_t
node_attr
;
entity
*
ent
;
entity
*
ent
;
int
offset
;
int
offset
;
}
be_frame_attr_t
;
}
be_frame_attr_t
;
/** The be_Call attribute type. */
typedef
struct
{
typedef
struct
{
be_node_attr_t
node_attr
;
be_node_attr_t
node_attr
;
entity
*
ent
;
entity
*
ent
;
/**< The called entity if this is a static call. */
ir_type
*
call_tp
;
/**< The call type, copied from the original Call node. */
}
be_call_attr_t
;
}
be_call_attr_t
;
/** The be_Spill attribute type. */
typedef
struct
{
typedef
struct
{
be_frame_attr_t
frame_attr
;
be_frame_attr_t
frame_attr
;
ir_node
*
spill_ctx
;
/**< The node in whose context this spill was introduced. */
ir_node
*
spill_ctx
;
/**< The node in whose context this spill was introduced. */
...
@@ -143,6 +149,8 @@ static const ir_op_ops be_node_op_ops;
...
@@ -143,6 +149,8 @@ static const ir_op_ops be_node_op_ops;
#define H irop_flag_highlevel
#define H irop_flag_highlevel
#define c irop_flag_constlike
#define c irop_flag_constlike
#define K irop_flag_keep
#define K irop_flag_keep
#define M irop_flag_machine
void
be_node_init
(
void
)
{
void
be_node_init
(
void
)
{
static
int
inited
=
0
;
static
int
inited
=
0
;
...
@@ -189,9 +197,12 @@ void be_node_init(void) {
...
@@ -189,9 +197,12 @@ void be_node_init(void) {
set_op_tag
(
op_be_FrameLoad
,
&
be_node_tag
);
set_op_tag
(
op_be_FrameLoad
,
&
be_node_tag
);
set_op_tag
(
op_be_FrameStore
,
&
be_node_tag
);
set_op_tag
(
op_be_FrameStore
,
&
be_node_tag
);
set_op_tag
(
op_be_FrameAddr
,
&
be_node_tag
);
set_op_tag
(
op_be_FrameAddr
,
&
be_node_tag
);
set_op_tag
(
op_be_Barrier
,
&
be_node_tag
);
set_op_tag
(
op_be_Barrier
,
&
be_node_tag
);
}
}
/**
* Initializes the generic attribute of all be nodes and return ir.
*/
static
void
*
init_node_attr
(
ir_node
*
irn
,
int
max_reg_data
)
static
void
*
init_node_attr
(
ir_node
*
irn
,
int
max_reg_data
)
{
{
ir_graph
*
irg
=
get_irn_irg
(
irn
);
ir_graph
*
irg
=
get_irn_irg
(
irn
);
...
@@ -338,38 +349,56 @@ ir_node *be_new_Keep(const arch_register_class_t *cls, ir_graph *irg, ir_node *b
...
@@ -338,38 +349,56 @@ ir_node *be_new_Keep(const arch_register_class_t *cls, ir_graph *irg, ir_node *b
return
irn
;
return
irn
;
}
}
ir_node
*
be_new_Call
(
ir_graph
*
irg
,
ir_node
*
bl
,
ir_node
*
mem
,
ir_node
*
sp
,
ir_node
*
ptr
,
int
n_outs
,
int
n
,
ir_node
*
in
[])
ir_node
*
be_new_Call
(
dbg_info
*
dbg
,
ir_graph
*
irg
,
ir_node
*
bl
,
ir_node
*
mem
,
ir_node
*
sp
,
ir_node
*
ptr
,
int
n_outs
,
int
n
,
ir_node
*
in
[],
ir_type
*
call_tp
)
{
{
int
real_n
=
3
+
n
;
be_call_attr_t
*
a
;
int
real_n
=
be_pos_Call_first_arg
+
n
;
ir_node
*
irn
;
ir_node
*
irn
;
ir_node
**
real_in
;
ir_node
**
real_in
;
real_in
=
xmalloc
(
sizeof
(
real_in
[
0
])
*
(
real_n
));
NEW_ARR_A
(
ir_node
*
,
real_in
,
real_n
);
real_in
[
be_pos_Call_mem
]
=
mem
;
real_in
[
0
]
=
mem
;
real_in
[
be_pos_Call_sp
]
=
sp
;
real_in
[
1
]
=
sp
;
real_in
[
be_pos_Call_ptr
]
=
ptr
;
real_in
[
2
]
=
ptr
;
memcpy
(
&
real_in
[
be_pos_Call_first_arg
],
in
,
n
*
sizeof
(
in
[
0
]));
memcpy
(
&
real_in
[
3
],
in
,
n
*
sizeof
(
in
[
0
]));
irn
=
new_ir_node
(
NULL
,
irg
,
bl
,
op_be_Call
,
mode_T
,
real_n
,
real_in
);
irn
=
new_ir_node
(
NULL
,
irg
,
bl
,
op_be_Call
,
mode_T
,
real_n
,
real_in
);
init_node_attr
(
irn
,
(
n_outs
>
real_n
?
n_outs
:
real_n
));
a
=
init_node_attr
(
irn
,
(
n_outs
>
real_n
?
n_outs
:
real_n
));
a
->
ent
=
NULL
;
a
->
call_tp
=
call_tp
;
return
irn
;
return
irn
;
}
}
entity
*
be_Call_get_entity
(
const
ir_node
*
call
)
/* Gets the call entity or NULL if this is no static call. */
{
entity
*
be_Call_get_entity
(
const
ir_node
*
call
)
{
be_call_attr_t
*
a
=
get_irn_attr
(
call
);
be_call_attr_t
*
a
=
get_irn_attr
(
call
);
assert
(
be_is_Call
(
call
));
assert
(
be_is_Call
(
call
));
return
a
->
ent
;
return
a
->
ent
;
}
}
void
be_Call_set_entity
(
ir_nod
e
*
call
,
entity
*
ent
)
/* Sets th
e call entity
.
*
/
{
void
be_Call_set_entity
(
ir_node
*
call
,
entity
*
ent
)
{
be_call_attr_t
*
a
=
get_irn_attr
(
call
);
be_call_attr_t
*
a
=
get_irn_attr
(
call
);
assert
(
be_is_Call
(
call
));
assert
(
be_is_Call
(
call
));
a
->
ent
=
ent
;
a
->
ent
=
ent
;
}
}
/* Gets the call type. */
ir_type
*
be_Call_get_type
(
ir_node
*
call
)
{
be_call_attr_t
*
a
=
get_irn_attr
(
call
);
assert
(
be_is_Call
(
call
));
return
a
->
call_tp
;
}
/* Sets the call type. */
void
be_Call_set_type
(
ir_node
*
call
,
ir_type
*
call_tp
)
{
be_call_attr_t
*
a
=
get_irn_attr
(
call
);
assert
(
be_is_Call
(
call
));
a
->
call_tp
=
call_tp
;
}
ir_node
*
be_new_Return
(
dbg_info
*
dbg
,
ir_graph
*
irg
,
ir_node
*
bl
,
int
n
,
ir_node
*
in
[])
ir_node
*
be_new_Return
(
dbg_info
*
dbg
,
ir_graph
*
irg
,
ir_node
*
bl
,
int
n
,
ir_node
*
in
[])
{
{
ir_node
*
irn
=
new_ir_node
(
dbg
,
irg
,
bl
,
op_be_Return
,
mode_X
,
n
,
in
);
ir_node
*
irn
=
new_ir_node
(
dbg
,
irg
,
bl
,
op_be_Return
,
mode_X
,
n
,
in
);
...
@@ -1184,6 +1213,9 @@ void be_phi_handler_reset(arch_irn_handler_t *handler)
...
@@ -1184,6 +1213,9 @@ void be_phi_handler_reset(arch_irn_handler_t *handler)
|_| |___/
|_| |___/
*/
*/
/**
* Dumps a register requirement to a file.
*/
static
void
dump_node_req
(
FILE
*
f
,
int
idx
,
be_req_t
*
req
)
static
void
dump_node_req
(
FILE
*
f
,
int
idx
,
be_req_t
*
req
)
{
{
unsigned
i
;
unsigned
i
;
...
@@ -1218,6 +1250,9 @@ static void dump_node_req(FILE *f, int idx, be_req_t *req)
...
@@ -1218,6 +1250,9 @@ static void dump_node_req(FILE *f, int idx, be_req_t *req)
fprintf
(
f
,
"
\n
"
);
fprintf
(
f
,
"
\n
"
);
}
}
/**
* Dumps node register requirements to a file.
*/
static
void
dump_node_reqs
(
FILE
*
f
,
ir_node
*
irn
)
static
void
dump_node_reqs
(
FILE
*
f
,
ir_node
*
irn
)
{
{
int
i
;
int
i
;
...
@@ -1241,6 +1276,9 @@ static void dump_node_reqs(FILE *f, ir_node *irn)
...
@@ -1241,6 +1276,9 @@ static void dump_node_reqs(FILE *f, ir_node *irn)
}
}
}
}
/**
* ir_op-Operation: dump a be node to file
*/
static
int
dump_node
(
ir_node
*
irn
,
FILE
*
f
,
dump_reason_t
reason
)
static
int
dump_node
(
ir_node
*
irn
,
FILE
*
f
,
dump_reason_t
reason
)
{
{
be_node_attr_t
*
at
=
get_irn_attr
(
irn
);
be_node_attr_t
*
at
=
get_irn_attr
(
irn
);
...
@@ -1282,13 +1320,13 @@ static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason)
...
@@ -1282,13 +1320,13 @@ static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason)
}
}
break
;
break
;
}
}
}
}
return
0
;
return
0
;
}
}
/**
/**
* ir_op-Operation:
* Copies the backend specific attributes from old node to new node.
* Copies the backend specific attributes from old node to new node.
*/
*/
static
void
copy_attr
(
const
ir_node
*
old_node
,
ir_node
*
new_node
)
static
void
copy_attr
(
const
ir_node
*
old_node
,
ir_node
*
new_node
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment