< prev index next >

src/hotspot/share/opto/regmask.cpp

Print this page
rev 53521 : 8217869: Add count_leading_zeros utility
Reviewed-by: TBD


  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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "opto/ad.hpp"
  27 #include "opto/compile.hpp"
  28 #include "opto/matcher.hpp"
  29 #include "opto/node.hpp"
  30 #include "opto/regmask.hpp"
  31 #include "utilities/population_count.hpp"
  32 
  33 #define RM_SIZE _RM_SIZE /* a constant private to the class RegMask */
  34 
  35 //-------------Non-zero bit search methods used by RegMask---------------------
  36 // Find highest 1, or return 32 if empty
  37 int find_highest_bit( uint32_t mask ) {
  38   int n = 0;
  39   if( mask > 0xffff ) {
  40     mask >>= 16;
  41     n += 16;
  42   }
  43   if( mask > 0xff ) {
  44     mask >>= 8;
  45     n += 8;
  46   }
  47   if( mask > 0xf ) {
  48     mask >>= 4;
  49     n += 4;
  50   }
  51   if( mask > 0x3 ) {
  52     mask >>= 2;
  53     n += 2;
  54   }
  55   if( mask > 0x1 ) {
  56     mask >>= 1;
  57     n += 1;
  58   }
  59   if( mask == 0 ) {
  60     n = 32;
  61   }
  62   return n;
  63 }
  64 
  65 //------------------------------dump-------------------------------------------
  66 
  67 #ifndef PRODUCT
  68 void OptoReg::dump(int r, outputStream *st) {
  69   switch (r) {
  70   case Special: st->print("r---"); break;
  71   case Bad:     st->print("rBAD"); break;
  72   default:
  73     if (r < _last_Mach_Reg) st->print("%s", Matcher::regName[r]);
  74     else st->print("rS%d",r);
  75     break;
  76   }
  77 }
  78 #endif
  79 
  80 
  81 //=============================================================================
  82 const RegMask RegMask::Empty(
  83 # define BODY(I) 0,
  84   FORALL_BODY




  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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "opto/ad.hpp"
  27 #include "opto/compile.hpp"
  28 #include "opto/matcher.hpp"
  29 #include "opto/node.hpp"
  30 #include "opto/regmask.hpp"
  31 #include "utilities/population_count.hpp"
  32 
  33 #define RM_SIZE _RM_SIZE /* a constant private to the class RegMask */
  34 






























  35 //------------------------------dump-------------------------------------------
  36 
  37 #ifndef PRODUCT
  38 void OptoReg::dump(int r, outputStream *st) {
  39   switch (r) {
  40   case Special: st->print("r---"); break;
  41   case Bad:     st->print("rBAD"); break;
  42   default:
  43     if (r < _last_Mach_Reg) st->print("%s", Matcher::regName[r]);
  44     else st->print("rS%d",r);
  45     break;
  46   }
  47 }
  48 #endif
  49 
  50 
  51 //=============================================================================
  52 const RegMask RegMask::Empty(
  53 # define BODY(I) 0,
  54   FORALL_BODY


< prev index next >