From f3aaf4e5a82e088557af1521a59cdadb1f18b850 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Mon, 11 Sep 2023 00:14:49 +0300 Subject: [PATCH] libopid: fix build dependencies --- src/libopid/Makefile | 8 ++++---- src/libopid/codegen.py | 12 ++++++------ src/libopid/opid-opc.c | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/libopid/Makefile b/src/libopid/Makefile index 4ff00f26..d7b5768a 100644 --- a/src/libopid/Makefile +++ b/src/libopid/Makefile @@ -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 $@ > $@ diff --git a/src/libopid/codegen.py b/src/libopid/codegen.py index 525c2e8d..2712e51b 100644 --- a/src/libopid/codegen.py +++ b/src/libopid/codegen.py @@ -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("") diff --git a/src/libopid/opid-opc.c b/src/libopid/opid-opc.c index 2a387f72..0d2d6c2a 100644 --- a/src/libopid/opid-opc.c +++ b/src/libopid/opid-opc.c @@ -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; -- 2.30.2