806 void *fill_candidate_datatypes_c::visit(il_instruction_c *symbol) { |
806 void *fill_candidate_datatypes_c::visit(il_instruction_c *symbol) { |
807 if (NULL == symbol->il_instruction) { |
807 if (NULL == symbol->il_instruction) { |
808 /* This empty/null il_instruction does not change the value of the current/default IL variable. |
808 /* This empty/null il_instruction does not change the value of the current/default IL variable. |
809 * So it inherits the candidate_datatypes from it's previous IL instructions! |
809 * So it inherits the candidate_datatypes from it's previous IL instructions! |
810 */ |
810 */ |
811 if (NULL != symbol->prev_il_instruction) |
811 if (!symbol->prev_il_instruction.empty()) { |
812 copy_candidate_datatype_list(symbol->prev_il_instruction /*from*/, symbol /*to*/); |
812 copy_candidate_datatype_list(symbol->prev_il_instruction[0] /*from*/, symbol /*to*/); |
|
813 for (unsigned int i = 1; i < symbol->prev_il_instruction.size(); i++) { |
|
814 intersect_candidate_datatype_list(symbol /*origin, dest.*/, symbol->prev_il_instruction[i] /*with*/); |
|
815 } |
|
816 } |
813 } else { |
817 } else { |
814 prev_il_instruction = symbol->prev_il_instruction; |
818 if (symbol->prev_il_instruction.size() > 1) ERROR; /* This assertion is only valid for now. Remove it once flow_control_analysis_c is complete */ |
|
819 if (symbol->prev_il_instruction.size() == 0) prev_il_instruction = NULL; |
|
820 else prev_il_instruction = symbol->prev_il_instruction[0]; |
815 symbol->il_instruction->accept(*this); |
821 symbol->il_instruction->accept(*this); |
816 prev_il_instruction = NULL; |
822 prev_il_instruction = NULL; |
817 |
823 |
818 /* This object has (inherits) the same candidate datatypes as the il_instruction */ |
824 /* This object has (inherits) the same candidate datatypes as the il_instruction */ |
819 copy_candidate_datatype_list(symbol->il_instruction /*from*/, symbol /*to*/); |
825 copy_candidate_datatype_list(symbol->il_instruction /*from*/, symbol /*to*/); |
1009 |
1015 |
1010 if (debug) std::cout << "simple_instr_list_c [" << symbol->candidate_datatypes.size() << "] result.\n"; |
1016 if (debug) std::cout << "simple_instr_list_c [" << symbol->candidate_datatypes.size() << "] result.\n"; |
1011 return NULL; |
1017 return NULL; |
1012 } |
1018 } |
1013 |
1019 |
|
1020 |
|
1021 |
|
1022 |
1014 // SYM_REF1(il_simple_instruction_c, il_simple_instruction, symbol_c *prev_il_instruction;) |
1023 // SYM_REF1(il_simple_instruction_c, il_simple_instruction, symbol_c *prev_il_instruction;) |
1015 void *fill_candidate_datatypes_c::visit(il_simple_instruction_c *symbol) { |
1024 void *fill_candidate_datatypes_c::visit(il_simple_instruction_c *symbol) { |
1016 prev_il_instruction = symbol->prev_il_instruction; |
1025 if (symbol->prev_il_instruction.size() > 1) ERROR; /* This assertion is only valid for now. Remove it once flow_control_analysis_c is complete */ |
|
1026 if (symbol->prev_il_instruction.size() == 0) prev_il_instruction = NULL; |
|
1027 else prev_il_instruction = symbol->prev_il_instruction[0]; |
1017 symbol->il_simple_instruction->accept(*this); |
1028 symbol->il_simple_instruction->accept(*this); |
1018 prev_il_instruction = NULL; |
1029 prev_il_instruction = NULL; |
1019 |
1030 |
1020 /* This object has (inherits) the same candidate datatypes as the il_simple_instruction it points to */ |
1031 /* This object has (inherits) the same candidate datatypes as the il_simple_instruction it points to */ |
1021 copy_candidate_datatype_list(symbol->il_simple_instruction /*from*/, symbol /*to*/); |
1032 copy_candidate_datatype_list(symbol->il_simple_instruction /*from*/, symbol /*to*/); |