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
ebada0c7
Commit
ebada0c7
authored
Nov 22, 2007
by
Matthias Braun
Browse files
change color handling in dumper, tweak colors
[r16828]
parent
23db8a3e
Changes
8
Hide whitespace changes
Inline
Side-by-side
include/libfirm/irdump.h
View file @
ebada0c7
...
...
@@ -45,44 +45,22 @@
#include "irgraph.h"
#include "irloop.h"
/**
* Names of the 32 supported colors
*/
typedef
enum
{
ird_color_default
=
-
1
,
ird_color_white
=
0
,
ird_color_blue
=
1
,
ird_color_red
=
2
,
ird_color_green
=
3
,
ird_color_yellow
=
4
,
ird_color_magenta
=
5
,
ird_color_cyan
=
6
,
ird_color_darkgray
=
7
,
ird_color_darkblue
=
8
,
ird_color_darkred
=
9
,
ird_color_darkgreen
=
10
,
ird_color_darkyellow
=
11
,
ird_color_darkmagenta
=
12
,
ird_color_darkcyan
=
13
,
ird_color_gold
=
14
,
ird_color_lightgray
=
15
,
ird_color_lightblue
=
16
,
ird_color_lightred
=
17
,
ird_color_lightgreen
=
18
,
ird_color_lightyellow
=
19
,
ird_color_lightmagenta
=
20
,
ird_color_lightcyan
=
21
,
ird_color_lilac
=
22
,
ird_color_turquoise
=
23
,
ird_color_aquamarine
=
24
,
ird_color_khaki
=
25
,
ird_color_purple
=
26
,
ird_color_yellowgreen
=
27
,
ird_color_pink
=
28
,
ird_color_orange
=
29
,
ird_color_orchid
=
30
,
ird_color_black
=
31
}
dumper_colors
;
typedef
enum
ird_color_t
{
ird_color_prog_background
,
ird_color_block_background
,
ird_color_dead_block_background
,
ird_color_block_inout
,
ird_color_default_node
,
ird_color_phi
,
ird_color_memory
,
ird_color_controlflow
,
ird_color_const
,
ird_color_anchor
,
ird_color_proj
,
ird_color_side_effects
,
ird_color_error
,
ird_color_count
}
ird_color_t
;
/**
* Edge kinds
...
...
include/libfirm/irop.h
View file @
ebada0c7
...
...
@@ -70,9 +70,10 @@ typedef enum {
irop_flag_always_opt
=
0x00000100
,
/**< This operation must always be optimized .*/
irop_flag_keep
=
0x00000200
,
/**< This operation can be kept in End's keep-alive list. */
irop_flag_start_block
=
0x00000400
,
/**< This operation is always placed in the Start block. */
irop_flag_machine
=
0x00000800
,
/**< This operation is a machine operation. */
irop_flag_machine_op
=
0x00001000
,
/**< This operation is a machine operand. */
irop_flag_user
=
0x00002000
/**< This flag and all higher ones are free for machine user. */
irop_flag_side_effect
=
0x00000800
,
/**< this operation produces side effects */
irop_flag_machine
=
0x00001000
,
/**< This operation is a machine operation. */
irop_flag_machine_op
=
0x00002000
,
/**< This operation is a machine operand. */
irop_flag_user
=
0x00004000
/**< This flag and all higher ones are free for machine user. */
}
irop_flags
;
/** The opcodes of the libFirm predefined operations. */
...
...
ir/ana/irscc.c
View file @
ebada0c7
...
...
@@ -44,11 +44,10 @@
#include "irgraph_t.h"
#include "irnode_t.h"
#include "irgwalk.h"
#include "irdump.h"
#include "array.h"
#include "pmap.h"
#include "irdump.h"
/* A variant of the loop tree that avoids loops without head.
This reduces the depth of the loop tree. */
#define NO_LOOPS_WITHOUT_HEAD 1
...
...
ir/be/benode.c
View file @
ebada0c7
...
...
@@ -55,6 +55,7 @@
#include "belive_t.h"
#include "besched_t.h"
#include "benode_t.h"
#include "bearch_t.h"
#include "beirgmod.h"
...
...
@@ -146,6 +147,7 @@ static const ir_op_ops be_node_op_ops;
#define c irop_flag_constlike
#define K irop_flag_keep
#define M irop_flag_machine
#define E irop_flag_side_effect
/**
...
...
@@ -270,7 +272,7 @@ void be_node_init(void) {
op_be_Copy
=
new_ir_op
(
beo_base
+
beo_Copy
,
"be_Copy"
,
op_pin_state_floats
,
N
,
oparity_unary
,
0
,
sizeof
(
be_node_attr_t
),
&
be_node_op_ops
);
op_be_Keep
=
new_ir_op
(
beo_base
+
beo_Keep
,
"be_Keep"
,
op_pin_state_pinned
,
K
,
oparity_dynamic
,
0
,
sizeof
(
be_node_attr_t
),
&
be_node_op_ops
);
op_be_CopyKeep
=
new_ir_op
(
beo_base
+
beo_CopyKeep
,
"be_CopyKeep"
,
op_pin_state_pinned
,
K
,
oparity_variable
,
0
,
sizeof
(
be_node_attr_t
),
&
be_node_op_ops
);
op_be_Call
=
new_ir_op
(
beo_base
+
beo_Call
,
"be_Call"
,
op_pin_state_pinned
,
F
,
oparity_variable
,
0
,
sizeof
(
be_call_attr_t
),
&
be_node_op_ops
);
op_be_Call
=
new_ir_op
(
beo_base
+
beo_Call
,
"be_Call"
,
op_pin_state_pinned
,
F
|
E
,
oparity_variable
,
0
,
sizeof
(
be_call_attr_t
),
&
be_node_op_ops
);
op_be_Return
=
new_ir_op
(
beo_base
+
beo_Return
,
"be_Return"
,
op_pin_state_pinned
,
X
,
oparity_dynamic
,
0
,
sizeof
(
be_return_attr_t
),
&
be_node_op_ops
);
op_be_AddSP
=
new_ir_op
(
beo_base
+
beo_AddSP
,
"be_AddSP"
,
op_pin_state_pinned
,
N
,
oparity_unary
,
0
,
sizeof
(
be_node_attr_t
),
&
be_node_op_ops
);
op_be_SubSP
=
new_ir_op
(
beo_base
+
beo_SubSP
,
"be_SubSP"
,
op_pin_state_pinned
,
N
,
oparity_unary
,
0
,
sizeof
(
be_node_attr_t
),
&
be_node_op_ops
);
...
...
ir/ir/irdump.c
View file @
ebada0c7
...
...
@@ -75,10 +75,6 @@ typedef unsigned long SeqNo;
extern
SeqNo
get_Block_seqno
(
ir_node
*
n
);
#endif
/* basis for a color range for vcg */
static
int
n_colors
=
0
;
static
int
base_color
=
0
;
/** Dump only irgs with names that start with this string */
static
ident
*
dump_file_filter_id
=
NULL
;
...
...
@@ -111,7 +107,7 @@ int dump_dominator_information_flag = 0;
int
opt_dump_analysed_type_info
=
1
;
int
opt_dump_pointer_values_to_info
=
0
;
/* default off: for test compares!! */
static
dumper
_color
s
overrule_nodecolor
=
ird_color_default
;
static
ird
_color
_t
overrule_nodecolor
=
ird_color_default
_node
;
/** The vcg node attribute hook. */
static
DUMP_IR_GRAPH_FUNC
dump_ir_graph_hook
=
NULL
;
...
...
@@ -274,23 +270,59 @@ const char *get_type_name_ex(ir_type *tp, int *bad) {
return
ERROR_TXT
;
}
#define CUSTOM_COLOR_BASE 100
static
const
char
*
color_names
[
ird_color_count
];
static
const
char
*
color_rgb
[
ird_color_count
];
static
struct
obstack
color_obst
;
static
void
custom_color
(
int
num
,
const
char
*
rgb_def
)
{
assert
(
num
<
ird_color_count
);
obstack_printf
(
&
color_obst
,
"%d"
,
CUSTOM_COLOR_BASE
+
num
);
obstack_1grow
(
&
color_obst
,
'\0'
);
color_rgb
[
num
]
=
rgb_def
;
color_names
[
num
]
=
obstack_finish
(
&
color_obst
);
}
static
void
named_color
(
int
num
,
const
char
*
name
)
{
assert
(
num
<
ird_color_count
);
color_rgb
[
num
]
=
NULL
;
color_names
[
num
]
=
name
;
}
static
void
init_colors
(
void
)
{
static
int
initialized
=
0
;
if
(
initialized
)
return
;
obstack_init
(
&
color_obst
);
custom_color
(
ird_color_prog_background
,
"204 204 204"
);
custom_color
(
ird_color_block_background
,
"255 255 0"
);
custom_color
(
ird_color_dead_block_background
,
"190 150 150"
);
named_color
(
ird_color_block_inout
,
"lightblue"
);
named_color
(
ird_color_default_node
,
"white"
);
custom_color
(
ird_color_memory
,
"153 153 255"
);
custom_color
(
ird_color_controlflow
,
"255 153 153"
);
custom_color
(
ird_color_const
,
"204 255 255"
);
custom_color
(
ird_color_proj
,
"255 255 153"
);
custom_color
(
ird_color_side_effects
,
"153 153 255"
);
custom_color
(
ird_color_phi
,
"105 255 105"
);
custom_color
(
ird_color_anchor
,
"100 100 255"
);
named_color
(
ird_color_error
,
"red"
);
initialized
=
1
;
}
/**
* printf the VCG color to a file
*/
static
void
print_vcg_color
(
FILE
*
F
,
dumper_colors
color
)
{
static
const
char
*
color_names
[
32
]
=
{
"white"
,
"blue"
,
"red"
,
"green"
,
"yellow"
,
"magenta"
,
"cyan"
,
"darkgray"
,
"darkblue"
,
"darkred"
,
"darkgreen"
,
"darkyellow"
,
"darkmagenta"
,
"darkcyan"
,
"gold"
,
"lightgray"
,
"lightblue"
,
"lightred"
,
"lightgreen"
,
"lightyellow"
,
"lightmagenta"
,
"lightcyan"
,
"lilac"
,
"turquoise"
,
"aquamarine"
,
"khaki"
,
"purple"
,
"yellowgreen"
,
"pink"
,
"orange"
,
"orchid"
,
"black"
};
if
(
color
!=
ird_color_default
)
fprintf
(
F
,
"color:%s"
,
color_names
[
color
]);
static
void
print_vcg_color
(
FILE
*
F
,
ird_color_t
color
)
{
assert
(
color
<
ird_color_count
);
fprintf
(
F
,
"color:%s"
,
color_names
[
color
]);
}
/**
...
...
@@ -1160,17 +1192,17 @@ int dump_node_label(FILE *F, ir_node *n) {
return
bad
;
}
/**
* Dumps the attributes of a node n into the file F.
* Currently this is only the color of a node.
*/
static
void
dump_node_vcgattr
(
FILE
*
F
,
ir_node
*
node
,
ir_node
*
local
,
int
bad
)
{
ir_mode
*
mode
;
ir_node
*
n
;
if
(
bad
)
{
print_vcg_color
(
F
,
ird_color_
red
);
print_vcg_color
(
F
,
ird_color_
error
);
return
;
}
...
...
@@ -1180,47 +1212,63 @@ static void dump_node_vcgattr(FILE *F, ir_node *node, ir_node *local, int bad)
n
=
local
?
local
:
node
;
if
(
overrule_nodecolor
!=
ird_color_default
)
{
if
(
overrule_nodecolor
!=
ird_color_default
_node
)
{
print_vcg_color
(
F
,
overrule_nodecolor
);
return
;
}
mode
=
get_irn_mode
(
node
);
if
(
mode
==
mode_M
)
{
print_vcg_color
(
F
,
ird_color_memory
);
return
;
}
if
(
mode
==
mode_X
)
{
print_vcg_color
(
F
,
ird_color_controlflow
);
return
;
}
switch
(
get_irn_opcode
(
n
))
{
case
iro_Start
:
case
iro_EndReg
:
/* fall through */
case
iro_EndExcept
:
/* fall through */
case
iro_End
:
print_vcg_color
(
F
,
ird_color_blue
);
print_vcg_color
(
F
,
ird_color_anchor
);
break
;
case
iro_Bad
:
print_vcg_color
(
F
,
ird_color_error
);
break
;
case
iro_Block
:
if
(
is_Block_dead
(
n
))
print_vcg_color
(
F
,
ird_color_
lightre
d
);
print_vcg_color
(
F
,
ird_color_
dead_block_backgroun
d
);
else
print_vcg_color
(
F
,
ird_color_
lightyellow
);
print_vcg_color
(
F
,
ird_color_
block_background
);
break
;
case
iro_Phi
:
print_vcg_color
(
F
,
ird_color_green
);
break
;
case
iro_Mux
:
case
iro_Psi
:
print_vcg_color
(
F
,
ird_color_gold
);
print_vcg_color
(
F
,
ird_color_phi
);
break
;
case
iro_Pin
:
print_vcg_color
(
F
,
ird_color_
orchid
);
print_vcg_color
(
F
,
ird_color_
memory
);
break
;
case
iro_SymConst
:
case
iro_Const
:
case
iro_Proj
:
case
iro_Filter
:
case
iro_Tuple
:
print_vcg_color
(
F
,
ird_color_yellow
);
print_vcg_color
(
F
,
ird_color_const
);
break
;
case
iro_
ASM
:
print_vcg_color
(
F
,
ird_color_
darkyellow
);
case
iro_
Proj
:
print_vcg_color
(
F
,
ird_color_
proj
);
break
;
default:
PRINT_DEFAULT_NODE_ATTR
;
default:
{
ir_op
*
op
=
get_irn_op
(
node
);
if
(
is_op_constlike
(
op
))
{
print_vcg_color
(
F
,
ird_color_const
);
}
else
if
(
is_op_side_effects
(
op
))
{
print_vcg_color
(
F
,
ird_color_side_effects
);
}
else
if
(
is_op_cfopcode
(
op
)
||
is_op_forking
(
op
))
{
print_vcg_color
(
F
,
ird_color_controlflow
);
}
else
{
PRINT_DEFAULT_NODE_ATTR
;
}
}
}
}
...
...
@@ -1265,13 +1313,10 @@ static INLINE int dump_node_info(FILE *F, ir_node *n)
return
bad
;
}
/**
* checks whether a node is "constant-like" ie can be treated "block-less"
*/
static
INLINE
int
is_constlike_node
(
ir_node
*
n
)
{
ir_opcode
code
=
get_irn_opcode
(
n
);
return
(
code
==
iro_Const
||
code
==
iro_Bad
||
code
==
iro_NoMem
||
code
==
iro_SymConst
||
code
==
iro_Unknown
);
static
INLINE
int
is_constlike_node
(
const
ir_node
*
node
)
{
const
ir_op
*
op
=
get_irn_op
(
node
);
return
is_op_constlike
(
op
);
}
...
...
@@ -1633,10 +1678,9 @@ static void dump_const_expression(FILE *F, ir_node *value) {
* Expects to find nodes belonging to the block as list in its
* link field.
* Dumps the edges of all nodes including itself. */
static
void
dump_whole_block
(
FILE
*
F
,
ir_node
*
block
)
{
static
void
dump_whole_block
(
FILE
*
F
,
ir_node
*
block
)
{
ir_node
*
node
;
dumper
_color
s
color
=
ird_color_
yellow
;
ird
_color
_t
color
=
ird_color_
block_background
;
assert
(
is_Block
(
block
));
...
...
@@ -1651,9 +1695,9 @@ dump_whole_block(FILE *F, ir_node *block) {
/* colorize blocks */
if
(
!
get_Block_matured
(
block
))
color
=
ird_color_
re
d
;
color
=
ird_color_
block_backgroun
d
;
if
(
is_Block_dead
(
block
))
color
=
ird_color_
orange
;
color
=
ird_color_
dead_block_background
;
fprintf
(
F
,
"
\"
status:clustered "
);
print_vcg_color
(
F
,
color
);
...
...
@@ -1735,8 +1779,8 @@ static void dump_graph_from_list(FILE *F, ir_graph *irg) {
fprintf
(
F
,
"graph: { title:
\"
"
);
PRINT_IRGID
(
irg
);
fprintf
(
F
,
"
\"
label:
\"
%s
\"
status:clustered color:
white
\n
"
,
get_ent_dump_name
(
ent
));
fprintf
(
F
,
"
\"
label:
\"
%s
\"
status:clustered color:
%s
\n
"
,
get_ent_dump_name
(
ent
)
,
color_names
[
ird_color_prog_background
]
);
dump_graph_info
(
F
,
irg
);
print_dbg_info
(
F
,
get_entity_dbg_info
(
ent
));
...
...
@@ -2226,8 +2270,11 @@ void dump_loop_nodes_into_graph(FILE *F, ir_graph *irg) {
* dumps the VCG header
*/
void
dump_vcg_header
(
FILE
*
F
,
const
char
*
name
,
const
char
*
orientation
)
{
int
i
;
char
*
label
;
init_colors
();
if
(
edge_label
)
{
label
=
"yes"
;
}
else
{
...
...
@@ -2270,39 +2317,11 @@ void dump_vcg_header(FILE *F, const char *name, const char *orientation) {
"infoname 3:
\"
Debug info
\"\n
"
,
name
,
label
,
orientation
);
/* don't use all, the range is too wide. */
n_colors
=
18
;
base_color
=
105
;
fprintf
(
F
,
"colorentry 100: 0 0 0
\n
"
"colorentry 101: 20 0 0
\n
"
"colorentry 102: 40 0 0
\n
"
"colorentry 103: 60 0 0
\n
"
"colorentry 104: 80 0 0
\n
"
"colorentry 105: 100 0 0
\n
"
"colorentry 106: 120 0 0
\n
"
"colorentry 107: 140 0 0
\n
"
"colorentry 108: 150 0 0
\n
"
"colorentry 109: 180 0 0
\n
"
"colorentry 110: 200 0 0
\n
"
"colorentry 111: 220 0 0
\n
"
"colorentry 112: 240 0 0
\n
"
"colorentry 113: 255 0 0
\n
"
"colorentry 113: 255 20 20
\n
"
"colorentry 114: 255 40 40
\n
"
"colorentry 115: 255 60 60
\n
"
"colorentry 116: 255 80 80
\n
"
"colorentry 117: 255 100 100
\n
"
"colorentry 118: 255 120 120
\n
"
"colorentry 119: 255 140 140
\n
"
"colorentry 120: 255 150 150
\n
"
"colorentry 121: 255 180 180
\n
"
"colorentry 122: 255 200 200
\n
"
"colorentry 123: 255 220 220
\n
"
"colorentry 124: 255 240 240
\n
"
"colorentry 125: 255 250 250
\n
"
);
for
(
i
=
0
;
i
<
ird_color_count
;
++
i
)
{
if
(
color_rgb
[
i
]
!=
NULL
)
{
fprintf
(
F
,
"colorentry %s: %s
\n
"
,
color_names
[
i
],
color_rgb
[
i
]);
}
}
fprintf
(
F
,
"
\n
"
);
/* a separator */
}
...
...
@@ -2798,54 +2817,6 @@ void dump_subgraph(ir_node *root, int depth, const char *suffix) {
}
}
#if 0
static int weight_overall(int rec, int loop) {
return 2*rec + loop;
}
static int compute_color(int my, int max) {
int color;
if (!max) {
color = 0;
} else {
int step;
/* if small, scale to the full color range. */
if (max < n_colors)
my = my * (n_colors/max);
step = 1 + (max / n_colors);
color = my/step;
}
return base_color + n_colors - color;
}
/**
* Calculate a entity color depending on it's execution propability.
*/
static int get_entity_color(ir_entity *ent) {
ir_graph *irg = get_entity_irg(ent);
assert(irg);
{
int rec_depth = get_irg_recursion_depth(irg);
int loop_depth = get_irg_loop_depth(irg);
int overall_depth = weight_overall(rec_depth, loop_depth);
int max_rec_depth = irp->max_callgraph_recursion_depth;
int max_loop_depth = irp->max_callgraph_loop_depth;
int max_overall_depth = weight_overall(max_rec_depth, max_loop_depth);
/* int my_rec_color = compute_color(rec_depth, max_rec_depth); */
/* int my_loop_color = compute_color(loop_depth, max_loop_depth); */
int my_overall_color = compute_color(overall_depth, max_overall_depth);
return my_overall_color;
}
}
#endif
#ifdef INTERPROCEDURAL_VIEW
void
dump_callgraph
(
const
char
*
suffix
)
{
FILE
*
F
=
vcg_open_name
(
"Callgraph"
,
suffix
);
...
...
@@ -3207,9 +3178,9 @@ void dump_loop(ir_loop *l, const char *suffix) {
/* dump the nodes that go into the block */
for
(
n
=
get_irn_link
(
b
);
n
;
n
=
get_irn_link
(
n
))
{
if
(
eset_contains
(
extnodes
,
n
))
overrule_nodecolor
=
ird_color_
lightblue
;
overrule_nodecolor
=
ird_color_
block_inout
;
dump_node
(
F
,
n
);
overrule_nodecolor
=
ird_color_default
;
overrule_nodecolor
=
ird_color_default
_node
;
if
(
!
eset_contains
(
extnodes
,
n
))
dump_ir_data_edges
(
F
,
n
);
}
...
...
@@ -3231,9 +3202,9 @@ void dump_loop(ir_loop *l, const char *suffix) {
/* dump the nodes that go into the block */
for
(
n
=
get_irn_link
(
b
);
n
;
n
=
get_irn_link
(
n
))
{
if
(
!
eset_contains
(
loopnodes
,
n
))
overrule_nodecolor
=
ird_color_
lightblue
;
overrule_nodecolor
=
ird_color_
block_inout
;
dump_node
(
F
,
n
);
overrule_nodecolor
=
ird_color_default
;
overrule_nodecolor
=
ird_color_default
_node
;
if
(
eset_contains
(
loopnodes
,
n
))
dump_ir_data_edges
(
F
,
n
);
}
...
...
ir/ir/irnode.c
View file @
ebada0c7
...
...
@@ -2847,9 +2847,8 @@ int
}
/* Returns true if the operation manipulates control flow. */
int
is_cfop
(
const
ir_node
*
node
)
{
return
is_cfopcode
(
get_irn_op
(
node
));
int
is_cfop
(
const
ir_node
*
node
)
{
return
is_op_cfopcode
(
get_irn_op
(
node
));
}
/* Returns true if the operation manipulates interprocedural control flow:
...
...
ir/ir/irop.c
View file @
ebada0c7
...
...
@@ -283,6 +283,7 @@ init_op(void)
#define c irop_flag_constlike
#define K irop_flag_keep
#define S irop_flag_start_block
#define E irop_flag_side_effect
/* Caution: A great deal of Firm optimizations depend an right operations flags. */
op_Block
=
new_ir_op
(
iro_Block
,
"Block"
,
op_pin_state_pinned
,
L
,
oparity_variable
,
-
1
,
sizeof
(
block_attr
),
NULL
);
...
...
@@ -299,7 +300,7 @@ init_op(void)
op_Sel
=
new_ir_op
(
iro_Sel
,
"Sel"
,
op_pin_state_floats
,
H
,
oparity_any
,
-
1
,
sizeof
(
sel_attr
),
NULL
);
op_Call
=
new_ir_op
(
iro_Call
,
"Call"
,
op_pin_state_mem_pinned
,
F
,
oparity_variable
,
-
1
,
sizeof
(
call_attr
),
NULL
);
op_Call
=
new_ir_op
(
iro_Call
,
"Call"
,
op_pin_state_mem_pinned
,
F
|
E
,
oparity_variable
,
-
1
,
sizeof
(
call_attr
),
NULL
);
op_Add
=
new_ir_op
(
iro_Add
,
"Add"
,
op_pin_state_floats
,
C
,
oparity_binary
,
0
,
0
,
NULL
);
op_Sub
=
new_ir_op
(
iro_Sub
,
"Sub"
,
op_pin_state_floats
,
N
,
oparity_binary
,
0
,
0
,
NULL
);
op_Minus
=
new_ir_op
(
iro_Minus
,
"Minus"
,
op_pin_state_floats
,
N
,
oparity_unary
,
0
,
0
,
NULL
);
...
...
@@ -326,10 +327,10 @@ init_op(void)
op_Phi
=
new_ir_op
(
iro_Phi
,
"Phi"
,
op_pin_state_pinned
,
N
,
oparity_variable
,
-
1
,
sizeof
(
phi0_attr
),
NULL
);
op_Load
=
new_ir_op
(
iro_Load
,
"Load"
,
op_pin_state_exc_pinned
,
F
,
oparity_any
,
-
1
,
sizeof
(
load_attr
),
NULL
);
op_Store
=
new_ir_op
(
iro_Store
,
"Store"
,
op_pin_state_exc_pinned
,
F
,
oparity_any
,
-
1
,
sizeof
(
store_attr
),
NULL
);
op_Alloc
=
new_ir_op
(
iro_Alloc
,
"Alloc"
,
op_pin_state_pinned
,
F
,
oparity_any
,
-
1
,
sizeof
(
alloc_attr
),
NULL
);
op_Free
=
new_ir_op
(
iro_Free
,
"Free"
,
op_pin_state_pinned
,
N
,
oparity_any
,
-
1
,
sizeof
(
free_attr
),
NULL
);
op_Load
=
new_ir_op
(
iro_Load
,
"Load"
,
op_pin_state_exc_pinned
,
F
|
E
,
oparity_any
,
-
1
,
sizeof
(
load_attr
),
NULL
);
op_Store
=
new_ir_op
(
iro_Store
,
"Store"
,
op_pin_state_exc_pinned
,
F
|
E
,
oparity_any
,
-
1
,
sizeof
(
store_attr
),
NULL
);
op_Alloc
=
new_ir_op
(
iro_Alloc
,
"Alloc"
,
op_pin_state_pinned
,
F
|
E
,
oparity_any
,
-
1
,
sizeof
(
alloc_attr
),
NULL
);
op_Free
=
new_ir_op
(
iro_Free
,
"Free"
,
op_pin_state_pinned
,
N
|
E
,
oparity_any
,
-
1
,
sizeof
(
free_attr
),
NULL
);
op_Sync
=
new_ir_op
(
iro_Sync
,
"Sync"
,
op_pin_state_pinned
,
N
,
oparity_dynamic
,
-
1
,
0
,
NULL
);
op_Proj
=
new_ir_op
(
iro_Proj
,
"Proj"
,
op_pin_state_floats
,
N
,
oparity_unary
,
-
1
,
sizeof
(
long
),
NULL
);
...
...
@@ -338,7 +339,7 @@ init_op(void)
op_Bad
=
new_ir_op
(
iro_Bad
,
"Bad"
,
op_pin_state_pinned
,
X
|
F
|
S
,
oparity_zero
,
-
1
,
0
,
NULL
);
op_Confirm
=
new_ir_op
(
iro_Confirm
,
"Confirm"
,
op_pin_state_pinned
,
H
,
oparity_any
,
-
1
,
sizeof
(
confirm_attr
),
NULL
);
op_Unknown
=
new_ir_op
(
iro_Unknown
,
"Unknown"
,
op_pin_state_pinned
,
X
|
F
|
S
,
oparity_zero
,
-
1
,
0
,
NULL
);
op_Unknown
=
new_ir_op
(
iro_Unknown
,
"Unknown"
,
op_pin_state_pinned
,
X
|
F
|
S
|
c
,
oparity_zero
,
-
1
,
0
,
NULL
);
op_Filter
=
new_ir_op
(
iro_Filter
,
"Filter"
,
op_pin_state_pinned
,
N
,
oparity_variable
,
-
1
,
sizeof
(
filter_attr
),
NULL
);
op_Break
=
new_ir_op
(
iro_Break
,
"Break"
,
op_pin_state_pinned
,
X
,
oparity_zero
,
-
1
,
0
,
NULL
);
op_CallBegin
=
new_ir_op
(
iro_CallBegin
,
"CallBegin"
,
op_pin_state_pinned
,
X
|
I
,
oparity_any
,
-
1
,
sizeof
(
callbegin_attr
),
NULL
);
...
...
@@ -348,7 +349,7 @@ init_op(void)
op_NoMem
=
new_ir_op
(
iro_NoMem
,
"NoMem"
,
op_pin_state_pinned
,
N
,
oparity_zero
,
-
1
,
0
,
NULL
);
op_Mux
=
new_ir_op
(
iro_Mux
,
"Mux"
,
op_pin_state_floats
,
N
,
oparity_trinary
,
-
1
,
0
,
NULL
);
op_Psi
=
new_ir_op
(
iro_Psi
,
"Psi"
,
op_pin_state_floats
,
N
,
oparity_variable
,
-
1
,
0
,
NULL
);
op_CopyB
=
new_ir_op
(
iro_CopyB
,
"CopyB"
,
op_pin_state_mem_pinned
,
F
|
H
,
oparity_trinary
,
-
1
,
sizeof
(
copyb_attr
),
NULL
);
op_CopyB
=
new_ir_op
(
iro_CopyB
,
"CopyB"
,
op_pin_state_mem_pinned
,
F
|
H
|
E
,
oparity_trinary
,
-
1
,
sizeof
(
copyb_attr
),
NULL
);
op_InstOf
=
new_ir_op
(
iro_InstOf
,
"InstOf"
,
op_pin_state_mem_pinned
,
H
,
oparity_unary
,
-
1
,
sizeof
(
io_attr
),
NULL
);
op_Raise
=
new_ir_op
(
iro_Raise
,
"Raise"
,
op_pin_state_pinned
,
H
|
X
,
oparity_any
,
-
1
,
0
,
NULL
);
...
...
@@ -356,8 +357,7 @@ init_op(void)
op_Pin
=
new_ir_op
(
iro_Pin
,
"Pin"
,
op_pin_state_pinned
,
H
,
oparity_unary
,
-
1
,
0
,
NULL
);
/* HMM: may contain branches so X|Y */
op_ASM
=
new_ir_op
(
iro_ASM
,
"ASM"
,
op_pin_state_mem_pinned
,
K
|
X
|
Y
,
oparity_variable
,
-
1
,
sizeof
(
asm_attr
),
NULL
);
op_ASM
=
new_ir_op
(
iro_ASM
,
"ASM"
,
op_pin_state_mem_pinned
,
K
|
E
,
oparity_variable
,
-
1
,
sizeof
(
asm_attr
),
NULL
);
op_Anchor
=
new_ir_op
(
iro_Anchor
,
"Anchor"
,
op_pin_state_pinned
,
N
,
oparity_variable
,
-
1
,
0
,
NULL
);
...
...
@@ -369,6 +369,7 @@ init_op(void)
#undef X
#undef C
#undef L
#undef E
}
/* init_op */
...
...
@@ -479,7 +480,7 @@ op_pin_state (get_op_pinned)(const ir_op *op) {
/* Sets op_pin_state_pinned in the opcode. Setting it to floating has no effect
for Phi, Block and control flow nodes. */
void
set_op_pinned
(
ir_op
*
op
,
op_pin_state
op_pin_state_pinned
)
{
if
(
op
==
op_Block
||
op
==
op_Phi
||
is_cfopcode
(
op
))
return
;
if
(
op
==
op_Block
||
op
==
op_Phi
||
is_
op_
cfopcode
(
op
))
return
;
op
->
op_pin_state_pinned
=
op_pin_state_pinned
;
}
/* set_op_pinned */
...
...
ir/ir/irop_t.h
View file @
ebada0c7
...
...
@@ -63,7 +63,7 @@ static INLINE size_t get_op_attr_size (const ir_op *op) {
* Returns non-zero if op is a control flow opcode,
* like Start, End, Jmp, Cond, Return, Raise or Bad.
*/
static
INLINE
int
is_cfopcode
(
const
ir_op
*
op
)
{
static
INLINE
int
is_
op_
cfopcode
(
const
ir_op
*
op
)
{
return
op
->
flags
&
irop_flag_cfopcode
;
}
...
...
@@ -100,6 +100,10 @@ static INLINE int is_op_constlike(const ir_op *op) {
return
op
->
flags
&
irop_flag_constlike
;
}
static
INLINE
int
is_op_side_effects
(
const
ir_op
*
op
)
{
return
op
->
flags
&
irop_flag_side_effect
;
}
/** Returns non-zero if operation must always be optimized */
static
INLINE
int
is_op_always_opt
(
const
ir_op
*
op
)
{
return
op
->
flags
&
irop_flag_always_opt
;
...
...
Write
Preview
Markdown
is supported
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