38 lines
684 B
Bash
38 lines
684 B
Bash
|
|
#!/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 = map[string]string{'
|
||
|
|
|
||
|
|
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}
|