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
2a7834a2
Commit
2a7834a2
authored
Sep 10, 2012
by
Christoph Mallon
Browse files
Remove the unused facility to register space /in front of/ a node.
parent
2b76ea5c
Changes
5
Hide whitespace changes
Inline
Side-by-side
include/libfirm/irnode.h
View file @
2a7834a2
...
...
@@ -772,36 +772,6 @@ FIRM_API int is_irn_cse_neutral(const ir_node *node);
/** Returns the string representation of the jump prediction. */
FIRM_API
const
char
*
get_cond_jmp_predicate_name
(
cond_jmp_predicate
pred
);
/**
* Access custom node data.
* The data must have been registered with
* register_additional_node_data() before.
* @param node The ir node to get the data from.
* @param type The type of the data you registered.
* @param off The value returned by register_additional_node_data().
* @return A pointer of type @p type.
*/
#define get_irn_data(node,type,off) \
(assert(off > 0 && "Invalid node data offset"), (type *) ((char *) (node) - (off)))
/**
* Returns the pointer to the node some custom data belongs to.
* @param data The pointer to the custom data.
* @param off The number as returned by register_additional_node_data().
* @return A pointer to the ir node the custom data belongs to.
*/
#define get_irn_data_base(data,off) \
(assert(off > 0 && "Invalid node data offset"), (ir_node *) ((char *) (data) + (off)))
/**
* Request additional data to be allocated with an ir node.
* @param size The size of the additional data required.
* @return A positive number, if the operation was successful, which
* must be passed to the access macro get_irn_data(), 0 if the
* registration failed.
*/
FIRM_API
unsigned
firm_register_additional_node_data
(
unsigned
size
);
/**
* Returns a pointer to the node attributes.
* Used for accessing attributes of user-defined nodes.
...
...
ir/common/firm.c
View file @
2a7834a2
...
...
@@ -112,8 +112,6 @@ void ir_init(void)
/* Init architecture dependent optimizations. */
arch_dep_set_opts
(
arch_dep_none
);
init_irnode
();
init_execfreq
();
#ifdef DEBUG_libfirm
...
...
ir/ir/irnode.c
View file @
2a7834a2
...
...
@@ -95,57 +95,17 @@ ir_relation get_inversed_relation(ir_relation relation)
return
code
;
}
/**
* Indicates, whether additional data can be registered to ir nodes.
* If set to 1, this is not possible anymore.
*/
static
int
forbid_new_data
=
0
;
unsigned
firm_add_node_size
=
0
;
unsigned
firm_register_additional_node_data
(
unsigned
size
)
{
assert
(
!
forbid_new_data
&&
"Too late to register additional node data"
);
if
(
forbid_new_data
)
return
0
;
return
firm_add_node_size
+=
size
;
}
void
init_irnode
(
void
)
{
/* Forbid the addition of new data to an ir node. */
forbid_new_data
=
1
;
}
struct
struct_align
{
char
c
;
struct
s
{
int
i
;
float
f
;
double
d
;
}
s
;
};
ir_node
*
new_ir_node
(
dbg_info
*
db
,
ir_graph
*
irg
,
ir_node
*
block
,
ir_op
*
op
,
ir_mode
*
mode
,
int
arity
,
ir_node
*
const
*
in
)
{
ir_node
*
res
;
unsigned
align
=
offsetof
(
struct
struct_align
,
s
)
-
1
;
unsigned
add_node_size
=
(
firm_add_node_size
+
align
)
&
~
align
;
size_t
node_size
=
offsetof
(
ir_node
,
attr
)
+
op
->
attr_size
+
add_node_size
;
char
*
p
;
int
i
;
assert
(
irg
);
assert
(
op
);
assert
(
mode
);
p
=
(
char
*
)
obstack_alloc
(
irg
->
obst
,
node_size
);
memset
(
p
,
0
,
node_size
)
;
res
=
(
ir_node
*
)
(
p
+
add_
node_size
);
size_t
const
node_size
=
offsetof
(
ir_node
,
attr
)
+
op
->
attr_size
;
ir_node
*
const
res
=
(
ir_node
*
)
OALLOCNZ
(
irg
->
obst
,
char
,
node_size
);
res
->
kind
=
k_ir_node
;
res
->
op
=
op
;
...
...
ir/ir/irnode_t.h
View file @
2a7834a2
...
...
@@ -41,11 +41,6 @@
*/
ir_node
**
get_irn_in
(
const
ir_node
*
node
);
/**
* The amount of additional space for custom data to be allocated upon creating a new node.
*/
extern
unsigned
firm_add_node_size
;
/**
* Returns an array with the predecessors of the Block. Depending on
* the implementation of the graph data structure this can be a copy of
...
...
@@ -560,9 +555,6 @@ static inline const ir_switch_table_entry *ir_switch_table_get_entry_const(
void
ir_register_getter_ops
(
void
);
/** initialize ir_node module */
void
init_irnode
(
void
);
/**
* because firm keepalive edges are a broken concept, we have to make sure that
* nodes which are only held by a keepalive edges are never moved again.
...
...
ir/ir/irop.c
View file @
2a7834a2
...
...
@@ -501,16 +501,10 @@ static int node_cmp_attr_InstOf(const ir_node *a, const ir_node *b)
static
void
default_copy_attr
(
ir_graph
*
irg
,
const
ir_node
*
old_node
,
ir_node
*
new_node
)
{
unsigned
size
=
firm_add_node_size
;
(
void
)
irg
;
assert
(
get_irn_op
(
old_node
)
==
get_irn_op
(
new_node
));
memcpy
(
&
new_node
->
attr
,
&
old_node
->
attr
,
get_op_attr_size
(
get_irn_op
(
old_node
)));
if
(
size
>
0
)
{
/* copy additional node data */
memcpy
(
get_irn_data
(
new_node
,
void
,
size
),
get_irn_data
(
old_node
,
void
,
size
),
size
);
}
}
/**
...
...
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