diff 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
line wrap: on
line diff
--- a/src/share/vm/adlc/adlparse.cpp	Tue Nov 19 11:53:58 2013 -0800
+++ b/src/share/vm/adlc/adlparse.cpp	Wed Nov 20 11:08:09 2013 -0800
@@ -2863,7 +2863,10 @@
       // Check if this instruct is a MachConstantNode.
       if (strcmp(rep_var, "constanttablebase") == 0) {
         // This instruct is a MachConstantNode.
-        inst.set_is_mach_constant(true);
+        inst.set_needs_constant_base(true);
+        if (strncmp("MachCall", inst.mach_base_class(_globalNames), strlen("MachCall")) != 0 ) {
+          inst.set_is_mach_constant(true);
+        }
 
         if (_curchar == '(')  {
           parse_err(SYNERR, "constanttablebase in instruct %s cannot have an argument "
@@ -2965,18 +2968,34 @@
       while (_curchar != ')') {
         char *param = get_ident_or_literal_constant("encoding operand");
         if ( param != NULL ) {
-          // Found a parameter:
-          // Check it is a local name, add it to the list, then check for more
-          // New: allow hex constants as parameters to an encode method.
-          // New: allow parenthesized expressions as parameters.
-          // New: allow "primary", "secondary", "tertiary" as parameters.
-          // New: allow user-defined register name as parameter
-          if ( (inst._localNames[param] == NULL) &&
-               !ADLParser::is_literal_constant(param) &&
-               (Opcode::as_opcode_type(param) == Opcode::NOT_AN_OPCODE) &&
-               ((_AD._register == NULL ) || (_AD._register->getRegDef(param) == NULL)) ) {
-            parse_err(SYNERR, "Using non-locally defined parameter %s for encoding %s.\n", param, ec_name);
-            return;
+
+          // Check if this instruct is a MachConstantNode.
+          if (strcmp(param, "constanttablebase") == 0) {
+            // This instruct is a MachConstantNode.
+            inst.set_needs_constant_base(true);
+            if (strncmp("MachCall", inst.mach_base_class(_globalNames), strlen("MachCall")) != 0 ) {
+              inst.set_is_mach_constant(true);
+            }
+
+            if (_curchar == '(')  {
+              parse_err(SYNERR, "constanttablebase in instruct %s cannot have an argument "
+                        "(only constantaddress and constantoffset)", ec_name);
+              return;
+            }
+          } else {
+            // Found a parameter:
+            // Check it is a local name, add it to the list, then check for more
+            // New: allow hex constants as parameters to an encode method.
+            // New: allow parenthesized expressions as parameters.
+            // New: allow "primary", "secondary", "tertiary" as parameters.
+            // New: allow user-defined register name as parameter
+            if ( (inst._localNames[param] == NULL) &&
+                 !ADLParser::is_literal_constant(param) &&
+                 (Opcode::as_opcode_type(param) == Opcode::NOT_AN_OPCODE) &&
+                 ((_AD._register == NULL ) || (_AD._register->getRegDef(param) == NULL)) ) {
+              parse_err(SYNERR, "Using non-locally defined parameter %s for encoding %s.\n", param, ec_name);
+              return;
+            }
           }
           params->add_entry(param);
 
@@ -3122,7 +3141,10 @@
           // Check if this instruct is a MachConstantNode.
           if (strcmp(param, "constanttablebase") == 0) {
             // This instruct is a MachConstantNode.
-            inst.set_is_mach_constant(true);
+            inst.set_needs_constant_base(true);
+            if (strncmp("MachCall", inst.mach_base_class(_globalNames), strlen("MachCall")) != 0 ) {
+              inst.set_is_mach_constant(true);
+            }
 
             if (_curchar == '(') {
               parse_err(SYNERR, "constanttablebase in instruct %s cannot have an argument "