diff --git a/src/jit/ir/instruction.cpp b/src/jit/ir/instruction.cpp index dd72e57..3510d13 100644 --- a/src/jit/ir/instruction.cpp +++ b/src/jit/ir/instruction.cpp @@ -112,51 +112,4 @@ instruction_get_opcode_name (const instruction_t *instruction) return name; } - -void -instruction_list_append (instruction_list_t *list, instruction_t *instruction) -{ - PVM_ASSERT(nullptr != list); - PVM_ASSERT(nullptr != instruction); - - instruction->next = nullptr; - instruction->previous = list->tail; - if (nullptr != list->tail) - { - list->tail->next = instruction; - } - else - { - list->head = instruction; - } - list->tail = instruction; -} - -void -instruction_list_remove (instruction_list_t *list, instruction_t *instruction) -{ - PVM_ASSERT(nullptr != list); - PVM_ASSERT(nullptr != instruction); - - if (nullptr != instruction->previous) - { - instruction->previous->next = instruction->next; - } - else - { - list->head = instruction->next; - } - - if (nullptr != instruction->next) - { - instruction->next->previous = instruction->previous; - } - else - { - list->tail = instruction->previous; - } - - instruction->next = nullptr; - instruction->previous = nullptr; -} } diff --git a/src/jit/ir/instruction.h b/src/jit/ir/instruction.h index 0832947..775f83b 100644 --- a/src/jit/ir/instruction.h +++ b/src/jit/ir/instruction.h @@ -22,29 +22,8 @@ typedef struct instruction_t // An array of arguments for this instruction. value_t args[MAX_IR_ARGS]; - - // Pointer to the next instruction in the intrusive list. - struct instruction_t *next; - - // Pointer to the previous instruction the intrusive list. - struct instruction_t *previous; } instruction_t; -/*! - * @brief Represents a double-linked list of IR instructions. - * - * This structure holds the head and tail pointers of an intrusive list - * composed of `instruction_t` nodes. It is used to store sequences - */ -typedef struct -{ - // Pointer to the first instruction in the list. - instruction_t *head; - - // Pointer to the last instruction in the list. - instruction_t *tail; -} instruction_list_t; - /*! * @brief Gets a pointer to the argument at a specific index. * @@ -147,33 +126,5 @@ type_t instruction_get_return_type(instruction_t *instruction); * @pre The global `g_opcodes` array must be initialized and accessible. */ const char *instruction_get_opcode_name(instruction_t *instruction); - -/*! - * @brief Appends an instruction to the tail of an instruction list. - * - * The instruction is added to the end of the list. If the list is empty, - * the instruction becomes both the head and the tail. - * - * @param list Pointer to the instruction list to modify. - * @param instruction Pointer to the `instruction_t` node to append. - * - * @pre `list` must not be NULL. - * @pre `instruction` must not be NULL. - */ -void instruction_list_append(instruction_list_t *list, - instruction_t *instruction); - -/*! - * @brief Removes an instruction from an instruction list. - * - * @param list Pointer to the instruction list to modify. - * @param instruction Pointer to the `instruction_t` node to remove. - * - * @pre `list` must not be NULL. - * @pre `instruction` must not be NULL. - * @pre `instruction` must be a member of `list`. - */ -void instruction_list_remove(instruction_list_t *list, - instruction_t *instruction); } #endif // POUND_JIT_IR_INSTRUCTION_H