Previously aliases were stored in a map which was causing non-deterministic code generation (see recent build failures). This diff changes to a slice to avoid this problem. Updates #50
38 lines
676 B
Bash
Executable File
38 lines
676 B
Bash
Executable File
#!/bin/bash -e
|
|
|
|
self=$(basename $0)
|
|
output=$1
|
|
|
|
eval $(go env)
|
|
arch=${GOROOT}/src/cmd/asm/internal/arch/arch.go
|
|
|
|
{
|
|
|
|
echo "// Code generated by ${self}. DO NOT EDIT."
|
|
echo
|
|
echo 'package load'
|
|
echo
|
|
echo 'var annoyingaliases = []alias{'
|
|
|
|
awk '
|
|
/archX86/ { x86=1 }
|
|
/^}/ { x86=0 }
|
|
|
|
x86 && /x86/ && /instructions\[/ {
|
|
from=$1
|
|
to=$3
|
|
|
|
sub(/instructions\[\"/, "", from)
|
|
sub(/\"\]/, "", from)
|
|
sub(/x86\.A/, "", to)
|
|
|
|
if(from != to) {
|
|
printf("\t{\"%s\", \"%s\"},\n", from, to)
|
|
}
|
|
}
|
|
' ${arch}
|
|
|
|
echo '}'
|
|
|
|
} | gofmt > ${output}
|