647 // Machine independent loads must be checked for anti-dependences |
647 // Machine independent loads must be checked for anti-dependences |
648 // Check if instruction has a USE of a memory operand class, or a def. |
648 // Check if instruction has a USE of a memory operand class, or a def. |
649 int USE_of_memory = 0; |
649 int USE_of_memory = 0; |
650 int DEF_of_memory = 0; |
650 int DEF_of_memory = 0; |
651 const char* last_memory_DEF = NULL; // to test DEF/USE pairing in asserts |
651 const char* last_memory_DEF = NULL; // to test DEF/USE pairing in asserts |
|
652 const char* last_memory_USE = NULL; |
652 Component *unique = NULL; |
653 Component *unique = NULL; |
653 Component *comp = NULL; |
654 Component *comp = NULL; |
654 ComponentList &components = (ComponentList &)_components; |
655 ComponentList &components = (ComponentList &)_components; |
655 |
656 |
656 components.reset(); |
657 components.reset(); |
668 } else if( comp->isa(Component::USE) ) { |
669 } else if( comp->isa(Component::USE) ) { |
669 if( last_memory_DEF != NULL ) { |
670 if( last_memory_DEF != NULL ) { |
670 assert(0 == strcmp(last_memory_DEF, comp->_name), "every memory DEF is followed by a USE of the same name"); |
671 assert(0 == strcmp(last_memory_DEF, comp->_name), "every memory DEF is followed by a USE of the same name"); |
671 last_memory_DEF = NULL; |
672 last_memory_DEF = NULL; |
672 } |
673 } |
673 USE_of_memory++; |
674 // Handles same memory being used multiple times in the case of BMI1 instructions. |
|
675 if (last_memory_USE != NULL) { |
|
676 if (strcmp(comp->_name, last_memory_USE) != 0) { |
|
677 USE_of_memory++; |
|
678 } |
|
679 } else { |
|
680 USE_of_memory++; |
|
681 } |
|
682 last_memory_USE = comp->_name; |
|
683 |
674 if (DEF_of_memory == 0) // defs take precedence |
684 if (DEF_of_memory == 0) // defs take precedence |
675 unique = comp; |
685 unique = comp; |
676 } else { |
686 } else { |
677 assert(last_memory_DEF == NULL, "unpaired memory DEF"); |
687 assert(last_memory_DEF == NULL, "unpaired memory DEF"); |
678 } |
688 } |