src/share/vm/adlc/formsopt.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7119644 Sdiff src/share/vm/adlc

src/share/vm/adlc/formsopt.cpp

Print this page


   1 /*
   2  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  49 // record a new register class
  50 RegClass *RegisterForm::addRegClass(const char *className) {
  51   RegClass *regClass = new RegClass(className);
  52   _rclasses.addName(className);
  53   _regClass.Insert(className,regClass);
  54   return regClass;
  55 }
  56 
  57 // record a new register class
  58 AllocClass *RegisterForm::addAllocClass(char *className) {
  59   AllocClass *allocClass = new AllocClass(className);
  60   _aclasses.addName(className);
  61   _allocClass.Insert(className,allocClass);
  62   return allocClass;
  63 }
  64 
  65 // Called after parsing the Register block.  Record the register class
  66 // for spill-slots/regs.
  67 void RegisterForm::addSpillRegClass() {
  68   // Stack slots start at the next available even register number.
  69   _reg_ctr = (_reg_ctr+1) & ~1;
  70   const char *rc_name   = "stack_slots";
  71   RegClass   *reg_class = new RegClass(rc_name);
  72   reg_class->_stack_or_reg = true;
  73   _rclasses.addName(rc_name);
  74   _regClass.Insert(rc_name,reg_class);
  75 }
  76 
  77 
  78 // Provide iteration over all register definitions
  79 // in the order used by the register allocator
  80 void        RegisterForm::reset_RegDefs() {
  81   _current_ac = NULL;
  82   _aclasses.reset();
  83 }
  84 
  85 RegDef     *RegisterForm::iter_RegDefs() {
  86   // Check if we need to get the next AllocClass
  87   if ( _current_ac == NULL ) {
  88     const char *ac_name = _aclasses.iter();
  89     if( ac_name == NULL )   return NULL;   // No more allocation classes


 133   // Verify that every register has been placed into an allocation class
 134   RegDef *reg_def = NULL;
 135   reset_RegDefs();
 136   uint  num_register_zero = 0;
 137   while ( (reg_def = iter_RegDefs()) != NULL ) {
 138     if( reg_def->register_num() == 0 )  ++num_register_zero;
 139   }
 140   if( num_register_zero > 1 ) {
 141     fprintf(stderr,
 142             "ERROR: More than one register has been assigned register-number 0.\n"
 143             "Probably because a register has not been entered into an allocation class.\n");
 144   }
 145 
 146   return  valid;
 147 }
 148 
 149 // Compute RegMask size
 150 int RegisterForm::RegMask_Size() {
 151   // Need at least this many words
 152   int words_for_regs = (_reg_ctr + 31)>>5;
 153   // Add a few for incoming & outgoing arguments to calls.





 154   // Round up to the next doubleword size.
 155   return (words_for_regs + 2 + 1) & ~1;
 156 }
 157 
 158 void RegisterForm::dump() {                  // Debug printer
 159   output(stderr);
 160 }
 161 
 162 void RegisterForm::output(FILE *fp) {          // Write info to output files
 163   const char *name;
 164   fprintf(fp,"\n");
 165   fprintf(fp,"-------------------- Dump RegisterForm --------------------\n");
 166   for(_rdefs.reset(); (name = _rdefs.iter()) != NULL;) {
 167     ((RegDef*)_regDef[name])->output(fp);
 168   }
 169   fprintf(fp,"\n");
 170   for (_rclasses.reset(); (name = _rclasses.iter()) != NULL;) {
 171     ((RegClass*)_regClass[name])->output(fp);
 172   }
 173   fprintf(fp,"\n");
 174   for (_aclasses.reset(); (name = _aclasses.iter()) != NULL;) {
 175     ((AllocClass*)_allocClass[name])->output(fp);


   1 /*
   2  * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  49 // record a new register class
  50 RegClass *RegisterForm::addRegClass(const char *className) {
  51   RegClass *regClass = new RegClass(className);
  52   _rclasses.addName(className);
  53   _regClass.Insert(className,regClass);
  54   return regClass;
  55 }
  56 
  57 // record a new register class
  58 AllocClass *RegisterForm::addAllocClass(char *className) {
  59   AllocClass *allocClass = new AllocClass(className);
  60   _aclasses.addName(className);
  61   _allocClass.Insert(className,allocClass);
  62   return allocClass;
  63 }
  64 
  65 // Called after parsing the Register block.  Record the register class
  66 // for spill-slots/regs.
  67 void RegisterForm::addSpillRegClass() {
  68   // Stack slots start at the next available even register number.
  69   _reg_ctr = (_reg_ctr+7) & ~7;
  70   const char *rc_name   = "stack_slots";
  71   RegClass   *reg_class = new RegClass(rc_name);
  72   reg_class->_stack_or_reg = true;
  73   _rclasses.addName(rc_name);
  74   _regClass.Insert(rc_name,reg_class);
  75 }
  76 
  77 
  78 // Provide iteration over all register definitions
  79 // in the order used by the register allocator
  80 void        RegisterForm::reset_RegDefs() {
  81   _current_ac = NULL;
  82   _aclasses.reset();
  83 }
  84 
  85 RegDef     *RegisterForm::iter_RegDefs() {
  86   // Check if we need to get the next AllocClass
  87   if ( _current_ac == NULL ) {
  88     const char *ac_name = _aclasses.iter();
  89     if( ac_name == NULL )   return NULL;   // No more allocation classes


 133   // Verify that every register has been placed into an allocation class
 134   RegDef *reg_def = NULL;
 135   reset_RegDefs();
 136   uint  num_register_zero = 0;
 137   while ( (reg_def = iter_RegDefs()) != NULL ) {
 138     if( reg_def->register_num() == 0 )  ++num_register_zero;
 139   }
 140   if( num_register_zero > 1 ) {
 141     fprintf(stderr,
 142             "ERROR: More than one register has been assigned register-number 0.\n"
 143             "Probably because a register has not been entered into an allocation class.\n");
 144   }
 145 
 146   return  valid;
 147 }
 148 
 149 // Compute RegMask size
 150 int RegisterForm::RegMask_Size() {
 151   // Need at least this many words
 152   int words_for_regs = (_reg_ctr + 31)>>5;
 153   // The array of Register Mask bits should be large enough to cover
 154   // all the machine registers and all parameters that need to be passed
 155   // on the stack (stack registers) up to some interesting limit.  Methods
 156   // that need more parameters will NOT be compiled.  On Intel, the limit
 157   // is something like 90+ parameters.
 158   // Add a few (3 words == 96 bits) for incoming & outgoing arguments to calls.
 159   // Round up to the next doubleword size.
 160   return (words_for_regs + 3 + 1) & ~1;
 161 }
 162 
 163 void RegisterForm::dump() {                  // Debug printer
 164   output(stderr);
 165 }
 166 
 167 void RegisterForm::output(FILE *fp) {          // Write info to output files
 168   const char *name;
 169   fprintf(fp,"\n");
 170   fprintf(fp,"-------------------- Dump RegisterForm --------------------\n");
 171   for(_rdefs.reset(); (name = _rdefs.iter()) != NULL;) {
 172     ((RegDef*)_regDef[name])->output(fp);
 173   }
 174   fprintf(fp,"\n");
 175   for (_rclasses.reset(); (name = _rclasses.iter()) != NULL;) {
 176     ((RegClass*)_regClass[name])->output(fp);
 177   }
 178   fprintf(fp,"\n");
 179   for (_aclasses.reset(); (name = _aclasses.iter()) != NULL;) {
 180     ((AllocClass*)_allocClass[name])->output(fp);


src/share/vm/adlc/formsopt.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File