libopid: fix build dependencies
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 10 Sep 2023 21:14:49 +0000 (00:14 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Wed, 13 Sep 2023 17:26:19 +0000 (20:26 +0300)
src/libopid/Makefile
src/libopid/codegen.py
src/libopid/opid-opc.c

index 4ff00f26be58ed2f1e6521b9f65c614a66758815..d7b5768a9dedee992d7bba90556b0439cd5e8df3 100644 (file)
@@ -44,10 +44,6 @@ check: opid-check.py opid-check
        python3 opid-check.py
 
 
-opid-opc.c: opid-opc-gen.c
-opid-dis.c: opid-dis-gen.c
-
-
 opid-check: opid-check.o libopid.a
        $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC $< -o $@ -L. -l:libopid.a
 
@@ -60,6 +56,10 @@ libopid.a: $(OBJS)
        $(AR) rcs $@ $^
 
 
+opid-dis.c: opid-dis-gen.c
+opid-opc.c: opid-opc-gen.c
+
+
  $(GENS): codegen.py
        SILENCELOG=true $(PYTHON) codegen.py $@ > $@
 
index 525c2e8d09eecc9cdc46c2932b409ab6797dc0b1..2712e51b77e591b588d678e95cab196116d0414f 100644 (file)
@@ -70,7 +70,7 @@ class DynamicOperandIds(tuple): pass
 class StaticOperands(tuple): pass
 class DynamicOperands(tuple): pass
 class POTable(tuple): pass
-class Records(tuple): pass
+class RecordTable(tuple): pass
 
 
 class DynamicOperandId(Struct):
@@ -125,7 +125,7 @@ class Cache(mdis.visitor.ContextVisitor):
                 static_operands=static_operands)
 
         yield DynamicOperands(map(dynamic_operand, self.__dynamic_operand.items()))
-        yield Records(map(record, sorted(self.__records.items())))
+        yield RecordTable(map(record, sorted(self.__records.items())))
         yield POTable(self.__PO)
 
     @mdis.dispatcher.Hook(insndb.Record)
@@ -233,7 +233,7 @@ class Record(Struct):
 
 class DisGenSource(Source):
     class Walker(Walker):
-        @mdis.dispatcher.Hook(DynamicOperand, Records)
+        @mdis.dispatcher.Hook(DynamicOperand, RecordTable)
         def dispatch_ignore(self, node):
             yield from ()
 
@@ -418,7 +418,7 @@ class OpcGenSource(Source):
             heads[index] = (counter - node[index])
             tails[index] = counter
         heads = [(tail - node[index]) for (index, tail) in enumerate(tails)]
-        self.emit("static uint16_t const opid_opcode_hash[64][2] = {")
+        self.emit("static uint16_t const opid_opcode_table[64][2] = {")
         with self:
             for index in range(64):
                 head = heads[index]
@@ -427,10 +427,10 @@ class OpcGenSource(Source):
         self.emit("};")
         yield node
 
-    @mdis.dispatcher.Hook(Records)
+    @mdis.dispatcher.Hook(RecordTable)
     @contextlib.contextmanager
     def dispatch_records(self, node):
-        self.emit("static struct opid_record const opid_records[] = {")
+        self.emit("static struct opid_record const opid_record_table[] = {")
         with self: yield node
         self.emit("};")
         self.emit("")
index 2a387f7273811a803e3ca2efccb4fba2b0a6ef28..0d2d6c2a31acd9ff69df77c8238e4bc902ac9247 100644 (file)
@@ -3,8 +3,8 @@
 
 #include "opid.h"
 
-static struct opid_record const opid_records[];
-static uint16_t const opid_opcode_hash[64][2];
+static struct opid_record const opid_record_table[];
+static uint16_t const opid_opcode_table[64][2];
 
 #include "opid-opc-gen.c"
 
@@ -19,8 +19,8 @@ opid_lookup_insn(uint32_t insn) {
         /* 5  */ (((insn >> UINT32_C(26)) & UINT32_C(1)) << UINT32_C(0)) |
         UINT32_C(0)
     );
-    struct opid_record const *iter = &opid_records[opid_opcode_hash[PO][0]];
-    struct opid_record const *tail = &opid_records[opid_opcode_hash[PO][1]];
+    struct opid_record const *iter = &opid_record_table[opid_opcode_table[PO][0]];
+    struct opid_record const *tail = &opid_record_table[opid_opcode_table[PO][1]];
 
     for (; iter != tail; ++iter) {
         struct opid_opcode const *opcode = &iter->opcode;