src/cpu/sparc/vm/register_sparc.hpp

Print this page




 232   enum Width {
 233     S = 1,  D = 2,  Q = 3
 234   };
 235 
 236   // construction
 237   VMReg as_VMReg( );
 238 
 239   // accessors
 240   int encoding() const                                { assert(is_valid(), "invalid register"); return value(); }
 241 
 242  public:
 243   int encoding(Width w) const {
 244     const int c = encoding();
 245     switch (w) {
 246       case S:
 247         assert(c < 32, "bad single float register");
 248         return c;
 249 
 250       case D:
 251         assert(c < 64  &&  (c & 1) == 0, "bad double float register");
 252         assert(c < 32 || VM_Version::v9_instructions_work(), "V9 float work only on V9 platform");
 253         return (c & 0x1e) | ((c & 0x20) >> 5);
 254 
 255       case Q:
 256         assert(c < 64  &&  (c & 3) == 0, "bad quad float register");
 257         assert(c < 32 || VM_Version::v9_instructions_work(), "V9 float work only on V9 platform");
 258         return (c & 0x1c) | ((c & 0x20) >> 5);
 259     }
 260     ShouldNotReachHere();
 261     return -1;
 262   }
 263 
 264   bool  is_valid() const                              { return 0 <= value() && value() < number_of_registers; }
 265   const char* name() const;
 266 
 267   FloatRegister successor() const                     { return as_FloatRegister(encoding() + 1); }
 268 };
 269 
 270 
 271 // The float registers of the SPARC architecture
 272 
 273 CONSTANT_REGISTER_DECLARATION(FloatRegister, fnoreg , (-1));
 274 
 275 CONSTANT_REGISTER_DECLARATION(FloatRegister, F0     , ( 0));
 276 CONSTANT_REGISTER_DECLARATION(FloatRegister, F1     , ( 1));
 277 CONSTANT_REGISTER_DECLARATION(FloatRegister, F2     , ( 2));




 232   enum Width {
 233     S = 1,  D = 2,  Q = 3
 234   };
 235 
 236   // construction
 237   VMReg as_VMReg( );
 238 
 239   // accessors
 240   int encoding() const                                { assert(is_valid(), "invalid register"); return value(); }
 241 
 242  public:
 243   int encoding(Width w) const {
 244     const int c = encoding();
 245     switch (w) {
 246       case S:
 247         assert(c < 32, "bad single float register");
 248         return c;
 249 
 250       case D:
 251         assert(c < 64  &&  (c & 1) == 0, "bad double float register");

 252         return (c & 0x1e) | ((c & 0x20) >> 5);
 253 
 254       case Q:
 255         assert(c < 64  &&  (c & 3) == 0, "bad quad float register");

 256         return (c & 0x1c) | ((c & 0x20) >> 5);
 257     }
 258     ShouldNotReachHere();
 259     return -1;
 260   }
 261 
 262   bool  is_valid() const                              { return 0 <= value() && value() < number_of_registers; }
 263   const char* name() const;
 264 
 265   FloatRegister successor() const                     { return as_FloatRegister(encoding() + 1); }
 266 };
 267 
 268 
 269 // The float registers of the SPARC architecture
 270 
 271 CONSTANT_REGISTER_DECLARATION(FloatRegister, fnoreg , (-1));
 272 
 273 CONSTANT_REGISTER_DECLARATION(FloatRegister, F0     , ( 0));
 274 CONSTANT_REGISTER_DECLARATION(FloatRegister, F1     , ( 1));
 275 CONSTANT_REGISTER_DECLARATION(FloatRegister, F2     , ( 2));