* two values match the Ytypes of the p->from and p->to operands. The function
* oclass in span.c computes the specific Ytype of an operand and then the set
* of more general Ytypes that it satisfies is implied by the ycover table, set
- * up in instinit. For example, oclass distinguishes the constants 0 and 1
- * from the more general 8-bit constants, but instinit says
+ * up in InstInit. For example, oclass distinguishes the constants 0 and 1
+ * from the more general 8-bit constants, but InstInit says
*
* ycover[Yi0*Ymax + Ys32] = 1;
* ycover[Yi1*Ymax + Ys32] = 1;
}
if ycover[0] == 0 {
- instinit()
+ ctxt.Diag("x86 tables not initialized, call x86.InstInit first")
}
for p := ctxt.Cursym.Text; p != nil; p = p.Link {
}
}
-func instinit() {
+func InstInit() {
+ if ycover[0] != 0 {
+ // Already initialized; stop now.
+ // This happens in the cmd/asm tests,
+ // each of which re-initializes the arch.
+ return
+ }
+
for i := 1; optab[i].as != 0; i++ {
c := optab[i].as
if opindex[c&obj.AMask] != nil {