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
3f9c84bc
Commit
3f9c84bc
authored
Apr 23, 2013
by
yb9976
Browse files
Made kaps robust against self loops.
parent
d50a29a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/kaps/kaps.c
View file @
3f9c84bc
...
...
@@ -102,6 +102,24 @@ void add_node_costs(pbqp_t *pbqp, unsigned node_index, vector_t *costs)
void
add_edge_costs
(
pbqp_t
*
pbqp
,
unsigned
src_index
,
unsigned
tgt_index
,
pbqp_matrix_t
*
costs
)
{
/* Add self loops to the node's costs. */
if
(
src_index
==
tgt_index
)
{
assert
(
costs
->
rows
==
costs
->
cols
);
unsigned
length
=
costs
->
rows
;
vector_t
*
diagonal
=
vector_alloc
(
pbqp
,
length
);
for
(
unsigned
i
=
length
;
i
--
!=
0
;)
{
num
value
=
costs
->
entries
[
i
*
length
+
i
];
vector_set
(
diagonal
,
i
,
value
);
}
add_node_costs
(
pbqp
,
src_index
,
diagonal
);
return
;
}
pbqp_edge_t
*
edge
=
get_edge
(
pbqp
,
src_index
,
tgt_index
);
if
(
tgt_index
<
src_index
)
{
...
...
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