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
bdf3202e
Commit
bdf3202e
authored
Mar 21, 2013
by
Andreas Zwinkau
Browse files
Refactor: better name for former 'fp-vrp' analysis
parent
9a202f69
Changes
4
Hide whitespace changes
Inline
Side-by-side
ir/ana/
fp-vrp
.c
→
ir/ana/
constbits
.c
View file @
bdf3202e
...
...
@@ -28,7 +28,7 @@
#include "tv.h"
#include "irpass.h"
#include "irmemory.h"
#include "
fp-vrp
.h"
#include "
constbits
.h"
/* TODO:
* - Implement cleared/set bit calculation for Add, Sub, Minus, Mul, Div, Mod, Shl, Shr, Shrs, Rotl
...
...
@@ -109,8 +109,6 @@ DEBUG_ONLY(static firm_dbg_module_t *dbg;)
static
struct
obstack
*
obst
;
typedef
struct
vrp_bitinfo
bitinfo
;
static
bool
is_undefined
(
bitinfo
const
*
const
b
)
{
return
tarval_is_null
(
b
->
z
)
&&
tarval_is_all_one
(
b
->
o
);
...
...
@@ -646,7 +644,7 @@ static void build_phi_lists(ir_node *irn, void *env)
add_Block_phi
(
get_nodes_block
(
irn
),
irn
);
}
void
fp_vrp
_analyze
(
ir_graph
*
const
irg
,
struct
obstack
*
client_obst
)
void
constbits
_analyze
(
ir_graph
*
const
irg
,
struct
obstack
*
client_obst
)
{
obst
=
client_obst
;
...
...
ir/ana/
fp-vrp
.h
→
ir/ana/
constbits
.h
View file @
bdf3202e
#ifndef
FP_VRP
_H
#define
FP_VRP
_H
#ifndef
CONSTBITS
_H
#define
CONSTBITS
_H
#include "adt/obst.h"
typedef
struct
vrp_
bitinfo
typedef
struct
bitinfo
{
ir_tarval
*
z
;
/* safe zeroes, 0 = bit is zero, 1 = bit maybe is 1 */
ir_tarval
*
o
;
/* safe ones, 0 = bit maybe is zero, 1 = bit is 1 */
}
vrp_
bitinfo
;
}
bitinfo
;
/* Get
VRP
analysis information for node irn */
vrp_
bitinfo
*
get_bitinfo
(
ir_node
const
*
const
irn
);
/* Get analysis information for node irn */
bitinfo
*
get_bitinfo
(
ir_node
const
*
const
irn
);
/* Set
VRP
analysis information for node irn */
/* Set analysis information for node irn */
int
set_bitinfo
(
ir_node
*
const
irn
,
ir_tarval
*
const
z
,
ir_tarval
*
const
o
);
/* Compute
VRP fixpoint. The Result is available via links to
*
vrp_
bitinfo*, allocated on client_obst. */
void
fp_vrp
_analyze
(
ir_graph
*
const
irg
,
struct
obstack
*
client_obst
);
/* Compute
value range fixpoint aka which bits of value are constant zero/one.
*
The result is available via links to
bitinfo*, allocated on client_obst. */
void
constbits
_analyze
(
ir_graph
*
const
irg
,
struct
obstack
*
client_obst
);
#endif
ir/opt/fp-vrp.c
View file @
bdf3202e
...
...
@@ -28,7 +28,7 @@
#include "tv.h"
#include "irpass.h"
#include "irmemory.h"
#include "
fp-vrp
.h"
#include "
constbits
.h"
DEBUG_ONLY
(
static
firm_dbg_module_t
*
dbg
;)
...
...
@@ -36,8 +36,6 @@ typedef struct environment_t {
unsigned
modified
:
1
;
/**< Set, if the graph was modified. */
}
environment_t
;
typedef
struct
vrp_bitinfo
bitinfo
;
static
int
mode_is_intb
(
ir_mode
const
*
const
m
)
{
return
mode_is_int
(
m
)
||
m
==
mode_b
;
...
...
@@ -221,7 +219,7 @@ void fixpoint_vrp(ir_graph* const irg)
ir_reserve_resources
(
irg
,
IR_RESOURCE_IRN_LINK
|
IR_RESOURCE_PHI_LIST
);
fp_vrp
_analyze
(
irg
,
&
private_obst
);
constbits
_analyze
(
irg
,
&
private_obst
);
FIRM_DBG_REGISTER
(
dbg
,
"firm.opt.fp-vrp"
);
DB
((
dbg
,
LEVEL_1
,
"===> Performing constant propagation on %+F (optimization)
\n
"
,
irg
));
...
...
ir/opt/occult_const.c
View file @
bdf3202e
...
...
@@ -28,7 +28,7 @@
#include "tv.h"
#include "irnodemap.h"
#include "dca.h"
#include "
fp-vrp
.h"
#include "
constbits
.h"
DEBUG_ONLY
(
static
firm_dbg_module_t
*
dbg
;)
...
...
@@ -48,7 +48,7 @@ static void occult_const_opt_walker(ir_node *node, void *data)
if
(
!
mode_is_data
(
get_irn_mode
(
node
)))
return
;
env_t
*
env
=
(
env_t
*
)
data
;
vrp_
bitinfo
*
vrp
=
ir_nodemap_get
(
vrp_
bitinfo
,
&
env
->
vrp
,
node
);
bitinfo
*
vrp
=
ir_nodemap_get
(
bitinfo
,
&
env
->
vrp
,
node
);
if
(
vrp
==
NULL
)
{
DB
((
dbg
,
LEVEL_4
,
"No VRP info: %+F
\n
"
,
node
));
...
...
@@ -91,7 +91,7 @@ void occult_consts(ir_graph *irg)
ir_reserve_resources
(
irg
,
IR_RESOURCE_IRN_LINK
|
IR_RESOURCE_PHI_LIST
);
fp_vrp
_analyze
(
irg
,
&
env
.
obst
);
constbits
_analyze
(
irg
,
&
env
.
obst
);
ir_nodemap_init
(
&
env
.
vrp
,
irg
);
irg_walk_graph
(
irg
,
fill_nodemap
,
0
,
&
env
.
vrp
);
...
...
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