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
0a4048fb
Commit
0a4048fb
authored
Feb 08, 2011
by
Matthias Braun
Browse files
further spread size_t
[r28337]
parent
155e9851
Changes
24
Hide whitespace changes
Inline
Side-by-side
include/libfirm/compound_path.h
View file @
0a4048fb
...
...
@@ -36,7 +36,7 @@ typedef struct compound_graph_path compound_graph_path, *ir_compound_graph_path
* @deprecated
* Creates a new compound graph path of given length.
*/
FIRM_API
compound_graph_path
*
new_compound_graph_path
(
ir_type
*
tp
,
in
t
length
);
FIRM_API
compound_graph_path
*
new_compound_graph_path
(
ir_type
*
tp
,
size_
t
length
);
/**
* @deprecated
...
...
@@ -54,32 +54,32 @@ FIRM_API void free_compound_graph_path(compound_graph_path *gr);
* @deprecated
* Returns the length of a graph path
*/
FIRM_API
in
t
get_compound_graph_path_length
(
const
compound_graph_path
*
gr
);
FIRM_API
size_
t
get_compound_graph_path_length
(
const
compound_graph_path
*
gr
);
/**
* @deprecated
* Get the entity node of an compound graph path at position pos.
*/
ir_entity
*
get_compound_graph_path_node
(
const
compound_graph_path
*
gr
,
in
t
pos
);
ir_entity
*
get_compound_graph_path_node
(
const
compound_graph_path
*
gr
,
size_
t
pos
);
/**
* @deprecated
* Set the entity node of an compound graph path at position pos.
*/
FIRM_API
void
set_compound_graph_path_node
(
compound_graph_path
*
gr
,
in
t
pos
,
FIRM_API
void
set_compound_graph_path_node
(
compound_graph_path
*
gr
,
size_
t
pos
,
ir_entity
*
node
);
/**
* @deprecated
* Get the index of an compound graph path at position pos.
*/
FIRM_API
int
get_compound_graph_path_array_index
(
const
compound_graph_path
*
gr
,
in
t
pos
);
FIRM_API
long
get_compound_graph_path_array_index
(
const
compound_graph_path
*
gr
,
size_
t
pos
);
/**
* @deprecated
* Set the index of an compound graph path at position pos.
*/
FIRM_API
void
set_compound_graph_path_array_index
(
compound_graph_path
*
gr
,
in
t
pos
,
int
index
);
FIRM_API
void
set_compound_graph_path_array_index
(
compound_graph_path
*
gr
,
size_
t
pos
,
long
index
);
/**
* @deprecated
...
...
@@ -92,7 +92,7 @@ FIRM_API ir_type *get_compound_graph_path_type(const compound_graph_path *gr);
* Checks whether the path up to pos is correct. If the path contains a NULL,
* assumes the path is not complete and returns non-zero.
*/
FIRM_API
int
is_proper_compound_graph_path
(
compound_graph_path
*
gr
,
in
t
pos
);
FIRM_API
int
is_proper_compound_graph_path
(
compound_graph_path
*
gr
,
size_
t
pos
);
/**
* @deprecated
...
...
@@ -100,13 +100,13 @@ FIRM_API int is_proper_compound_graph_path(compound_graph_path *gr, int pos);
* corresponding access path to the member of the compound.
*/
FIRM_API
void
add_compound_ent_value_w_path
(
ir_entity
*
ent
,
ir_node
*
val
,
compound_graph_path
*
path
);
FIRM_API
void
set_compound_ent_value_w_path
(
ir_entity
*
ent
,
ir_node
*
val
,
compound_graph_path
*
path
,
in
t
pos
);
FIRM_API
void
set_compound_ent_value_w_path
(
ir_entity
*
ent
,
ir_node
*
val
,
compound_graph_path
*
path
,
size_
t
pos
);
/**
* @deprecated
* Returns the access path for value at position pos.
*/
FIRM_API
compound_graph_path
*
get_compound_ent_value_path
(
const
ir_entity
*
ent
,
in
t
pos
);
FIRM_API
compound_graph_path
*
get_compound_ent_value_path
(
const
ir_entity
*
ent
,
size_
t
pos
);
/**
* @deprecated
...
...
@@ -137,14 +137,14 @@ FIRM_API void add_compound_ent_value(ir_entity *ent, ir_node *val, ir_entity *me
* @deprecated
* Returns the last member in the path
*/
FIRM_API
ir_entity
*
get_compound_ent_value_member
(
const
ir_entity
*
ent
,
in
t
pos
);
FIRM_API
ir_entity
*
get_compound_ent_value_member
(
const
ir_entity
*
ent
,
size_
t
pos
);
/**
* @deprecated
* Sets the path at pos 0
*/
FIRM_API
void
set_compound_ent_value
(
ir_entity
*
ent
,
ir_node
*
val
,
ir_entity
*
member
,
in
t
pos
);
ir_entity
*
member
,
size_
t
pos
);
/**
* @deprecated
...
...
@@ -155,7 +155,7 @@ FIRM_API void set_compound_ent_value(ir_entity *ent, ir_node *val,
* fits into the given array size. Does not test whether the
* values have the proper mode for the array.
*/
FIRM_API
void
set_array_entity_values
(
ir_entity
*
ent
,
ir_tarval
**
values
,
in
t
num_vals
);
FIRM_API
void
set_array_entity_values
(
ir_entity
*
ent
,
ir_tarval
**
values
,
size_
t
num_vals
);
/**
* @deprecated
...
...
@@ -166,7 +166,7 @@ FIRM_API void set_array_entity_values(ir_entity *ent, ir_tarval **values, int nu
* @param ent Any entity of compound type with at least pos initialization values.
* @param pos The position of the value for which the offset is requested.
*/
FIRM_API
unsigned
get_compound_ent_value_offset_bit_remainder
(
const
ir_entity
*
ent
,
in
t
pos
);
FIRM_API
unsigned
get_compound_ent_value_offset_bit_remainder
(
const
ir_entity
*
ent
,
size_
t
pos
);
/**
* @deprecated
...
...
@@ -178,20 +178,20 @@ FIRM_API unsigned get_compound_ent_value_offset_bit_remainder(const ir_entity *e
* @param ent Any entity of compound type with at least pos initialization values.
* @param pos The position of the value for which the offset is requested.
*/
FIRM_API
unsigned
get_compound_ent_value_offset_bytes
(
const
ir_entity
*
ent
,
in
t
pos
);
FIRM_API
unsigned
get_compound_ent_value_offset_bytes
(
const
ir_entity
*
ent
,
size_
t
pos
);
/**
* @deprecated
* Returns the number of constant values needed to initialize the entity.
* Asserts if the entity has variability_uninitialized.
*/
FIRM_API
in
t
get_compound_ent_n_values
(
const
ir_entity
*
ent
);
FIRM_API
size_
t
get_compound_ent_n_values
(
const
ir_entity
*
ent
);
/**
* @deprecated
* Returns a constant value given the position.
*/
FIRM_API
ir_node
*
get_compound_ent_value
(
const
ir_entity
*
ent
,
in
t
pos
);
FIRM_API
ir_node
*
get_compound_ent_value
(
const
ir_entity
*
ent
,
size_
t
pos
);
/**
* @deprecated
...
...
include/libfirm/irloop.h
View file @
0a4048fb
...
...
@@ -81,38 +81,38 @@ FIRM_API ir_loop *get_irn_loop(const ir_node *n);
/** Returns outer loop, itself if outermost. */
FIRM_API
ir_loop
*
get_loop_outer_loop
(
const
ir_loop
*
loop
);
/** Returns nesting depth of this loop */
FIRM_API
int
get_loop_depth
(
const
ir_loop
*
loop
);
FIRM_API
unsigned
get_loop_depth
(
const
ir_loop
*
loop
);
/* Sons are the inner loops contained in this loop. */
/** Returns the number of inner loops */
FIRM_API
in
t
get_loop_n_sons
(
const
ir_loop
*
loop
);
FIRM_API
size_
t
get_loop_n_sons
(
const
ir_loop
*
loop
);
/** Returns the pos`th son loop (inner loop) of a loop.
Returns NULL if there is not a pos`th loop_node. */
FIRM_API
ir_loop
*
get_loop_son
(
ir_loop
*
loop
,
in
t
pos
);
FIRM_API
ir_loop
*
get_loop_son
(
ir_loop
*
loop
,
size_
t
pos
);
/** Returns the number of nodes contained in loop. */
FIRM_API
in
t
get_loop_n_nodes
(
const
ir_loop
*
loop
);
FIRM_API
size_
t
get_loop_n_nodes
(
const
ir_loop
*
loop
);
/** Returns the pos`th ir_node of a loop.
Returns NULL if there is not a pos`th ir_node. */
FIRM_API
ir_node
*
get_loop_node
(
const
ir_loop
*
loop
,
in
t
pos
);
FIRM_API
ir_node
*
get_loop_node
(
const
ir_loop
*
loop
,
size_
t
pos
);
/** Returns the number of elements contained in loop. */
FIRM_API
in
t
get_loop_n_elements
(
const
ir_loop
*
loop
);
FIRM_API
size_
t
get_loop_n_elements
(
const
ir_loop
*
loop
);
/** Returns a loop element. A loop element can be interpreted as a
kind pointer, an ir_node* or an ir_loop*. */
FIRM_API
loop_element
get_loop_element
(
const
ir_loop
*
loop
,
in
t
pos
);
FIRM_API
loop_element
get_loop_element
(
const
ir_loop
*
loop
,
size_
t
pos
);
/** Returns the element number of the loop son in loop.
* Returns -1 if not found. O(|elements|). */
FIRM_API
in
t
get_loop_element_pos
(
const
ir_loop
*
loop
,
void
*
le
);
FIRM_API
size_
t
get_loop_element_pos
(
const
ir_loop
*
loop
,
void
*
le
);
/** Returns a unique node number for the loop node to make output
readable. If libfirm_debug is not set it returns the loop cast to
int. */
FIRM_API
int
get_loop_loop_nr
(
const
ir_loop
*
loop
);
FIRM_API
long
get_loop_loop_nr
(
const
ir_loop
*
loop
);
/** A field to connect additional information to a loop. */
FIRM_API
void
set_loop_link
(
ir_loop
*
loop
,
void
*
link
);
...
...
include/libfirm/irprog.h
View file @
0a4048fb
...
...
@@ -41,6 +41,7 @@
#ifndef FIRM_IR_IRPROG_H
#define FIRM_IR_IRPROG_H
#include <stddef.h>
#include "firm_types.h"
#include "irgraph.h"
#include "begin.h"
...
...
@@ -142,13 +143,13 @@ FIRM_API void remove_irp_irg(ir_graph *irg);
FIRM_API
int
get_irp_last_idx
(
void
);
/** Returns the number of ir graphs in the irp. */
FIRM_API
in
t
get_irp_n_irgs
(
void
);
FIRM_API
size_
t
get_irp_n_irgs
(
void
);
/** Returns the ir graph at position pos in the irp. */
FIRM_API
ir_graph
*
get_irp_irg
(
in
t
pos
);
FIRM_API
ir_graph
*
get_irp_irg
(
size_
t
pos
);
/** Sets the ir graph at position pos. */
FIRM_API
void
set_irp_irg
(
in
t
pos
,
ir_graph
*
irg
);
FIRM_API
void
set_irp_irg
(
size_
t
pos
,
ir_graph
*
irg
);
/**
* Returns the type containing the entities for a segment.
...
...
@@ -188,25 +189,25 @@ FIRM_API void remove_irp_type(ir_type *typ);
* Returns the number of all types in the irp.
* @deprecated
*/
FIRM_API
in
t
get_irp_n_types
(
void
);
FIRM_API
size_
t
get_irp_n_types
(
void
);
/**
* Returns the type at position pos in the irp.
* @deprecated
*/
FIRM_API
ir_type
*
get_irp_type
(
in
t
pos
);
FIRM_API
ir_type
*
get_irp_type
(
size_
t
pos
);
/**
* Overwrites the type at position pos with another type.
* @deprecated
*/
FIRM_API
void
set_irp_type
(
in
t
pos
,
ir_type
*
typ
);
FIRM_API
void
set_irp_type
(
size_
t
pos
,
ir_type
*
typ
);
/** Returns the number of all modes in the irp. */
FIRM_API
in
t
get_irp_n_modes
(
void
);
FIRM_API
size_
t
get_irp_n_modes
(
void
);
/** Returns the mode at position pos in the irp. */
FIRM_API
ir_mode
*
get_irp_mode
(
in
t
pos
);
FIRM_API
ir_mode
*
get_irp_mode
(
size_
t
pos
);
/** Adds opcode to the list of opcodes in irp. */
FIRM_API
void
add_irp_opcode
(
ir_op
*
opcode
);
...
...
@@ -216,10 +217,10 @@ FIRM_API void add_irp_opcode(ir_op *opcode);
FIRM_API
void
remove_irp_opcode
(
ir_op
*
opcode
);
/** Returns the number of all opcodes in the irp. */
FIRM_API
in
t
get_irp_n_opcodes
(
void
);
FIRM_API
size_
t
get_irp_n_opcodes
(
void
);
/** Returns the opcode at position pos in the irp. */
FIRM_API
ir_op
*
get_irp_opcode
(
in
t
pos
);
FIRM_API
ir_op
*
get_irp_opcode
(
size_
t
pos
);
/** Sets the generic function pointer of all opcodes to NULL */
FIRM_API
void
clear_irp_opcodes_generic_func
(
void
);
...
...
@@ -277,10 +278,10 @@ FIRM_API ir_label_t get_irp_next_label_nr(void);
FIRM_API
void
add_irp_asm
(
ident
*
asm_string
);
/** Return the number of global asm includes. */
FIRM_API
in
t
get_irp_n_asms
(
void
);
FIRM_API
size_
t
get_irp_n_asms
(
void
);
/** Return the global asm include at position pos. */
FIRM_API
ident
*
get_irp_asm
(
in
t
pos
);
FIRM_API
ident
*
get_irp_asm
(
size_
t
pos
);
#include "end.h"
...
...
ir/ana/interval_analysis.c
View file @
0a4048fb
...
...
@@ -580,7 +580,7 @@ static void dump_interval_loop(FILE *F, ir_loop *l)
fprintf
(
F
,
"graph: { title:
\"
"
);
PRINT_LOOPID
(
l
);
fprintf
(
F
,
"
\"
label:
\"
loop %d"
,
get_loop_loop_nr
(
l
));
fprintf
(
F
,
"
\"
label:
\"
loop %
l
d"
,
get_loop_loop_nr
(
l
));
fprintf
(
F
,
" freq: %9.4lf"
,
get_region_exec_freq
(
l
));
fprintf
(
F
,
" n_outs: %d"
,
get_region_n_outs
(
l
));
fprintf
(
F
,
" n_exc_outs: %d"
,
get_region_n_exc_outs
(
l
));
...
...
ir/ana/ircfscc.c
View file @
0a4048fb
...
...
@@ -53,7 +53,7 @@ static int loop_node_cnt = 0;
/** Counter to generate depth first numbering of visited nodes. */
static
int
current_dfn
=
1
;
static
int
max_loop_depth
=
0
;
static
unsigned
max_loop_depth
=
0
;
void
link_to_reg_end
(
ir_node
*
n
,
void
*
env
);
...
...
ir/ana/irloop.c
View file @
0a4048fb
...
...
@@ -24,7 +24,7 @@
* @date 7.2002
* @version $Id: irloop_t.h 17143 2008-01-02 20:56:33Z beck $
*/
#
include "config.h"
#include "config.h"
#include <string.h>
#include <stdlib.h>
...
...
@@ -95,13 +95,13 @@ ir_loop *(get_loop_outer_loop)(const ir_loop *loop)
}
/* Returns nesting depth of this loop */
int
(
get_loop_depth
)(
const
ir_loop
*
loop
)
unsigned
(
get_loop_depth
)(
const
ir_loop
*
loop
)
{
return
_get_loop_depth
(
loop
);
}
/* Returns the number of inner loops */
in
t
(
get_loop_n_sons
)(
const
ir_loop
*
loop
)
size_
t
(
get_loop_n_sons
)(
const
ir_loop
*
loop
)
{
return
_get_loop_n_sons
(
loop
);
}
...
...
@@ -109,78 +109,75 @@ int (get_loop_n_sons)(const ir_loop *loop)
/* Returns the pos`th loop_node-child *
* TODO: This method isn`t very efficient ! *
* Returns NULL if there isn`t a pos`th loop_node */
ir_loop
*
get_loop_son
(
ir_loop
*
loop
,
in
t
pos
)
ir_loop
*
get_loop_son
(
ir_loop
*
loop
,
size_
t
pos
)
{
size_t
child_nr
=
0
;
in
t
loop_nr
=
-
1
;
size_
t
loop_nr
=
0
;
assert
(
loop
&&
loop
->
kind
==
k_ir_loop
);
for
(
child_nr
=
0
;
child_nr
<
ARR_LEN
(
loop
->
children
);
++
child_nr
)
{
if
(
*
(
loop
->
children
[
child_nr
].
kind
)
=
=
k_ir_loop
)
loop_nr
++
;
if
(
*
(
loop
->
children
[
child_nr
].
kind
)
!
=
k_ir_loop
)
continue
;
if
(
loop_nr
==
pos
)
return
loop
->
children
[
child_nr
].
son
;
loop_nr
++
;
}
return
NULL
;
}
/* Returns the number of nodes in the loop */
in
t
get_loop_n_nodes
(
const
ir_loop
*
loop
)
size_
t
get_loop_n_nodes
(
const
ir_loop
*
loop
)
{
assert
(
loop
);
assert
(
loop
->
kind
==
k_ir_loop
);
assert
(
loop
);
assert
(
loop
->
kind
==
k_ir_loop
);
return
loop
->
n_nodes
;
}
/* Returns the pos'th ir_node-child *
* TODO: This method isn't very efficient ! *
* Returns NULL if there isn't a pos'th ir_node */
ir_node
*
get_loop_node
(
const
ir_loop
*
loop
,
in
t
pos
)
ir_node
*
get_loop_node
(
const
ir_loop
*
loop
,
size_
t
pos
)
{
size_t
node_nr
=
0
;
size_t
child_nr
;
int
node_nr
=
-
1
;
assert
(
loop
&&
loop
->
kind
==
k_ir_loop
);
assert
(
pos
<
get_loop_n_nodes
(
loop
));
for
(
child_nr
=
0
;
child_nr
<
ARR_LEN
(
loop
->
children
);
++
child_nr
)
{
if
(
*
(
loop
->
children
[
child_nr
].
kind
)
=
=
k_ir_node
)
node_nr
++
;
if
(
*
(
loop
->
children
[
child_nr
].
kind
)
!
=
k_ir_node
)
continue
;
if
(
node_nr
==
pos
)
return
loop
->
children
[
child_nr
].
node
;
node_nr
++
;
}
panic
(
"no child at pos found"
);
}
/* Returns the number of elements contained in loop. */
in
t
get_loop_n_elements
(
const
ir_loop
*
loop
)
size_
t
get_loop_n_elements
(
const
ir_loop
*
loop
)
{
assert
(
loop
&&
loop
->
kind
==
k_ir_loop
);
return
(
ARR_LEN
(
loop
->
children
));
}
/*
Returns the pos`th loop element.
This may be a loop_node or a ir_node. The caller of this function has
to check the *(loop_element.kind) field for "k_ir_node" or "k_ir_loop"
and then select the appropriate "loop_element.node" or "loop_element.son".
*/
loop_element
get_loop_element
(
const
ir_loop
*
loop
,
int
pos
)
loop_element
get_loop_element
(
const
ir_loop
*
loop
,
size_t
pos
)
{
assert
(
loop
&&
loop
->
kind
==
k_ir_loop
&&
pos
<
ARR_LEN
(
loop
->
children
));
return
(
loop
->
children
[
pos
]);
}
in
t
get_loop_element_pos
(
const
ir_loop
*
loop
,
void
*
le
)
size_
t
get_loop_element_pos
(
const
ir_loop
*
loop
,
void
*
le
)
{
int
i
,
n
;
size_t
n
;
size_t
i
;
assert
(
loop
&&
loop
->
kind
==
k_ir_loop
);
n
=
get_loop_n_elements
(
loop
);
for
(
i
=
0
;
i
<
n
;
i
++
)
if
(
get_loop_element
(
loop
,
i
).
node
==
le
)
return
i
;
return
-
1
;
return
(
size_t
)
-
1
;
}
...
...
@@ -197,13 +194,13 @@ ir_loop *(get_irn_loop)(const ir_node *n)
return
_get_irn_loop
(
n
);
}
int
get_loop_loop_nr
(
const
ir_loop
*
loop
)
long
get_loop_loop_nr
(
const
ir_loop
*
loop
)
{
assert
(
loop
&&
loop
->
kind
==
k_ir_loop
);
#ifdef DEBUG_libfirm
return
loop
->
loop_nr
;
#else
return
(
int
)
loop
;
return
(
long
)
loop
;
#endif
}
...
...
ir/ana/irloop_t.h
View file @
0a4048fb
...
...
@@ -61,17 +61,17 @@ typedef enum loop_flags {
* nodes in the loop.
*/
struct
ir_loop
{
firm_kind
kind
;
/**< A type tag, set to k_ir_loop. */
int
depth
;
/**< Nesting depth */
int
n_sons
;
/**< Number of ir_nodes in array "children" */
int
n_nodes
;
/**< Number of loop_nodes in array "children" */
unsigned
flags
;
/**< a set of loop_flags_t */
firm_kind
kind
;
/**< A type tag, set to k_ir_loop. */
unsigned
depth
;
/**< Nesting depth */
size_t
n_sons
;
/**< Number of ir_nodes in array "children" */
size_t
n_nodes
;
/**< Number of loop_nodes in array "children" */
unsigned
flags
;
/**< a set of loop_flags_t */
struct
ir_loop
*
outer_loop
;
/**< The outer loop */
loop_element
*
children
;
/**< Mixed flexible array: Contains sons and loop_nodes */
ir_tarval
*
loop_iter_start
;
/**< counting loop: the start value */
ir_tarval
*
loop_iter_end
;
/**< counting loop: the last value reached */
ir_tarval
*
loop_iter_increment
;
/**< counting loop: the increment */
ir_node
*
loop_iter_variable
;
/**< The iteration variable of counting loop.*/
ir_tarval
*
loop_iter_start
;
/**< counting loop: the start value */
ir_tarval
*
loop_iter_end
;
/**< counting loop: the last value reached */
ir_tarval
*
loop_iter_increment
;
/**< counting loop: the increment */
ir_node
*
loop_iter_variable
;
/**< The iteration variable of counting loop.*/
void
*
link
;
/**< link field. */
#ifdef DEBUG_libfirm
...
...
@@ -129,13 +129,13 @@ static inline ir_loop *_get_loop_outer_loop(const ir_loop *loop)
return
loop
->
outer_loop
;
}
static
inline
int
_get_loop_depth
(
const
ir_loop
*
loop
)
static
inline
unsigned
_get_loop_depth
(
const
ir_loop
*
loop
)
{
assert
(
_is_ir_loop
(
loop
));
return
loop
->
depth
;
}
static
inline
in
t
_get_loop_n_sons
(
const
ir_loop
*
loop
)
static
inline
size_
t
_get_loop_n_sons
(
const
ir_loop
*
loop
)
{
assert
(
_is_ir_loop
(
loop
));
return
loop
->
n_sons
;
...
...
ir/ana/irscc.c
View file @
0a4048fb
...
...
@@ -58,7 +58,7 @@ static int loop_node_cnt = 0;
/** Counter to generate depth first numbering of visited nodes. */
static
int
current_dfn
=
1
;
static
int
max_loop_depth
=
0
;
static
unsigned
max_loop_depth
=
0
;
void
link_to_reg_end
(
ir_node
*
n
,
void
*
env
);
void
set_projx_link
(
ir_node
*
cb_projx
,
ir_node
*
end_projx
);
...
...
@@ -824,7 +824,7 @@ void free_loop_information(ir_graph *irg)
void
free_all_loop_information
(
void
)
{
in
t
i
;
size_
t
i
;
for
(
i
=
0
;
i
<
get_irp_n_irgs
();
i
++
)
{
free_loop_information
(
get_irp_irg
(
i
));
}
...
...
ir/be/beabi.c
View file @
0a4048fb
...
...
@@ -363,6 +363,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
int
*
reg_param_idxs
;
int
*
stack_param_idx
;
int
i
,
n
,
destroy_all_regs
;
size_t
s
;
dbg_info
*
dbgi
;
/* Let the isa fill out the abi description for that call node. */
...
...
@@ -580,8 +581,8 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
}
/* add state registers ins */
for
(
i
=
0
;
i
<
ARR_LEN
(
states
);
++
i
)
{
const
arch_register_t
*
reg
=
states
[
i
];
for
(
s
=
0
;
s
<
ARR_LEN
(
states
);
++
s
)
{
const
arch_register_t
*
reg
=
states
[
s
];
const
arch_register_class_t
*
cls
=
arch_register_get_class
(
reg
);
#if 0
ir_node *regnode = be_abi_reg_map_get(env->regs, reg);
...
...
@@ -697,6 +698,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
{
ir_node
**
in
,
*
keep
;
int
i
;
size_t
d
;
int
n
=
0
;
int
curr_res_proj
=
pn_be_Call_first_res
+
n_reg_results
;
int
n_ins
;
...
...
@@ -708,8 +710,8 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
set_irn_link
(
curr_sp
,
(
void
*
)
sp
);
in
[
n
++
]
=
curr_sp
;
for
(
i
=
0
;
i
<
ARR_LEN
(
destroyed_regs
);
++
i
)
{
const
arch_register_t
*
reg
=
destroyed_regs
[
i
];
for
(
d
=
0
;
d
<
ARR_LEN
(
destroyed_regs
);
++
d
)
{
const
arch_register_t
*
reg
=
destroyed_regs
[
d
];
ir_node
*
proj
=
new_r_Proj
(
low_call
,
reg
->
reg_class
->
mode
,
curr_res_proj
);
/* memorize the register in the link field. we need afterwards to set the register class of the keep correctly. */
...
...
ir/be/beabihelper.c
View file @
0a4048fb
...
...
@@ -52,7 +52,7 @@ typedef struct reg_flag_t {
*/
typedef
struct
register_state_mapping_t
{
ir_node
**
value_map
;
/**< mapping of state indices to values */
int
**
reg_index_map
;
/**< mapping of regclass,regnum to an index
size_t
**
reg_index_map
;
/**< mapping of regclass,regnum to an index
into the value_map */
reg_flag_t
*
regs
;
/**< registers (and memory values) that form a
state */
...
...
@@ -90,15 +90,15 @@ static void prepare_rsm(register_state_mapping_t *rsm,
ARR_APP1
(
reg_flag_t
,
rsm
->
regs
,
memory
);
rsm
->
value_map
=
NULL
;
rsm
->
reg_index_map
=
XMALLOCN
(
in
t
*
,
n_reg_classes
);
rsm
->
reg_index_map
=
XMALLOCN
(
size_
t
*
,
n_reg_classes
);
for
(
c
=
0
;
c
<
n_reg_classes
;
++
c
)
{
const
arch_register_class_t
*
cls
=
&
arch_env
->
register_classes
[
c
];
unsigned
n_regs
=
arch_register_class_n_regs
(
cls
);
unsigned
r
;
rsm
->
reg_index_map
[
c
]
=
XMALLOCN
(
in
t
,
n_regs
);
rsm
->
reg_index_map
[
c
]
=
XMALLOCN
(
size_
t
,
n_regs
);
for
(
r
=
0
;
r
<
n_regs
;
++
r
)
{
rsm
->
reg_index_map
[
c
][
r
]
=
-
1
;
rsm
->
reg_index_map
[
c
][
r
]
=
(
size_t
)
-
1
;
}
}
}
...
...
@@ -150,7 +150,7 @@ static void rsm_clear_regs(register_state_mapping_t *rsm,
unsigned
r
;
for
(
r
=
0
;
r
<
n_regs
;
++
r
)
{
rsm
->
reg_index_map
[
c
][
r
]
=
-
1
;
rsm
->
reg_index_map
[
c
][
r
]
=
(
size_t
)
-
1
;
}
}
ARR_RESIZE
(
reg_flag_t
,
rsm
->
regs
,
0
);
...
...
@@ -170,13 +170,13 @@ static int rsm_add_reg(register_state_mapping_t *rsm,
const
arch_register_t
*
reg
,
arch_register_req_type_t
flags
)
{
int
input_idx
=
ARR_LEN
(
rsm
->
regs
);
size_t
input_idx
=
ARR_LEN
(
rsm
->
regs
);
int
cls_idx
=
reg
->
reg_class
->
index
;
int
reg_idx
=
reg
->
index
;
reg_flag_t
regflag
=
{
reg
,
flags
};
/* we must not have used get_value yet */
assert
(
rsm
->
reg_index_map
[
cls_idx
][
reg_idx
]
==
-
1
);
assert
(
rsm
->
reg_index_map
[
cls_idx
][
reg_idx
]
==
(
size_t
)
-
1
);
rsm
->
reg_index_map
[
cls_idx
][
reg_idx
]
=
input_idx
;
ARR_APP1
(
reg_flag_t
,
rsm
->
regs
,
regflag
);
...
...
@@ -190,9 +190,9 @@ static int rsm_add_reg(register_state_mapping_t *rsm,
/**
* Retrieve the ir_node stored at the given index in the register state map.
*/
static
ir_node
*
rsm_get_value
(
register_state_mapping_t
*
rsm
,
in
t
index
)
static
ir_node
*
rsm_get_value
(
register_state_mapping_t
*
rsm
,
size_
t
index
)
{
assert
(
0
<=
index
&&
index
<
ARR_LEN
(
rsm
->
value_map
));
assert
(
index
<
ARR_LEN
(
rsm
->
value_map
));
return
rsm
->
value_map
[
index
];
}
...
...
@@ -202,9 +202,9 @@ static ir_node *rsm_get_value(register_state_mapping_t *rsm, int index)
static
ir_node
*
rsm_get_reg_value
(
register_state_mapping_t
*
rsm
,
const
arch_register_t
*
reg
)
{
int
cls_idx
=
reg
->
reg_class
->
index
;
int
reg_idx
=
reg
->
index
;
in
t
input_idx
=
rsm
->
reg_index_map
[
cls_idx
][
reg_idx
];
int
cls_idx
=
reg
->
reg_class
->
index
;
int
reg_idx
=
reg
->
index
;
size_
t
input_idx
=
rsm
->
reg_index_map
[
cls_idx
][
reg_idx
];
return
rsm_get_value
(
rsm
,
input_idx
);
}
...
...
@@ -212,10 +212,10 @@ static ir_node *rsm_get_reg_value(register_state_mapping_t *rsm,
/**
* Enter a ir_node at the given index in the register state map.
*/
static
void
rsm_set_value
(
register_state_mapping_t
*
rsm
,
in
t
index
,
static
void
rsm_set_value
(
register_state_mapping_t
*
rsm
,
size_
t
index
,
ir_node
*
value
)
{
assert
(
0
<=
index
&&
index
<
ARR_LEN
(
rsm
->
value_map
));
assert
(
index
<
ARR_LEN
(
rsm
->
value_map
));
rsm
->
value_map
[
index
]
=
value
;
}
...
...
@@ -225,9 +225,9 @@ static void rsm_set_value(register_state_mapping_t *rsm, int index,
static
void
rsm_set_reg_value
(
register_state_mapping_t
*
rsm
,
const
arch_register_t
*
reg
,
ir_node
*
value
)
{
int
cls_idx
=
reg
->
reg_class
->
index
;
int
reg_idx
=
reg
->
index
;
in
t
input_idx
=
rsm
->
reg_index_map
[
cls_idx
][
reg_idx
];
int
cls_idx
=
reg
->
reg_class
->
index
;
int
reg_idx
=
reg
->
index
;
size_
t
input_idx
=
rsm
->
reg_index_map
[
cls_idx
][
reg_idx
];
rsm_set_value
(
rsm
,
input_idx
,
value
);
}
...
...
ir/be/beinfo.c