Debian Codegraph @

internal/load/annoyingaliases.sh

raw symbols SCIP
1 #!/bin/bash -e
2
3 self=$(basename $0)
4 output=$1
5
6 # Based on an archived copy of src/cmd/asm/internal/arch/arch.go.
7 arch="../data/arch.go.txt"
8
9 {
10
11 echo "// Code generated by ${self}. DO NOT EDIT."
12 echo
13 echo 'package load'
14 echo
15 echo 'var annoyingaliases = []alias{'
16
17 awk '
18 /archX86/ { x86=1 }
19 /^}/ { x86=0 }
20
21 x86 && /x86/ && /instructions\[/ {
22 from=$1
23 to=$3
24
25 sub(/instructions\[\"/, "", from)
26 sub(/\"\]/, "", from)
27 sub(/x86\.A/, "", to)
28
29 if(from != to) {
30 printf("\t{\"%s\", \"%s\"},\n", from, to)
31 }
32 }
33 ' ${arch}
34
35 echo '}'
36
37 } | gofmt > ${output}