summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJonas Haag <jonas@lophus.org>2015-11-23 16:25:27 +0100
committerPhilipp Serrer <philipp@serrer.de>2018-01-18 17:53:15 +0100
commit7e449d39a340098673ecd2bf1da2657e05a5cef4 (patch)
tree299163097939a4473da681b1440f6403ed8b007c
parent927ca6881f5f48e74f1b54918ba0635c11bff51e (diff)
gen: Ensure 'first_*' is last in ins/outs list
-rwxr-xr-xir/be/scripts/generate_new_opcodes.pl20
1 files changed, 20 insertions, 0 deletions
diff --git a/ir/be/scripts/generate_new_opcodes.pl b/ir/be/scripts/generate_new_opcodes.pl
index ef43940..6491308 100755
--- a/ir/be/scripts/generate_new_opcodes.pl
+++ b/ir/be/scripts/generate_new_opcodes.pl
@@ -413,6 +413,26 @@ foreach my $op (sort(keys(%nodes))) {
}
}
+ if ($ins) {
+ my $num_ins = scalar(@$ins);
+ for (my $idx = 0; $idx < $num_ins - 1; $idx++) {
+ if ($$ins[$idx] =~ /^first_/) {
+ die "Op $op input '$$ins[$idx]' has 'first_' prefix and should " .
+ "probably be last in the list as to avoid memory corruption\n";
+ }
+ }
+ }
+
+ if ($outs) {
+ my $num_outs = scalar(@$outs);
+ for (my $idx = 0; $idx < $num_outs - 1; $idx++) {
+ if ($$outs[$idx] =~ /^first_/) {
+ die "Op $op output '$$outs[$idx]' has 'first_' prefix and should " .
+ "probably be last as to avoid memory corruption\n";
+ }
+ }
+ }
+
# Create opcode
$obst_opvar .= "ir_op *op_$op = NULL;\n";