diff --git a/src/parser.c b/src/parser.c index e9e05cf..8b98cb0 100644 --- a/src/parser.c +++ b/src/parser.c @@ -84,8 +84,13 @@ void generateBranchOperands(a64inst_instruction *instr, char* opcode, char *oper } void classifyOpcode(char* opcode, a64inst_instruction *instr, char *operandList[]){ - if((int isUnconditional = strcmp(opcode, "b")) == 0 || - (int isRegister = strcmp(opcode, "br")) == 0 || + int isUnconditional = strcmp(opcode, "b"); + int isRegister = strcmp(opcode, "br"); + int isLoad = strcmp(opcode, "ldr"); + int isStore = strcmp(opcode, "str"); + + if(isUnconditional == 0 || + isRegister == 0 || strncmp(opcode, "b.", 2) == 0){ instr->type = a64inst_BRANCH; if(isUnconditional){ @@ -97,7 +102,7 @@ void classifyOpcode(char* opcode, a64inst_instruction *instr, char *operandList[ //instr->data.branchData.processOpData.cond = {remove first two chars of opcode} } generateBranchOperands(instr, opcode, operandList); - } else if((int isLoad = strcmp(opcode, "ldr")) == 0 || (int isStore = strcmp(opcode, "str")) == 0){ + } else if(isLoad == 0 || isStore == 0){ //loading/storing instruction; classify operands char *address = operandList[1]; if( *address == '['){