create helper function to generate number from operand

This commit is contained in:
EDiasAlberto 2024-06-12 16:24:42 +01:00
parent 1fd7e441b6
commit f32304afb7

View File

@ -18,6 +18,14 @@
// - ASK ABOUT OFFSET CALCULATION // - ASK ABOUT OFFSET CALCULATION
// - CREATE FUNC TO TIDY UP OPERANDS IN DP // - 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){ int isOperandRegister(char *operand){
return((strcmp(&(operand[0]), "x")==0) || (strcmp(&(operand[0]), "w")==0)); 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 //offset is literal, use symbol table and calculate difference
} }
} }
generateLoadStoreOperands(instr, opcode, operandList, numOperands);
} else { } else {
if(classifyDPInst(operandList)){ if(classifyDPInst(operandList)){