From 120b492a488da9e31f9b4c3df5fa2881c03b7847 Mon Sep 17 00:00:00 2001 From: Themis Demetriades Date: Wed, 5 Jun 2024 20:54:22 +0100 Subject: [PATCH] Added structs to represent labels and directives for assembler --- src/a64instruction.h | 8 +++++++- src/a64instruction_Directive.h | 5 +++++ src/a64instruction_Label.h | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/a64instruction_Directive.h create mode 100644 src/a64instruction_Label.h diff --git a/src/a64instruction.h b/src/a64instruction.h index b2c75cf..c12584c 100644 --- a/src/a64instruction.h +++ b/src/a64instruction.h @@ -4,6 +4,8 @@ #include "a64instruction_DPRegister.h" #include "a64instruction_Branch.h" #include "a64instruction_SingleTransfer.h" +#include "a64instruction_Label.h" +#include "a64instruction_Directive.h" // Define the types of instructions in subset of the AArch64 Instruction Set implemented. // Each type is defined by the format of the instruction's operand(s). @@ -13,7 +15,9 @@ typedef enum { a64inst_SINGLETRANSFER, a64inst_LOADLITERAL, a64inst_BRANCH, - a64inst_HALT + a64inst_HALT, + a64inst_LABEL, + a64inst_DIRECTIVE } a64inst_type; // Structure the holds the type and operand data of an instruction @@ -24,6 +28,8 @@ typedef struct { a64inst_DPRegisterData DPRegisterData; a64inst_BranchData BranchData; a64inst_SingleTransferData SingleTransferData; + a64inst_LabelData LabelData; + a64inst_DirectiveData DirectiveData; } data; } a64inst_instruction; diff --git a/src/a64instruction_Directive.h b/src/a64instruction_Directive.h new file mode 100644 index 0000000..797b9c3 --- /dev/null +++ b/src/a64instruction_Directive.h @@ -0,0 +1,5 @@ +include "global.h" + +typedef struct { + dword value; +} a64inst_DirectiveData; \ No newline at end of file diff --git a/src/a64instruction_Label.h b/src/a64instruction_Label.h new file mode 100644 index 0000000..b80979e --- /dev/null +++ b/src/a64instruction_Label.h @@ -0,0 +1,3 @@ +typedef struct { + char* label; +} a64inst_LabelData; \ No newline at end of file