Mercurial > hg > graal-compiler
comparison src/share/vm/adlc/adlparse.cpp @ 14434:318d0622a6d7
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
Summary: extends MachCall nodes so that they can issue constants to the constant table
Reviewed-by: kvn
author | goetz |
---|---|
date | Wed, 20 Nov 2013 11:08:09 -0800 |
parents | 1410ad6b05f1 |
children | abec000618bf |
comparison
equal
deleted
inserted
replaced
14433:018b357638aa | 14434:318d0622a6d7 |
---|---|
2861 skipws(); | 2861 skipws(); |
2862 | 2862 |
2863 // Check if this instruct is a MachConstantNode. | 2863 // Check if this instruct is a MachConstantNode. |
2864 if (strcmp(rep_var, "constanttablebase") == 0) { | 2864 if (strcmp(rep_var, "constanttablebase") == 0) { |
2865 // This instruct is a MachConstantNode. | 2865 // This instruct is a MachConstantNode. |
2866 inst.set_is_mach_constant(true); | 2866 inst.set_needs_constant_base(true); |
2867 if (strncmp("MachCall", inst.mach_base_class(_globalNames), strlen("MachCall")) != 0 ) { | |
2868 inst.set_is_mach_constant(true); | |
2869 } | |
2867 | 2870 |
2868 if (_curchar == '(') { | 2871 if (_curchar == '(') { |
2869 parse_err(SYNERR, "constanttablebase in instruct %s cannot have an argument " | 2872 parse_err(SYNERR, "constanttablebase in instruct %s cannot have an argument " |
2870 "(only constantaddress and constantoffset)", ec_name); | 2873 "(only constantaddress and constantoffset)", ec_name); |
2871 return; | 2874 return; |
2963 | 2966 |
2964 // Parse the encode method's parameters | 2967 // Parse the encode method's parameters |
2965 while (_curchar != ')') { | 2968 while (_curchar != ')') { |
2966 char *param = get_ident_or_literal_constant("encoding operand"); | 2969 char *param = get_ident_or_literal_constant("encoding operand"); |
2967 if ( param != NULL ) { | 2970 if ( param != NULL ) { |
2968 // Found a parameter: | 2971 |
2969 // Check it is a local name, add it to the list, then check for more | 2972 // Check if this instruct is a MachConstantNode. |
2970 // New: allow hex constants as parameters to an encode method. | 2973 if (strcmp(param, "constanttablebase") == 0) { |
2971 // New: allow parenthesized expressions as parameters. | 2974 // This instruct is a MachConstantNode. |
2972 // New: allow "primary", "secondary", "tertiary" as parameters. | 2975 inst.set_needs_constant_base(true); |
2973 // New: allow user-defined register name as parameter | 2976 if (strncmp("MachCall", inst.mach_base_class(_globalNames), strlen("MachCall")) != 0 ) { |
2974 if ( (inst._localNames[param] == NULL) && | 2977 inst.set_is_mach_constant(true); |
2975 !ADLParser::is_literal_constant(param) && | 2978 } |
2976 (Opcode::as_opcode_type(param) == Opcode::NOT_AN_OPCODE) && | 2979 |
2977 ((_AD._register == NULL ) || (_AD._register->getRegDef(param) == NULL)) ) { | 2980 if (_curchar == '(') { |
2978 parse_err(SYNERR, "Using non-locally defined parameter %s for encoding %s.\n", param, ec_name); | 2981 parse_err(SYNERR, "constanttablebase in instruct %s cannot have an argument " |
2979 return; | 2982 "(only constantaddress and constantoffset)", ec_name); |
2983 return; | |
2984 } | |
2985 } else { | |
2986 // Found a parameter: | |
2987 // Check it is a local name, add it to the list, then check for more | |
2988 // New: allow hex constants as parameters to an encode method. | |
2989 // New: allow parenthesized expressions as parameters. | |
2990 // New: allow "primary", "secondary", "tertiary" as parameters. | |
2991 // New: allow user-defined register name as parameter | |
2992 if ( (inst._localNames[param] == NULL) && | |
2993 !ADLParser::is_literal_constant(param) && | |
2994 (Opcode::as_opcode_type(param) == Opcode::NOT_AN_OPCODE) && | |
2995 ((_AD._register == NULL ) || (_AD._register->getRegDef(param) == NULL)) ) { | |
2996 parse_err(SYNERR, "Using non-locally defined parameter %s for encoding %s.\n", param, ec_name); | |
2997 return; | |
2998 } | |
2980 } | 2999 } |
2981 params->add_entry(param); | 3000 params->add_entry(param); |
2982 | 3001 |
2983 skipws(); | 3002 skipws(); |
2984 if (_curchar == ',' ) { | 3003 if (_curchar == ',' ) { |
3120 // First check for constant table support. | 3139 // First check for constant table support. |
3121 | 3140 |
3122 // Check if this instruct is a MachConstantNode. | 3141 // Check if this instruct is a MachConstantNode. |
3123 if (strcmp(param, "constanttablebase") == 0) { | 3142 if (strcmp(param, "constanttablebase") == 0) { |
3124 // This instruct is a MachConstantNode. | 3143 // This instruct is a MachConstantNode. |
3125 inst.set_is_mach_constant(true); | 3144 inst.set_needs_constant_base(true); |
3145 if (strncmp("MachCall", inst.mach_base_class(_globalNames), strlen("MachCall")) != 0 ) { | |
3146 inst.set_is_mach_constant(true); | |
3147 } | |
3126 | 3148 |
3127 if (_curchar == '(') { | 3149 if (_curchar == '(') { |
3128 parse_err(SYNERR, "constanttablebase in instruct %s cannot have an argument " | 3150 parse_err(SYNERR, "constanttablebase in instruct %s cannot have an argument " |
3129 "(only constantaddress and constantoffset)", ec_name); | 3151 "(only constantaddress and constantoffset)", ec_name); |
3130 return; | 3152 return; |