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
e293c971
Commit
e293c971
authored
Feb 13, 2016
by
Matthias Braun
Browse files
Rename get_type_{size|alignment}_bytes() to get_type{size|alignment}()
parent
002cc34b
Changes
34
Show whitespace changes
Inline
Side-by-side
ir/be/sparc/sparc_finish.c
View file @
e293c971
...
...
@@ -151,7 +151,7 @@ static void introduce_epilog(ir_node *ret)
kill_unused_stacknodes
(
sp
);
}
else
{
ir_type
*
const
frame_type
=
get_irg_frame_type
(
irg
);
unsigned
const
frame_size
=
get_type_size
_bytes
(
frame_type
);
unsigned
const
frame_size
=
get_type_size
(
frame_type
);
ir_node
*
const
incsp
=
be_new_IncSP
(
sp_reg
,
block
,
sp
,
-
frame_size
,
0
);
set_irn_n
(
ret
,
n_sparc_Return_sp
,
incsp
);
sched_add_before
(
ret
,
incsp
);
...
...
@@ -166,7 +166,7 @@ static void sparc_introduce_prolog_epilog(ir_graph *irg)
ir_node
*
block
=
get_nodes_block
(
start
);
ir_node
*
initial_sp
=
be_get_Start_proj
(
irg
,
sp_reg
);
ir_type
*
frame_type
=
get_irg_frame_type
(
irg
);
unsigned
frame_size
=
get_type_size
_bytes
(
frame_type
);
unsigned
frame_size
=
get_type_size
(
frame_type
);
/* introduce epilog for every return node */
foreach_irn_in
(
get_irg_end_block
(
irg
),
i
,
ret
)
{
...
...
ir/be/sparc/sparc_stackframe.c
View file @
e293c971
...
...
@@ -274,7 +274,7 @@ static ir_type *compute_arg_type(ir_graph *irg, calling_convention_t *cconv,
va_start_entity
=
NULL
;
}
set_type_size
_bytes
(
res
,
cconv
->
param_stack_size
);
set_type_size
(
res
,
cconv
->
param_stack_size
);
return
res
;
}
...
...
@@ -291,9 +291,9 @@ void sparc_create_stacklayout(ir_graph *irg, calling_convention_t *cconv)
ir_type
*
between_type
=
new_type_class
(
new_id_from_str
(
"sparc_between_type"
));
if
(
cconv
->
omit_fp
)
{
set_type_size
_bytes
(
between_type
,
0
);
set_type_size
(
between_type
,
0
);
}
else
{
set_type_size
_bytes
(
between_type
,
SPARC_MIN_STACKSIZE
);
set_type_size
(
between_type
,
SPARC_MIN_STACKSIZE
);
}
layout
->
frame_type
=
get_irg_frame_type
(
irg
);
...
...
@@ -334,11 +334,11 @@ void sparc_adjust_stack_entity_offsets(ir_graph *irg)
* low address |-----------------------------|
*/
ir_type
*
between_type
=
layout
->
between_type
;
unsigned
between_size
=
get_type_size
_bytes
(
between_type
);
unsigned
between_size
=
get_type_size
(
between_type
);
ir_type
*
frame_type
=
get_irg_frame_type
(
irg
);
unsigned
frame_size
=
get_type_size
_bytes
(
frame_type
);
unsigned
frame_align
=
get_type_alignment
_bytes
(
frame_type
);
unsigned
frame_size
=
get_type_size
(
frame_type
);
unsigned
frame_align
=
get_type_alignment
(
frame_type
);
/* There's the tricky case of the stackframe size not being a multiple
* of the alignment. There are 2 variants:
...
...
@@ -356,7 +356,7 @@ void sparc_adjust_stack_entity_offsets(ir_graph *irg)
unsigned
misalign
=
(
SPARC_MIN_STACKSIZE
+
frame_size
)
%
frame_align
;
frame_size
+=
misalign
;
}
set_type_size
_bytes
(
frame_type
,
frame_size
);
set_type_size
(
frame_type
,
frame_size
);
ir_type
*
arg_type
=
layout
->
arg_type
;
...
...
ir/ir/irdumptxt.c
View file @
e293c971
...
...
@@ -776,8 +776,8 @@ void dump_type_to_file(FILE *const F, const ir_type *const tp)
dump_type_details
(
F
,
tp
);
fprintf
(
F
,
" state: %s,
\n
"
,
get_type_state_name
(
get_type_state
(
tp
)));
fprintf
(
F
,
" size: %2u Bytes,
\n
"
,
get_type_size
_bytes
(
tp
));
fprintf
(
F
,
" alignment: %2u Bytes,
\n
"
,
get_type_alignment
_bytes
((
ir_type
*
)
tp
));
fprintf
(
F
,
" size: %2u Bytes,
\n
"
,
get_type_size
(
tp
));
fprintf
(
F
,
" alignment: %2u Bytes,
\n
"
,
get_type_alignment
(
tp
));
if
(
is_atomic_type
(
tp
)
||
is_Method_type
(
tp
))
fprintf
(
F
,
" mode: %s,
\n
"
,
get_mode_name
(
get_type_mode
(
tp
)));
...
...
ir/ir/irio.c
View file @
e293c971
...
...
@@ -518,8 +518,8 @@ static void write_type_common(write_env_t *env, ir_type *tp)
write_symbol
(
env
,
"type"
);
write_long
(
env
,
get_type_nr
(
tp
));
write_symbol
(
env
,
get_type_opcode_name
(
get_type_opcode
(
tp
)));
write_unsigned
(
env
,
get_type_size
_bytes
(
tp
));
write_unsigned
(
env
,
get_type_alignment
_bytes
(
tp
));
write_unsigned
(
env
,
get_type_size
(
tp
));
write_unsigned
(
env
,
get_type_alignment
(
tp
));
write_type_state
(
env
,
get_type_state
(
tp
));
write_unsigned
(
env
,
tp
->
flags
);
}
...
...
@@ -1616,7 +1616,7 @@ static void read_type(read_env_t *env)
set_array_size_int
(
type
,
size
);
}
obstack_free
(
&
env
->
obst
,
str
);
set_type_size
_bytes
(
type
,
size
);
set_type_size
(
type
,
size
);
goto
finish_type
;
}
...
...
@@ -1627,7 +1627,7 @@ static void read_type(read_env_t *env)
type
=
get_glob_type
();
else
type
=
new_type_class
(
id
);
set_type_size
_bytes
(
type
,
size
);
set_type_size
(
type
,
size
);
goto
finish_type
;
}
...
...
@@ -1670,21 +1670,21 @@ static void read_type(read_env_t *env)
case
tpo_primitive
:
{
ir_mode
*
mode
=
read_mode_ref
(
env
);
type
=
new_type_primitive
(
mode
);
set_type_size
_bytes
(
type
,
size
);
set_type_size
(
type
,
size
);
goto
finish_type
;
}
case
tpo_struct
:
{
ident
*
id
=
read_ident_null
(
env
);
type
=
new_type_struct
(
id
);
set_type_size
_bytes
(
type
,
size
);
set_type_size
(
type
,
size
);
goto
finish_type
;
}
case
tpo_union
:
{
ident
*
id
=
read_ident_null
(
env
);
type
=
new_type_union
(
id
);
set_type_size
_bytes
(
type
,
size
);
set_type_size
(
type
,
size
);
goto
finish_type
;
}
...
...
@@ -1706,7 +1706,7 @@ static void read_type(read_env_t *env)
finish_type:
if
(
align
>
0
)
set_type_alignment
_bytes
(
type
,
align
);
set_type_alignment
(
type
,
align
);
type
->
flags
=
flags
;
if
(
state
==
layout_fixed
)
...
...
ir/ir/irprofile.c
View file @
e293c971
...
...
@@ -186,7 +186,7 @@ static ir_graph *gen_initializer_irg(ir_entity *ent_filename, ir_entity *bblock_
ir_graph
*
const
irg
=
new_ir_graph
(
ent
,
0
);
ir_type
*
const
empty_frame_type
=
get_irg_frame_type
(
irg
);
set_type_size
_bytes
(
empty_frame_type
,
0
);
set_type_size
(
empty_frame_type
,
0
);
set_type_state
(
empty_frame_type
,
layout_fixed
);
ir_node
*
const
bb
=
get_r_cur_block
(
irg
);
...
...
@@ -358,12 +358,10 @@ static void instrument_irg(ir_graph *irg, ir_entity *counters, block_id_walker_d
static
ir_entity
*
new_array_entity
(
ident
*
name
,
int
size
)
{
ir_type
*
const
uint_type
=
new_type_primitive
(
mode_Iu
);
set_type_alignment_bytes
(
uint_type
,
get_type_size_bytes
(
uint_type
));
ir_type
*
const
array_type
=
new_type_array
(
uint_type
);
set_array_size_int
(
array_type
,
size
);
set_type_size_bytes
(
array_type
,
size
*
get_mode_size_bytes
(
mode_Iu
));
set_type_alignment_bytes
(
array_type
,
get_mode_size_bytes
(
mode_Iu
));
set_type_size
(
array_type
,
size
*
get_mode_size_bytes
(
mode_Iu
));
set_type_state
(
array_type
,
layout_fixed
);
ir_entity
*
const
result
=
new_entity
(
get_glob_type
(),
name
,
array_type
);
...
...
@@ -384,8 +382,7 @@ static ir_entity *new_static_string_entity(ident *name, const char *string)
/* Create the type for a fixed-length string */
set_array_size_int
(
string_type
,
length
);
set_type_size_bytes
(
string_type
,
length
);
set_type_alignment_bytes
(
string_type
,
1
);
set_type_size
(
string_type
,
length
);
set_type_state
(
string_type
,
layout_fixed
);
ir_entity
*
const
result
=
new_entity
(
get_glob_type
(),
name
,
string_type
);
...
...
ir/lower/lower_builtins.c
View file @
e293c971
...
...
@@ -53,7 +53,7 @@ static const char *get_builtin_name(ir_builtin_kind kind)
static
const
char
*
get_gcc_machmode
(
ir_type
*
type
)
{
assert
(
is_Primitive_type
(
type
));
switch
(
get_type_size
_bytes
(
type
))
{
switch
(
get_type_size
(
type
))
{
case
4
:
return
"si"
;
case
8
:
return
"di"
;
default:
...
...
@@ -71,7 +71,7 @@ static void widen_builtin(ir_node *node)
ir_type
*
arg1
=
get_method_param_type
(
mtp
,
0
);
// Nothing to do, if argument size is at least machine size.
if
(
8
*
get_type_size
_bytes
(
arg1
)
>=
be_get_machine_size
())
{
if
(
8
*
get_type_size
(
arg1
)
>=
be_get_machine_size
())
{
return
;
}
...
...
ir/lower/lower_copyb.c
View file @
e293c971
...
...
@@ -56,9 +56,9 @@ static void lower_small_copyb_node(ir_node *irn)
ir_node
*
addr_dst
=
get_CopyB_dst
(
irn
);
ir_node
*
mem
=
get_CopyB_mem
(
irn
);
ir_mode
*
mode_ref
=
get_irn_mode
(
addr_src
);
unsigned
mode_bytes
=
allow_misalignments
?
native_mode_bytes
:
get_type_alignment
_bytes
(
tp
);
unsigned
size
=
get_type_size
_bytes
(
tp
);
unsigned
mode_bytes
=
allow_misalignments
?
native_mode_bytes
:
get_type_alignment
(
tp
);
unsigned
size
=
get_type_size
(
tp
);
unsigned
offset
=
0
;
while
(
offset
<
size
)
{
...
...
@@ -126,7 +126,7 @@ static void lower_large_copyb_node(ir_node *irn)
ir_node
*
addr_src
=
get_CopyB_src
(
irn
);
ir_node
*
addr_dst
=
get_CopyB_dst
(
irn
);
ir_type
*
copyb_tp
=
get_CopyB_type
(
irn
);
unsigned
size
=
get_type_size
_bytes
(
copyb_tp
);
unsigned
size
=
get_type_size
(
copyb_tp
);
ir_node
*
callee
=
get_memcpy_address
(
irg
);
ir_type
*
call_tp
=
get_memcpy_methodtype
();
...
...
@@ -142,7 +142,7 @@ static void lower_large_copyb_node(ir_node *irn)
static
void
lower_copyb_node
(
ir_node
*
irn
)
{
ir_type
*
tp
=
get_CopyB_type
(
irn
);
unsigned
size
=
get_type_size
_bytes
(
tp
);
unsigned
size
=
get_type_size
(
tp
);
if
(
size
<=
max_small_size
)
lower_small_copyb_node
(
irn
);
...
...
@@ -164,7 +164,7 @@ static void find_copyb_nodes(ir_node *irn, void *ctx)
if
(
get_type_state
(
tp
)
!=
layout_fixed
)
return
;
unsigned
size
=
get_type_size
_bytes
(
tp
);
unsigned
size
=
get_type_size
(
tp
);
bool
medium_sized
=
max_small_size
<
size
&&
size
<
min_large_size
;
if
(
medium_sized
)
return
;
/* Nothing to do for medium-sized CopyBs. */
...
...
ir/lower/lower_hl.c
View file @
e293c971
...
...
@@ -27,7 +27,7 @@ static void lower_sel(ir_node *sel)
ir_node
*
const
ptr
=
get_Sel_ptr
(
sel
);
ir_type
*
const
type
=
get_Sel_type
(
sel
);
ir_type
*
const
element_type
=
get_array_element_type
(
type
);
unsigned
const
element_size
=
get_type_size
_bytes
(
element_type
);
unsigned
const
element_size
=
get_type_size
(
element_type
);
ir_node
*
newn
;
if
(
element_size
==
0
)
{
...
...
@@ -119,7 +119,7 @@ static void lower_align(ir_node *const align)
ir_type
*
const
tp
=
get_Align_type
(
align
);
assert
(
get_type_state
(
tp
)
==
layout_fixed
);
/* rewrite the Align node by a Const node */
replace_by_Const
(
align
,
get_type_alignment
_bytes
(
tp
));
replace_by_Const
(
align
,
get_type_alignment
(
tp
));
}
/**
...
...
@@ -130,7 +130,7 @@ static void lower_size(ir_node *const size)
ir_type
*
const
tp
=
get_Size_type
(
size
);
assert
(
get_type_state
(
tp
)
==
layout_fixed
);
/* rewrite the Size node by a Const node */
replace_by_Const
(
size
,
get_type_size
_bytes
(
tp
));
replace_by_Const
(
size
,
get_type_size
(
tp
));
}
/**
...
...
ir/opt/iropt.c
View file @
e293c971
...
...
@@ -264,7 +264,7 @@ static ir_tarval *computed_value_Align(const ir_node *n)
{
ir_type
const
*
const
type
=
get_Align_type
(
n
);
if
(
get_type_state
(
type
)
==
layout_fixed
)
return
new_tarval_from_long
(
get_type_alignment
_bytes
(
type
),
get_irn_mode
(
n
));
return
new_tarval_from_long
(
get_type_alignment
(
type
),
get_irn_mode
(
n
));
return
tarval_unknown
;
}
...
...
@@ -275,7 +275,7 @@ static ir_tarval *computed_value_Size(const ir_node *n)
{
ir_type
const
*
const
type
=
get_Size_type
(
n
);
if
(
get_type_state
(
type
)
==
layout_fixed
)
return
new_tarval_from_long
(
get_type_size
_bytes
(
type
),
get_irn_mode
(
n
));
return
new_tarval_from_long
(
get_type_size
(
type
),
get_irn_mode
(
n
));
return
tarval_unknown
;
}
...
...
@@ -7113,7 +7113,7 @@ static bool sim_store_bitfield(unsigned char *buf, ir_mode *mode, long offset,
ir_tarval
*
masked_value
=
tarval_and
(
shifted_value
,
mask
);
unsigned
mode_size
=
get_mode_size_bytes
(
mode
);
unsigned
initializer_size
=
get_type_size
_bytes
(
type
);
unsigned
initializer_size
=
get_type_size
(
type
);
for
(
unsigned
b
=
(
unsigned
)
MAX
(
0
,
offset
);
b
<
initializer_size
;
++
b
)
{
if
(
b
>
(
unsigned
)
offset
+
mode_size
)
continue
;
...
...
@@ -7134,7 +7134,7 @@ static bool sim_store(unsigned char *buf, ir_mode *mode, long offset,
unsigned
mode_size
=
get_mode_size_bytes
(
mode
);
if
(
offset
+
(
int
)
mode_size
<=
0
)
return
true
;
unsigned
initializer_size
=
get_type_size
_bytes
(
type
);
unsigned
initializer_size
=
get_type_size
(
type
);
assert
(
initializer_size
>
0
);
if
(
offset
>=
(
long
)
initializer_size
)
return
true
;
...
...
@@ -7168,7 +7168,7 @@ handle_tv:
case
IR_INITIALIZER_COMPOUND
:
if
(
is_Array_type
(
type
))
{
ir_type
*
el_type
=
get_array_element_type
(
type
);
unsigned
el_size
=
get_type_size
_bytes
(
el_type
);
unsigned
el_size
=
get_type_size
(
el_type
);
assert
(
el_size
>
0
);
long
offset0
=
MAX
(
0
,
offset
);
size_t
first_idx
=
(
size_t
)
((
unsigned
)
offset0
/
el_size
);
...
...
@@ -7197,7 +7197,7 @@ handle_tv:
const
ir_type
*
member_type
=
get_entity_type
(
member
);
int
member_offs
=
get_entity_offset
(
member
);
if
(
member_offs
>=
offset
+
(
long
)
get_mode_size_bytes
(
mode
)
||
offset
>=
member_offs
+
(
long
)
get_type_size
_bytes
(
member_type
))
||
offset
>=
member_offs
+
(
long
)
get_type_size
(
member_type
))
continue
;
if
(
i
>
get_initializer_compound_n_entries
(
initializer
))
continue
;
...
...
@@ -7260,7 +7260,7 @@ static ir_node *extract_from_initializer(const ir_type *type,
{
if
(
offset
<
0
)
return
NULL
;
unsigned
size
=
get_type_size
_bytes
(
type
);
unsigned
size
=
get_type_size
(
type
);
if
((
unsigned
long
)
offset
>=
size
)
return
NULL
;
...
...
@@ -7310,7 +7310,7 @@ handle_tv:;
case
IR_INITIALIZER_COMPOUND
:
{
if
(
is_Array_type
(
type
))
{
ir_type
*
el_type
=
get_array_element_type
(
type
);
unsigned
el_size
=
get_type_size
_bytes
(
el_type
);
unsigned
el_size
=
get_type_size
(
el_type
);
assert
(
el_size
>
0
);
unsigned
idx
=
(
unsigned
)
offset
/
el_size
;
if
((
size_t
)
idx
>=
get_initializer_compound_n_entries
(
initializer
))
...
...
@@ -7329,7 +7329,7 @@ handle_tv:;
const
ir_type
*
member_type
=
get_entity_type
(
member
);
int
member_offs
=
get_entity_offset
(
member
);
if
(
member_offs
>=
offset
+
(
long
)
get_mode_size_bytes
(
mode
)
||
offset
>=
member_offs
+
(
long
)
get_type_size
_bytes
(
member_type
))
||
offset
>=
member_offs
+
(
long
)
get_type_size
(
member_type
))
continue
;
if
(
get_entity_bitfield_size
(
member
)
>
0
)
return
NULL
;
...
...
ir/opt/ldstopt.c
View file @
e293c971
...
...
@@ -341,7 +341,7 @@ static void get_base_and_offset(ir_node *ptr, base_offset_t *base_offset)
break
;
/* TODO: may overflow here */
int
size
=
get_type_size
_bytes
(
element_type
);
int
size
=
get_type_size
(
element_type
);
offset
+=
size
*
get_Const_long
(
index
);
ptr
=
get_Sel_ptr
(
ptr
);
}
else
if
(
is_Member
(
ptr
))
{
...
...
@@ -581,7 +581,7 @@ static bool try_update_ptr_CopyB(track_load_env_t *env, ir_node *copyb)
return
false
;
ir_type
*
copyb_type
=
get_CopyB_type
(
copyb
);
long
n_copy
=
get_type_size
_bytes
(
copyb_type
);
long
n_copy
=
get_type_size
(
copyb_type
);
ir_node
*
copyb_src
=
get_CopyB_src
(
copyb
);
base_offset_t
src_base_offset
;
get_base_and_offset
(
copyb_src
,
&
src_base_offset
);
...
...
@@ -693,7 +693,7 @@ static changes_t follow_load_mem_chain(track_load_env_t *env, ir_node *start)
/* check aliasing with the CopyB */
ir_node
*
dst
=
get_CopyB_dst
(
node
);
ir_type
*
type
=
get_CopyB_type
(
node
);
unsigned
size
=
get_type_size
_bytes
(
type
);
unsigned
size
=
get_type_size
(
type
);
ir_alias_relation
rel
=
get_alias_relation
(
dst
,
type
,
size
,
env
->
ptr
,
load_type
,
load_size
);
...
...
@@ -937,7 +937,7 @@ static changes_t follow_store_mem_chain(ir_node *store, ir_node *start,
}
else
if
(
is_CopyB
(
node
))
{
ir_node
*
copyb_src
=
get_CopyB_src
(
node
);
ir_type
*
copyb_type
=
get_CopyB_type
(
node
);
unsigned
copyb_size
=
get_type_size
_bytes
(
copyb_type
);
unsigned
copyb_size
=
get_type_size
(
copyb_type
);
ir_alias_relation
src_rel
=
get_alias_relation
(
copyb_src
,
copyb_type
,
copyb_size
,
ptr
,
type
,
size
);
...
...
@@ -1039,8 +1039,8 @@ static bool ptr_is_in_struct(ir_node *ptr, ir_type *ptr_type,
long
ptr_offset
=
base_offset
.
offset
;
base_offset_t
struct_offset
;
get_base_and_offset
(
struct_ptr
,
&
struct_offset
);
unsigned
ptr_size
=
get_type_size
_bytes
(
ptr_type
);
unsigned
struct_size
=
get_type_size
_bytes
(
struct_type
);
unsigned
ptr_size
=
get_type_size
(
ptr_type
);
unsigned
struct_size
=
get_type_size
(
struct_type
);
return
base_offset
.
base
==
struct_offset
.
base
&&
ptr_offset
>=
struct_offset
.
offset
&&
...
...
@@ -1063,7 +1063,7 @@ static changes_t follow_copyb_mem_chain(ir_node *copyb, ir_node *start,
ir_node
*
src
=
get_CopyB_src
(
copyb
);
ir_node
*
dst
=
get_CopyB_dst
(
copyb
);
ir_type
*
type
=
get_CopyB_type
(
copyb
);
unsigned
size
=
get_type_size
_bytes
(
type
);
unsigned
size
=
get_type_size
(
type
);
ir_node
*
block
=
get_nodes_block
(
copyb
);
ir_node
*
node
=
start
;
...
...
@@ -1130,7 +1130,7 @@ static changes_t follow_copyb_mem_chain(ir_node *copyb, ir_node *start,
ir_node
*
pred_dst
=
get_CopyB_dst
(
node
);
ir_node
*
pred_src
=
get_CopyB_src
(
node
);
ir_type
*
pred_type
=
get_CopyB_type
(
node
);
unsigned
pred_size
=
get_type_size
_bytes
(
pred_type
);
unsigned
pred_size
=
get_type_size
(
pred_type
);
if
(
src
==
pred_dst
&&
size
==
pred_size
&&
get_CopyB_volatility
(
node
)
==
volatility_non_volatile
)
{
...
...
ir/opt/opt_ldst.c
View file @
e293c971
...
...
@@ -926,8 +926,8 @@ static void kill_memops(const value_t *value)
ir_type
*
op_type
=
get_type_for_mode
(
op
->
value
.
mode
);
/* TODO: determining the access size by the type of the accessed objects
* is too conservative... */
unsigned
value_size
=
get_type_size
_bytes
(
value_type
);
unsigned
op_size
=
get_type_size
_bytes
(
op_type
);
unsigned
value_size
=
get_type_size
(
value_type
);
unsigned
op_size
=
get_type_size
(
op_type
);
if
(
ir_no_alias
!=
get_alias_relation
(
value
->
address
,
value_type
,
value_size
,
op
->
value
.
address
,
op_type
,
op_size
))
{
...
...
ir/opt/parallelize_mem.c
View file @
e293c971
...
...
@@ -82,7 +82,7 @@ static void parallelize_load(parallelize_info *pi, ir_node *irn)
ir_node
*
org_ptr
=
pi
->
origin_ptr
;
ir_type
*
copyB_type
=
get_CopyB_type
(
irn
);
ir_node
*
copyB_dst
=
get_CopyB_dst
(
irn
);
unsigned
copyB_size
=
get_type_size
_bytes
(
copyB_type
);
unsigned
copyB_size
=
get_type_size
(
copyB_type
);
if
(
get_alias_relation
(
org_ptr
,
org_type
,
org_size
,
copyB_dst
,
copyB_type
,
copyB_size
)
==
ir_no_alias
)
{
ir_node
*
mem
=
get_CopyB_mem
(
irn
);
...
...
@@ -151,7 +151,7 @@ static void parallelize_store(parallelize_info *pi, ir_node *irn)
ir_node
*
copyB_src
=
get_CopyB_src
(
irn
);
ir_node
*
copyB_dst
=
get_CopyB_dst
(
irn
);
ir_type
*
copyB_type
=
get_CopyB_type
(
irn
);
unsigned
copyB_size
=
get_type_size
_bytes
(
copyB_type
);
unsigned
copyB_size
=
get_type_size
(
copyB_type
);
if
(
get_alias_relation
(
org_ptr
,
org_type
,
org_size
,
copyB_src
,
copyB_type
,
copyB_size
)
==
ir_no_alias
&&
get_alias_relation
(
org_ptr
,
org_type
,
org_size
,
...
...
@@ -226,7 +226,7 @@ static void parallelize_copyB(parallelize_info *pi, ir_node *origin, ir_node *ir
ir_node
*
copyB_src
=
get_CopyB_src
(
irn
);
ir_node
*
copyB_dst
=
get_CopyB_dst
(
irn
);
ir_type
*
copyB_type
=
get_CopyB_type
(
irn
);
unsigned
copyB_size
=
get_type_size
_bytes
(
copyB_type
);
unsigned
copyB_size
=
get_type_size
(
copyB_type
);
if
(
get_alias_relation
(
org_src
,
org_type
,
org_size
,
copyB_dst
,
copyB_type
,
copyB_size
)
==
ir_no_alias
&&
get_alias_relation
(
org_dst
,
org_type
,
org_size
,
...
...
@@ -297,7 +297,7 @@ static void walker(ir_node *proj, void *env)
pi
.
origin_block
=
block
;
pi
.
origin_type
=
get_CopyB_type
(
mem_op
);
pi
.
origin_size
=
get_type_size
_bytes
(
pi
.
origin_type
);
pi
.
origin_size
=
get_type_size
(
pi
.
origin_type
);
/* parallelize_copyB uses the node itself, because the
* information does not fit in a parallelize_info. */
ir_nodeset_init
(
&
pi
.
this_mem
);
...
...
ir/tr/type.c
View file @
e293c971
...
...
@@ -219,9 +219,9 @@ long get_type_nr(const ir_type *tp)
return
tp
->
nr
;
}
unsigned
(
get_type_size
_bytes
)(
const
ir_type
*
tp
)
unsigned
(
get_type_size
)(
const
ir_type
*
tp
)
{
return
get_type_size_
bytes_
(
tp
);
return
get_type_size_
(
tp
);
}
ir_visibility
get_type_visibility
(
const
ir_type
*
tp
)
...
...
@@ -236,17 +236,17 @@ void set_type_visibility(ir_type *tp, ir_visibility v)
tp
->
visibility
=
v
;
}
void
set_type_size
_bytes
(
ir_type
*
tp
,
unsigned
size
)
void
set_type_size
(
ir_type
*
tp
,
unsigned
size
)
{
tp
->
size
=
size
;
}
unsigned
(
get_type_alignment
_bytes
)(
const
ir_type
*
type
)
unsigned
(
get_type_alignment
)(
const
ir_type
*
type
)
{
return
get_type_alignment_
bytes_
(
type
);
return
get_type_alignment_
(
type
);
}
void
set_type_alignment
_bytes
(
ir_type
*
type
,
unsigned
align
)
void
set_type_alignment
(
ir_type
*
type
,
unsigned
align
)
{
assert
(
is_type
(
type
));
assert
(
align
>
0
);
...
...
@@ -570,7 +570,7 @@ ir_type *new_type_method(size_t n_param, size_t n_res)
res
->
attr
.
method
.
res_type
=
XMALLOCNZ
(
ir_type
*
,
n_res
);
res
->
attr
.
method
.
variadic
=
false
;
res
->
attr
.
method
.
properties
=
mtp_no_property
;
set_type_alignment
_bytes
(
res
,
1
);
set_type_alignment
(
res
,
1
);
hook_new_type
(
res
);
return
res
;
}
...
...
@@ -597,7 +597,7 @@ ir_type *clone_type_method(ir_type *tp)
res
->
attr
.
method
.
variadic
=
tp
->
attr
.
method
.
variadic
;
res
->
attr
.
method
.
properties
=
tp
->
attr
.
method
.
properties
;
res
->
attr
.
method
.
irg_calling_conv
=
tp
->
attr
.
method
.
irg_calling_conv
;
set_type_alignment
_bytes
(
res
,
get_type_alignment
_bytes
(
tp
));
set_type_alignment
(
res
,
get_type_alignment
(
tp
));
hook_new_type
(
res
);
return
res
;
}
...
...
@@ -779,7 +779,7 @@ ir_type *new_type_array(ir_type *element_type)
ir_type
*
res
=
new_type
(
tpo_array
,
sizeof
(
array_attr
),
NULL
);
res
->
attr
.
array
.
element_type
=
element_type
;
res
->
attr
.
array
.
size
=
new_r_Unknown
(
get_const_code_irg
(),
mode_Iu
);
set_type_alignment
_bytes
(
res
,
get_type_alignment
_bytes
(
element_type
));
set_type_alignment
(
res
,
get_type_alignment
(
element_type
));
hook_new_type
(
res
);
return
res
;
...
...
@@ -822,7 +822,7 @@ void set_array_element_type(ir_type *array, ir_type *tp)
assert
(
is_Array_type
(
array
));
assert
(
!
is_Method_type
(
tp
));
array
->
attr
.
array
.
element_type
=
tp
;
set_type_alignment
_bytes
(
array
,
get_type_alignment
_bytes
(
tp
));
set_type_alignment
(
array
,
get_type_alignment
(
tp
));
}
ir_type
*
get_array_element_type
(
const
ir_type
*
array
)
...
...
@@ -858,7 +858,7 @@ ir_type *new_type_pointer(ir_type *points_to)
unsigned
size
=
get_mode_size_bytes
(
mode
);
res
->
size
=
size
;
res
->
flags
|=
tf_layout_fixed
;
set_type_alignment
_bytes
(
res
,
size
);
set_type_alignment
(
res
,
size
);
hook_new_type
(
res
);
return
res
;
}
...
...
@@ -900,7 +900,7 @@ ir_type *new_type_primitive(ir_mode *mode)
ir_type
*
res
=
new_type
(
tpo_primitive
,
0
,
mode
);
res
->
size
=
size
;
res
->
flags
|=
tf_layout_fixed
;
set_type_alignment
_bytes
(
res
,
align
);
set_type_alignment
(
res
,
align
);
hook_new_type
(
res
);
return
res
;
}
...
...
@@ -1063,12 +1063,12 @@ void default_layout_compound_type(ir_type *type)
unsigned
entity_size
;
if
(
i
+
1
<
n
||
!
var_size
)
{
assert
(
get_type_state
(
entity_type
)
==
layout_fixed
);
entity_size
=
get_type_size
_bytes
(
entity_type
);
entity_size
=
get_type_size
(
entity_type
);
}
else
{
entity_size
=
0
;
}
unsigned
const
align
=
get_type_alignment
_bytes
(
entity_type
);
unsigned
const
align
=
get_type_alignment
(
entity_type
);
align_all
=
MAX
(
align
,
align_all
);
unsigned
offset
;
...
...
@@ -1090,8 +1090,8 @@ void default_layout_compound_type(ir_type *type)
if
(
align_all
>
0
&&
size
%
align_all
)
{
size
+=
align_all
-
(
size
%
align_all
);
}
set_type_alignment
_bytes
(
type
,
align_all
);
set_type_size
_bytes
(
type
,
size
);
set_type_alignment
(
type
,
align_all
);
set_type_size
(
type
,
size
);
set_type_state
(
type
,
layout_fixed
);
}
...
...
@@ -1102,7 +1102,7 @@ ir_entity *frame_alloc_area(ir_type *frame_type, int size, unsigned alignment,
assert
(
is_frame_type
(
frame_type
));
assert
(
get_type_state
(
frame_type
)
==
layout_fixed
);
assert
(
get_type_alignment
_bytes
(
frame_type
)
>
0
);
assert
(
get_type_alignment
(
frame_type
)
>
0
);
set_type_state
(
frame_type
,
layout_undefined
);
if
(
irp
->
byte_type
==
NULL
)
...
...
@@ -1112,11 +1112,11 @@ ir_entity *frame_alloc_area(ir_type *frame_type, int size, unsigned alignment,
ir_type
*
tp
=
new_type_array
(
irp
->
byte_type
);
set_array_size_int
(
tp
,
size
);
set_type_alignment
_bytes
(
tp
,
alignment
);
set_type_size
_bytes
(
tp
,
size
);
set_type_alignment
(
tp
,
alignment
);
set_type_size
(
tp
,
size
);
unsigned
frame_size
=
get_type_size
_bytes
(
frame_type
);
unsigned
frame_align
=
get_type_alignment
_bytes
(
frame_type
);
unsigned
frame_size
=
get_type_size
(
frame_type
);
unsigned
frame_align
=
get_type_alignment
(
frame_type
);
int
offset
;
if
(
at_start
)
{
unsigned
delta
=
round_up2
(
size
,
frame_align
);
...
...
@@ -1138,9 +1138,9 @@ ir_entity *frame_alloc_area(ir_type *frame_type, int size, unsigned alignment,
ir_entity
*
area
=
new_entity
(
frame_type
,
name
,
tp
);
set_entity_visibility
(
area
,
ir_visibility_private
);
set_entity_offset
(
area
,
offset
);
set_type_size
_bytes
(
frame_type
,
frame_size
);
set_type_size
(
frame_type
,
frame_size
);
if
(
alignment
>
frame_align
)
{
set_type_alignment
_bytes
(
frame_type
,
alignment
);
set_type_alignment
(
frame_type
,
alignment
);
}
set_type_state
(
frame_type
,
layout_fixed
);
...
...
ir/tr/type_t.h
View file @
e293c971
...
...
@@ -23,8 +23,8 @@
#define set_type_link(tp, l) set_type_link_(tp, l)
#define get_type_opcode(tp) get_type_opcode_(tp)
#define get_type_mode(tp) get_type_mode_(tp)
#define get_type_alignment
_bytes(tp)
get_type_alignment_
bytes_
(tp)
#define get_type_size
_bytes(tp)
get_type_size_
bytes_
(tp)
#define get_type_alignment
(tp)
get_type_alignment_(tp)
#define get_type_size
(tp)
get_type_size_(tp)
#define get_type_state(tp) get_type_state_(tp)
#define get_type_visited(tp) get_type_visited_(tp)
#define set_type_visited(tp, num) set_type_visited_(tp, num)
...
...
@@ -217,13 +217,13 @@ static inline ir_mode *get_type_mode_(const ir_type *tp)
return
tp
->
mode
;
}
static
inline
unsigned
get_type_alignment_
bytes_
(
const
ir_type
*
type
)
static
inline
unsigned
get_type_alignment_
(
const
ir_type
*
type
)
{
assert
(
type
->
kind
==
k_type
);
return
type
->
align
;
}
static
inline
unsigned
get_type_size_
bytes_
(
const
ir_type
*
tp
)
static
inline
unsigned
get_type_size_
(
const
ir_type
*
tp
)
{
assert
(
tp
->
kind
==
k_type
);
return
tp
->
size
;
...
...
Prev
1
2
Next
Write
Preview