- rc_remove_instruction(loop->BeginLoop->Next); /* SLT/SGE */
- rc_remove_instruction(loop->BeginLoop->Next); /* IF */
- rc_remove_instruction(loop->BeginLoop->Next); /* BRK */
- rc_remove_instruction(loop->BeginLoop->Next); /* ENDIF */
+ /* SLT/SGE */
+ if(loop->BeginLoop->Next->U.I.Opcode != RC_OPCODE_SLT &&
+ loop->BeginLoop->Next->U.I.Opcode != RC_OPCODE_SGE){
+ rc_error(s->C,"Unexpected instruction, expected SLT/SGE\n");
+ return 0;
+ }
+ /* IF */
+ rc_remove_instruction(loop->BeginLoop->Next);
+ if(loop->BeginLoop->Next->U.I.Opcode != RC_OPCODE_IF){
+ rc_error(s->C,"Unexpected instruction, expected IF\n");
+ return 0;
+ }
+ rc_remove_instruction(loop->BeginLoop->Next);
+ /* BRK */
+ if(loop->BeginLoop->Next->U.I.Opcode != RC_OPCODE_BRK){
+ rc_error(s->C,"Unexpected instruction, expected BRK\n");
+ return 0;
+ }
+ rc_remove_instruction(loop->BeginLoop->Next);
+ /* ENDIF */
+ if(loop->BeginLoop->Next->U.I.Opcode != RC_OPCODE_ENDIF){
+ rc_error(s->C,"Unexpected instruction, expected ENDIF\n");
+ return 0;
+ }
+ rc_remove_instruction(loop->BeginLoop->Next);