From f32304afb7b6deec3b81354f84ced54ac47a3976 Mon Sep 17 00:00:00 2001 From: EDiasAlberto Date: Wed, 12 Jun 2024 16:24:42 +0100 Subject: [PATCH] create helper function to generate number from operand --- src/parser.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/parser.c b/src/parser.c index 31b5ffc..97eef8d 100644 --- a/src/parser.c +++ b/src/parser.c @@ -18,6 +18,14 @@ // - ASK ABOUT OFFSET CALCULATION // - CREATE FUNC TO TIDY UP OPERANDS IN DP +int getOperandNumber(char *operand){ + char *operandCpy = strcpy(operandCpy, operand); + operandCpy++; + char **endptr; + int number = strtol(operandCpy, endptr, 10); + return number; +} + int isOperandRegister(char *operand){ return((strcmp(&(operand[0]), "x")==0) || (strcmp(&(operand[0]), "w")==0)); } @@ -161,6 +169,7 @@ void classifyOpcode(char* opcode, a64inst_instruction *instr, char *operandList[ //offset is literal, use symbol table and calculate difference } } + generateLoadStoreOperands(instr, opcode, operandList, numOperands); } else { if(classifyDPInst(operandList)){