1026 }
1027
1028 // Return number of relocation entries needed for this instruction.
1029 uint InstructForm::reloc(FormDict &globals) {
1030 uint reloc_entries = 0;
1031 // Check for "Call" nodes
1032 if ( is_ideal_call() ) ++reloc_entries;
1033 if ( is_ideal_return() ) ++reloc_entries;
1034 if ( is_ideal_safepoint() ) ++reloc_entries;
1035
1036
1037 // Check if operands MAYBE oop pointers, by checking for ConP elements
1038 // Proceed through the leaves of the match-tree and check for ConPs
1039 if ( _matrule != NULL ) {
1040 uint position = 0;
1041 const char *result = NULL;
1042 const char *name = NULL;
1043 const char *opType = NULL;
1044 while (_matrule->base_operand(position, globals, result, name, opType)) {
1045 if ( strcmp(opType,"ConP") == 0 ) {
1046 #ifdef SPARC
1047 reloc_entries += 2; // 1 for sethi + 1 for setlo
1048 #else
1049 ++reloc_entries;
1050 #endif
1051 }
1052 ++position;
1053 }
1054 }
1055
1056 // Above is only a conservative estimate
1057 // because it did not check contents of operand classes.
1058 // !!!!! !!!!!
1059 // Add 1 to reloc info for each operand class in the component list.
1060 Component *comp;
1061 _components.reset();
1062 while ( (comp = _components.iter()) != NULL ) {
1063 const Form *form = globals[comp->_type];
1064 assert( form, "Did not find component's type in global names");
1065 const OpClassForm *opc = form->is_opclass();
1066 const OperandForm *oper = form->is_operand();
1067 if ( opc && (oper == NULL) ) {
1068 ++reloc_entries;
1069 } else if ( oper ) {
1070 // floats and doubles loaded out of method's constant pool require reloc info
1071 Form::DataType type = oper->is_base_constant(globals);
1072 if ( (type == Form::idealF) || (type == Form::idealD) ) {
1073 ++reloc_entries;
1074 }
1075 }
1076 }
1077
1078 // Float and Double constants may come from the CodeBuffer table
1079 // and require relocatable addresses for access
1080 // !!!!!
1081 // Check for any component being an immediate float or double.
1082 Form::DataType data_type = is_chain_of_constant(globals);
1083 if( data_type==idealD || data_type==idealF ) {
1084 #ifdef SPARC
1085 // sparc required more relocation entries for floating constants
1086 // (expires 9/98)
1087 reloc_entries += 6;
1088 #else
1089 reloc_entries++;
1090 #endif
1091 }
1092
1093 return reloc_entries;
1094 }
1095
1096 // Utility function defined in archDesc.cpp
1097 extern bool is_def(int usedef);
1098
1099 // Return the result of reducing an instruction
1100 const char *InstructForm::reduce_result() {
1101 const char* result = "Universe"; // default
1102 _components.reset();
1103 Component *comp = _components.iter();
1104 if (comp != NULL && comp->isa(Component::DEF)) {
1105 result = comp->_type;
1106 // Override this if the rule is a store operation:
1107 if (_matrule && _matrule->_rChild &&
1108 is_store_to_memory(_matrule->_rChild->_opType))
1109 result = "Universe";
1110 }
|
1026 }
1027
1028 // Return number of relocation entries needed for this instruction.
1029 uint InstructForm::reloc(FormDict &globals) {
1030 uint reloc_entries = 0;
1031 // Check for "Call" nodes
1032 if ( is_ideal_call() ) ++reloc_entries;
1033 if ( is_ideal_return() ) ++reloc_entries;
1034 if ( is_ideal_safepoint() ) ++reloc_entries;
1035
1036
1037 // Check if operands MAYBE oop pointers, by checking for ConP elements
1038 // Proceed through the leaves of the match-tree and check for ConPs
1039 if ( _matrule != NULL ) {
1040 uint position = 0;
1041 const char *result = NULL;
1042 const char *name = NULL;
1043 const char *opType = NULL;
1044 while (_matrule->base_operand(position, globals, result, name, opType)) {
1045 if ( strcmp(opType,"ConP") == 0 ) {
1046 ++reloc_entries;
1047 }
1048 ++position;
1049 }
1050 }
1051
1052 // Above is only a conservative estimate
1053 // because it did not check contents of operand classes.
1054 // !!!!! !!!!!
1055 // Add 1 to reloc info for each operand class in the component list.
1056 Component *comp;
1057 _components.reset();
1058 while ( (comp = _components.iter()) != NULL ) {
1059 const Form *form = globals[comp->_type];
1060 assert( form, "Did not find component's type in global names");
1061 const OpClassForm *opc = form->is_opclass();
1062 const OperandForm *oper = form->is_operand();
1063 if ( opc && (oper == NULL) ) {
1064 ++reloc_entries;
1065 } else if ( oper ) {
1066 // floats and doubles loaded out of method's constant pool require reloc info
1067 Form::DataType type = oper->is_base_constant(globals);
1068 if ( (type == Form::idealF) || (type == Form::idealD) ) {
1069 ++reloc_entries;
1070 }
1071 }
1072 }
1073
1074 // Float and Double constants may come from the CodeBuffer table
1075 // and require relocatable addresses for access
1076 // !!!!!
1077 // Check for any component being an immediate float or double.
1078 Form::DataType data_type = is_chain_of_constant(globals);
1079 if( data_type==idealD || data_type==idealF ) {
1080 reloc_entries++;
1081 }
1082
1083 return reloc_entries;
1084 }
1085
1086 // Utility function defined in archDesc.cpp
1087 extern bool is_def(int usedef);
1088
1089 // Return the result of reducing an instruction
1090 const char *InstructForm::reduce_result() {
1091 const char* result = "Universe"; // default
1092 _components.reset();
1093 Component *comp = _components.iter();
1094 if (comp != NULL && comp->isa(Component::DEF)) {
1095 result = comp->_type;
1096 // Override this if the rule is a store operation:
1097 if (_matrule && _matrule->_rChild &&
1098 is_store_to_memory(_matrule->_rChild->_opType))
1099 result = "Universe";
1100 }
|