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
b9dc8d34
Commit
b9dc8d34
authored
Mar 19, 2003
by
Götz Lindenmaier
Browse files
Added new compilation flags
[r918]
parent
853751af
Changes
5
Hide whitespace changes
Inline
Side-by-side
ir/ana/cgana.c
View file @
b9dc8d34
...
...
@@ -157,16 +157,16 @@ static entity ** get_impl_methods(entity * method) {
/* debug makros used in sel_methods_walker */
#define SIZ(x) sizeof(x)/sizeof((x)[0])
#define DBG_OPT_NORMALIZE \
#define DBG_OPT_NORMALIZE
\
__dbg_info_merge_pair(new_node, node, dbg_const_eval)
#define DBG_OPT_POLY_ALLOC \
do { \
ir_node *ons[2]; \
ons[0] = node; \
ons[1] = skip_Proj(get_Sel_ptr(node)); \
#define DBG_OPT_POLY_ALLOC
\
do {
\
ir_node *ons[2];
\
ons[0] = node;
\
ons[1] = skip_Proj(get_Sel_ptr(node));
\
__dbg_info_merge_sets(&new_node, 1, ons, SIZ(ons), dbg_rem_poly_call); \
} while(0)
#define DBG_OPT_POLY \
#define DBG_OPT_POLY
\
__dbg_info_merge_pair(new_node, node, dbg_rem_poly_call)
...
...
@@ -178,7 +178,7 @@ static void sel_methods_walker(ir_node * node, pmap * ldname_map) {
pmap_entry
*
entry
=
pmap_find
(
ldname_map
,
(
void
*
)
get_SymConst_ptrinfo
(
node
));
if
(
entry
!=
NULL
)
{
/* Method is declared in the compiled code */
entity
*
ent
=
entry
->
value
;
if
(
get_entity_visibility
(
ent
)
!=
external_allocated
)
{
/* Meth. is defined */
if
(
get_opt_normalize
()
&&
(
get_entity_visibility
(
ent
)
!=
external_allocated
)
)
{
/* Meth. is defined */
ir_node
*
new_node
;
assert
(
get_entity_irg
(
ent
));
set_irg_current_block
(
current_ir_graph
,
get_nodes_Block
(
node
));
...
...
@@ -191,11 +191,14 @@ static void sel_methods_walker(ir_node * node, pmap * ldname_map) {
}
else
if
(
get_irn_op
(
node
)
==
op_Sel
&&
is_method_type
(
get_entity_type
(
get_Sel_entity
(
node
))))
{
entity
*
ent
=
get_Sel_entity
(
node
);
if
(
get_irn_op
(
skip_Proj
(
get_Sel_ptr
(
node
)))
==
op_Alloc
)
{
if
(
get_optimize
()
&&
get_opt_dyn_meth_dispatch
()
&&
(
get_irn_op
(
skip_Proj
(
get_Sel_ptr
(
node
)))
==
op_Alloc
))
{
ir_node
*
new_node
;
/* We know which method will be called, no dispatch necessary. */
assert
(
get_entity_peculiarity
(
ent
)
!=
description
);
set_irg_current_block
(
current_ir_graph
,
get_nodes_Block
(
node
));
/* @@@ Is this correct?? Alloc could reference a subtype of the owner
of Sel that overwrites the method referenced in Sel. */
new_node
=
copy_const_value
(
get_atomic_ent_value
(
ent
));
DBG_OPT_POLY_ALLOC
;
exchange
(
node
,
new_node
);
}
else
{
...
...
@@ -236,7 +239,8 @@ static void sel_methods_walker(ir_node * node, pmap * ldname_map) {
printf("\n");
#endif
if
(
ARR_LEN
(
arr
)
==
1
&&
arr
[
0
]
!=
NULL
)
{
if
(
get_optimize
()
&&
get_opt_dyn_meth_dispatch
()
&&
(
ARR_LEN
(
arr
)
==
1
&&
arr
[
0
]
!=
NULL
))
{
ir_node
*
new_node
;
/* Die Sel-Operation kann immer nur einen Wert auf eine
* interne Methode zurckgeben. Wir knnen daher die
...
...
ir/ir/irflag.c
View file @
b9dc8d34
...
...
@@ -18,20 +18,27 @@
/* 0 - don't do this optimization
1 - lets see, if there is a better graph */
int
optimized
=
1
;
/* Turn off all optimizations */
int
opt_cse
=
1
;
/* Hash the nodes */
int
opt_global_cse
=
0
;
/* Don't use block predecessor for comparison */
/* @@@ 0 solage code placement fehlt */
int
opt_constant_folding
=
1
;
/* Evaluate operations */
int
opt_unreachable_code
=
1
;
/* Bad node propagation */
int
optimized
=
1
;
/* Turn off all optimizations. */
int
opt_cse
=
1
;
/* Hash the nodes. */
int
opt_global_cse
=
0
;
/* Don't use block predecessor for comparison.
Default must be zero as code placement must
be run right after a local optimize walk with
opt_global_cse on. */
int
opt_constant_folding
=
1
;
/* Evaluate operations. */
int
opt_unreachable_code
=
1
;
/* Bad node propagation. */
int
opt_control_flow_straightening
=
1
;
/* */
int
opt_control_flow_weak_simplification
=
1
;
/* */
int
opt_control_flow_strong_simplification
=
1
;
/* */
int
opt_control_flow_weak_simplification
=
1
;
/* */
int
opt_control_flow_strong_simplification
=
1
;
/* */
int
opt_critical_edges
=
1
;
int
opt_dead_node_elimination
=
1
;
/* Reclaim memory */
int
opt_reassociation
=
1
;
/* Reassociate nodes */
int
opt_inline
=
1
;
/* Do inlining transformation */
int
opt_dead_node_elimination
=
1
;
/* Reclaim memory. */
int
opt_reassociation
=
1
;
/* Reassociate nodes. */
int
opt_inline
=
1
;
/* Do inlining transformation. */
int
opt_dyn_meth_dispatch
=
1
;
/* Remove dynamic method dispatch. */
int
opt_normalize
=
1
;
/* Transformations that normalize the firm representation
as removing Ids and Tuples, useless Phis, SymConst(id) ->
Const(entity) ... */
/* set the flags with set_flagname, get the flag with get_flagname */
INLINE
void
...
...
@@ -161,3 +168,26 @@ INLINE void set_opt_inline (int value) {
INLINE
int
get_opt_inline
(
void
)
{
return
opt_inline
;
}
/** Enable/Disable optimization of dynamic method dispatch
*
* This flag enables/disables the optimization of dynamic method dispatch.
* If the flag is turned on Sel nodes can be replaced by Const nodes representing
* the address of a function.
*/
void
set_opt_dyn_meth_dispatch
(
int
value
)
{
opt_dyn_meth_dispatch
=
value
;
}
int
get_opt_dyn_meth_dispatch
(
void
)
{
return
opt_dyn_meth_dispatch
;
}
INLINE
void
set_opt_normalize
(
int
value
)
{
opt_normalize
=
value
;
}
INLINE
int
get_opt_normalize
(
void
)
{
return
opt_normalize
;
}
ir/ir/irflag.h
View file @
b9dc8d34
...
...
@@ -54,7 +54,8 @@ int get_opt_cse (void);
* constant subexpression elimination for floating nodes. Intra
* procedure cse gets the graph into state "floating". It is necessary
* to run pre/code motion to get the graph back into state "pinned".
* Default: opt_global_cse == 1.
* right after a call to local_optimize with global cse turned on.
* Default: opt_global_cse == 0.
*/
void
set_opt_global_cse
(
int
value
);
/** Returns global constant subexpression elimination setting. */
...
...
@@ -124,4 +125,29 @@ void set_opt_inline (int value);
/** Returns inlining setting. */
int
get_opt_inline
(
void
);
/** Enable/Disable optimization of dynamic method dispatch
*
* This flag enables/disables the optimization of dynamic method dispatch.
* If the flag is turned on Sel nodes can be replaced by Const nodes representing
* the address of a function.
*/
void
set_opt_dyn_meth_dispatch
(
int
value
);
int
get_opt_dyn_meth_dispatch
(
void
);
/** Enable/Disable normalizations of the firm representation.
*
* This flag guards transformations that normalize the firm representation
* as removing Ids and Tuples, useless Phis, replacing SymConst(id) by
* Const(entity) and others.
* The transformations guarded by this flag are not guarded by flag
* "optimize".
* Many algorithms operating on firm can not deal with constructs in
* the non-normalized representation.
* default: 1
* @@@ ATTENTION: not all such transformations are guarded by a flag.
*/
void
set_opt_normalize
(
int
value
);
int
get_opt_normalize
(
void
);
#endif
ir/ir/irnode.c
View file @
b9dc8d34
...
...
@@ -20,6 +20,7 @@
#include "array.h"
#include "irbackedge_t.h"
#include "irdump.h"
#include "irflag.h"
#ifdef DEBUG_libfirm
#include "irprog_t.h"
...
...
@@ -40,7 +41,6 @@ INLINE opcode get_irn_opcode (ir_node *node);
INLINE
ident
*
get_irn_opident
(
ir_node
*
node
);
INLINE
type
*
get_SymConst_type
(
ir_node
*
node
);
INLINE
ir_node
*
skip_nop
(
ir_node
*
node
);
INLINE
ir_node
*
skip_nop
(
ir_node
*
node
);
INLINE
int
is_Proj
(
ir_node
*
node
);
...
...
@@ -2183,6 +2183,8 @@ INLINE ir_node *
skip_Tuple
(
ir_node
*
node
)
{
ir_node
*
pred
;
if
(
!
get_opt_normalize
())
return
node
;
node
=
skip_nop
(
node
);
if
(
get_irn_op
(
node
)
==
op_Proj
)
{
pred
=
skip_nop
(
get_Proj_pred
(
node
));
...
...
@@ -2198,6 +2200,8 @@ INLINE ir_node *
skip_nop
(
ir_node
*
node
)
{
/* don't assert node !!! */
if
(
!
get_opt_normalize
())
return
node
;
/* Don't use get_Id_pred: We get into an endless loop for
self-referencing Ids. */
if
(
node
&&
(
node
->
op
==
op_Id
)
&&
(
node
!=
node
->
in
[
0
+
1
]))
{
...
...
ir/ir/iropt.c
View file @
b9dc8d34
...
...
@@ -448,6 +448,8 @@ equivalent_node (ir_node *n)
ir_node
*
first_val
=
NULL
;
/* to shutup gcc */
ir_node
*
scnd_val
=
NULL
;
/* to shutup gcc */
if
(
!
get_opt_normalize
())
return
;
n_preds
=
get_Phi_n_preds
(
n
);
block
=
get_nodes_Block
(
n
);
...
...
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