From d0be871e8f5bc3699a9710ea4ffaada01fc489c0 Mon Sep 17 00:00:00 2001 From: EDiasAlberto Date: Sun, 9 Jun 2024 23:07:45 +0100 Subject: [PATCH] generate offset operand for load literal with immediate value --- src/parser.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/parser.c b/src/parser.c index 40e264f..9a1ac25 100644 --- a/src/parser.c +++ b/src/parser.c @@ -153,11 +153,19 @@ void classifyOpcode(char* opcode, a64inst_instruction *instr, char *operandList[ } } else { instr->type = a64inst_LOADLITERAL; - //instr->data.processOpData.offset = {} to be defined by symbol table + if(strcmp(operandList[0][0], "#")==0){ + //offset is immediate + char *immOffset = strdup(operandList[0]) + immOffset++; + char *endptr; + int offset = strtol(immOffset, endptr, 10); + instr->data.SingleTransferData.processOpData.loadLiteralData.offset = offset; + } else { + //offset is literal, use symbol table and calculate difference + } } } else { - int numOperands = sizeof(operandList) / sizeof(operandList[0]) if(classifyDPInst(operandList)){ instr->type = a64inst_DPREGISTER; } else {