ack/mach/proto/mcg/ircodes.sh
David Given ed67d427c9 Replaced the block splicer with a trivial block eliminator (which rewrites
jumps to blocks which contain only a jump). Don't bother storing the bb graph
in the ir nodes; we can find it on demand by walking the tree instead ---
slower, but much easier to understand and more robust. Added a terrible map
library.
2016-09-23 23:59:15 +02:00

36 lines
386 B
Bash
Executable file

#!/bin/sh
in=$1
header=$2
source=$3
awk -f - $in >$header << "EOF"
BEGIN {
print "enum ir_opcode {"
}
/^[^#]+/ {
print "\tIR_" $1 ","
}
END {
print "};"
}
EOF
awk -f - $in >$source << "EOF"
BEGIN {
print "#include \"mcg.h\""
print "#include \"ir.h\""
print "const char* ir_names[] = {"
}
/^[^#]+/ {
printf("\t\"%s\",\n", $1)
}
END {
print "};"
}
EOF