jit/ir: Remove instruction linked list

The linked list was implemented to store instructions in a basic block.
Instructions will now be stored in arrays to keep logic simple and
straight-foward.

Signed-off-by: Ronald Caesar <github43132@proton.me>
This commit is contained in:
Ronald Caesar 2025-11-27 15:59:16 -04:00
parent 21c0f0bdef
commit d61fbe3514
No known key found for this signature in database
GPG key ID: 04307C401999C596
2 changed files with 0 additions and 96 deletions

View file

@ -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;
}
}

View file

@ -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