stage3/flow_control_analysis.cc
changeset 1041 56ebe2a31b5b
parent 690 6156ee2b4e32
equal deleted inserted replaced
1040:e8563dcaefca 1041:56ebe2a31b5b
   216 // SYM_LIST(instruction_list_c)
   216 // SYM_LIST(instruction_list_c)
   217 void *flow_control_analysis_c::visit(instruction_list_c *symbol) {
   217 void *flow_control_analysis_c::visit(instruction_list_c *symbol) {
   218 	prev_il_instruction_is_JMP_or_RET = false;
   218 	prev_il_instruction_is_JMP_or_RET = false;
   219 	for(int i = 0; i < symbol->n; i++) {
   219 	for(int i = 0; i < symbol->n; i++) {
   220 		prev_il_instruction = NULL;
   220 		prev_il_instruction = NULL;
   221 		if (i > 0) prev_il_instruction = symbol->elements[i-1];
   221 		if (i > 0) prev_il_instruction = symbol->get_element(i-1);
   222 		curr_il_instruction = symbol->elements[i];
   222 		curr_il_instruction = symbol->get_element(i);
   223 		curr_il_instruction->accept(*this);
   223 		curr_il_instruction->accept(*this);
   224 		curr_il_instruction = NULL;
   224 		curr_il_instruction = NULL;
   225 	}
   225 	}
   226 	return NULL;
   226 	return NULL;
   227 }
   227 }
   308 
   308 
   309 //  void *visit(il_operand_list_c *symbol);
   309 //  void *visit(il_operand_list_c *symbol);
   310 void *flow_control_analysis_c::visit(simple_instr_list_c *symbol) {
   310 void *flow_control_analysis_c::visit(simple_instr_list_c *symbol) {
   311 	for(int i = 0; i < symbol->n; i++) {
   311 	for(int i = 0; i < symbol->n; i++) {
   312 		/* The prev_il_instruction for element[0] was set in visit(il_expression_c *) */
   312 		/* The prev_il_instruction for element[0] was set in visit(il_expression_c *) */
   313 		if (i>0) prev_il_instruction = symbol->elements[i-1];
   313 		if (i>0) prev_il_instruction = symbol->get_element(i-1);
   314 		symbol->elements[i]->accept(*this);
   314 		symbol->get_element(i)->accept(*this);
   315 	}
   315 	}
   316 	return NULL;
   316 	return NULL;
   317 }
   317 }
   318 
   318 
   319 
   319