Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
1833cfd9
Commit
1833cfd9
authored
Mar 02, 2009
by
Moritz Kroll
Browse files
irio: Readded support for strictConv
[r25591]
parent
bd36b42a
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/libfirm/ircons.h
View file @
1833cfd9
...
...
@@ -1734,6 +1734,17 @@ ir_node *new_rd_Rotl (dbg_info *db, ir_graph *irg, ir_node *block,
ir_node
*
new_rd_Conv
(
dbg_info
*
db
,
ir_graph
*
irg
,
ir_node
*
block
,
ir_node
*
op
,
ir_mode
*
mode
);
/** Constructor for a strictConv node.
*
* @param *db A pointer for debug information.
* @param *irg The IR graph the node belongs to.
* @param *block The IR block the node belongs to.
* @param *op The operand.
* @param *mode The mode of this the operand muss be converted .
*/
ir_node
*
new_rd_strictConv
(
dbg_info
*
db
,
ir_graph
*
irg
,
ir_node
*
block
,
ir_node
*
op
,
ir_mode
*
mode
);
/** Constructor for a Cast node.
*
* High level type cast.
...
...
@@ -2556,6 +2567,16 @@ ir_node *new_r_Rotl (ir_graph *irg, ir_node *block,
ir_node
*
new_r_Conv
(
ir_graph
*
irg
,
ir_node
*
block
,
ir_node
*
op
,
ir_mode
*
mode
);
/** Constructor for a strict Conv node.
*
* @param *irg The IR graph the node belongs to.
* @param *block The IR block the node belongs to.
* @param *op The operand.
* @param *mode The mode of this the operand muss be converted .
*/
ir_node
*
new_r_strictConv
(
ir_graph
*
irg
,
ir_node
*
block
,
ir_node
*
op
,
ir_mode
*
mode
);
/** Constructor for a Cast node.
*
* High level type cast
...
...
ir/ir/ircons.c
View file @
1833cfd9
...
...
@@ -1023,6 +1023,18 @@ new_rd_Conv(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *op, ir_mode *m
return
res
;
}
/* new_rd_Conv */
ir_node
*
new_rd_strictConv
(
dbg_info
*
db
,
ir_graph
*
irg
,
ir_node
*
block
,
ir_node
*
op
,
ir_mode
*
mode
)
{
ir_node
*
res
;
ir_graph
*
rem
=
current_ir_graph
;
current_ir_graph
=
irg
;
res
=
new_bd_Conv
(
db
,
block
,
op
,
mode
,
1
);
current_ir_graph
=
rem
;
return
res
;
}
/* new_rd_strictConv */
#ifdef USE_ORIGINAL
ir_node
*
new_rd_Cast
(
dbg_info
*
db
,
ir_graph
*
irg
,
ir_node
*
block
,
ir_node
*
op
,
ir_type
*
to_tp
)
{
...
...
@@ -1648,6 +1660,10 @@ ir_node *new_r_Conv(ir_graph *irg, ir_node *block,
ir_node
*
op
,
ir_mode
*
mode
)
{
return
new_rd_Conv
(
NULL
,
irg
,
block
,
op
,
mode
);
}
ir_node
*
new_r_strictConv
(
ir_graph
*
irg
,
ir_node
*
block
,
ir_node
*
op
,
ir_mode
*
mode
)
{
return
new_rd_strictConv
(
NULL
,
irg
,
block
,
op
,
mode
);
}
#ifdef USE_ORIGINAL
ir_node
*
new_r_Cast
(
ir_graph
*
irg
,
ir_node
*
block
,
ir_node
*
op
,
ir_type
*
to_tp
)
{
return
new_rd_Cast
(
NULL
,
irg
,
block
,
op
,
to_tp
);
...
...
scripts/gen_ir_io.py
View file @
1833cfd9
...
...
@@ -154,6 +154,7 @@ def preprocess_node(nodename, node):
# construct node arguments
arguments
=
[
]
initargs
=
[
]
specialconstrs
=
[
]
i
=
0
for
input
in
node
[
"ins"
]:
arguments
.
append
(
"prednodes[%i]"
%
i
)
...
...
@@ -173,11 +174,38 @@ def preprocess_node(nodename, node):
if
"mode"
not
in
node
:
arguments
.
append
(
"mode"
)
attrs_with_special
=
0
for
attr
in
node
[
"attrs"
]:
if
nodename
==
"Builtin"
and
attr
[
"name"
]
==
"kind"
:
continue
prepare_attr
(
nodename
,
attr
)
if
"init"
in
attr
:
if
"special"
in
attr
:
if
not
"init"
in
attr
:
print
"Node type %s has an attribute with a
\"
special
\"
entry but without
\"
init
\"
"
%
nodename
sys
.
exit
(
1
)
if
attrs_with_special
!=
0
:
print
"Node type %s has more than one attribute with a
\"
special
\"
entry"
%
nodename
sys
.
exit
(
1
)
attrs_with_special
+=
1
if
"prefix"
in
attr
[
"special"
]:
specialname
=
attr
[
"special"
][
"prefix"
]
+
nodename
elif
"suffix"
in
attr
[
"special"
]:
specialname
=
nodename
+
attr
[
"special"
][
"suffix"
]
else
:
print
"Unknown special constructor type for node type %s"
%
nodename
sys
.
exit
(
1
)
specialconstrs
.
append
(
dict
(
constrname
=
specialname
,
attrname
=
attr
[
"name"
],
value
=
attr
[
"special"
][
"init"
]
)
)
elif
"init"
in
attr
:
initargs
.
append
(
attr
[
"name"
])
else
:
arguments
.
append
(
attr
[
"name"
])
...
...
@@ -188,6 +216,7 @@ def preprocess_node(nodename, node):
node
[
"arguments"
]
=
arguments
node
[
"initargs"
]
=
initargs
node
[
"special_constructors"
]
=
specialconstrs
export_attrs_template
=
env
.
from_string
(
'''
case iro_{{nodename}}:
...
...
@@ -204,7 +233,11 @@ import_attrs_template = env.from_string('''
{% for attr in node.attrs %}{{attr.importcmd}}
{% endfor %}
{% for attr in node.constructor_args %}{{attr.importcmd}}
{% endfor %}newnode = new_r_{{nodename}}(current_ir_graph{{node|block}}{{node["arguments"]|args}});
{% endfor %}
{% for special in node.special_constructors %}if({{special.attrname}} == {{special.value}})
newnode = new_r_{{special.constrname}}(current_ir_graph{{node|block}}{{node["arguments"]|args}});
else{% endfor %}
newnode = new_r_{{nodename}}(current_ir_graph{{node|block}}{{node["arguments"]|args}});
{% for initarg in node.initargs %}set_{{nodename}}_{{initarg}}(newnode, {{initarg}});
{% endfor %}
break;
...
...
scripts/ir_spec.py
View file @
1833cfd9
...
...
@@ -390,7 +390,18 @@ Cmp = dict(
),
Conv
=
dict
(
is_a
=
"unop"
is_a
=
"unop"
,
attrs
=
[
dict
(
name
=
"strict"
,
type
=
"int"
,
init
=
"0"
,
special
=
dict
(
prefix
=
"strict"
,
init
=
"1"
)
)
]
),
Alloc
=
dict
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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