< prev index next >

src/hotspot/cpu/aarch64/register_aarch64.hpp

Print this page

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

226 CONSTANT_REGISTER_DECLARATION(FloatRegister, z26    , (26));
227 CONSTANT_REGISTER_DECLARATION(FloatRegister, z27    , (27));
228 CONSTANT_REGISTER_DECLARATION(FloatRegister, z28    , (28));
229 CONSTANT_REGISTER_DECLARATION(FloatRegister, z29    , (29));
230 CONSTANT_REGISTER_DECLARATION(FloatRegister, z30    , (30));
231 CONSTANT_REGISTER_DECLARATION(FloatRegister, z31    , (31));
232 
233 
234 class PRegisterImpl;
235 typedef PRegisterImpl* PRegister;
236 inline PRegister as_PRegister(int encoding) {
237   return (PRegister)(intptr_t)encoding;
238 }
239 
240 // The implementation of predicate registers for the architecture
241 class PRegisterImpl: public AbstractRegisterImpl {
242  public:
243   enum {
244     number_of_registers = 16,
245     number_of_governing_registers = 8,




246     max_slots_per_register = 1
247   };
248 
249   // construction
250   inline friend PRegister as_PRegister(int encoding);
251 
252   VMReg as_VMReg();
253 
254   // derived registers, offsets, and addresses
255   PRegister successor() const     { return as_PRegister(encoding() + 1); }
256 
257   // accessors
258   int   encoding() const          { assert(is_valid(), "invalid register"); return (intptr_t)this; }
259   int   encoding_nocheck() const  { return (intptr_t)this; }
260   bool  is_valid() const          { return 0 <= (intptr_t)this && (intptr_t)this < number_of_registers; }
261   bool  is_governing() const      { return 0 <= (intptr_t)this && (intptr_t)this < number_of_governing_registers; }
262   const char* name() const;
263 };
264 
265 // The predicate registers of SVE.

360     bits >>= 31 - end->encoding();
361 
362     return AbstractRegSet(bits);
363   }
364 
365   uint32_t bits() const { return _bitset; }
366 
367 private:
368 
369   RegImpl first();
370 
371 public:
372 
373   friend class RegSetIterator<RegImpl>;
374 
375   RegSetIterator<RegImpl> begin();
376 };
377 
378 typedef AbstractRegSet<Register> RegSet;
379 typedef AbstractRegSet<FloatRegister> FloatRegSet;

380 
381 template <class RegImpl>
382 class RegSetIterator {
383   AbstractRegSet<RegImpl> _regs;
384 
385 public:
386   RegSetIterator(AbstractRegSet<RegImpl> x): _regs(x) {}
387   RegSetIterator(const RegSetIterator& mit) : _regs(mit._regs) {}
388 
389   RegSetIterator& operator++() {
390     RegImpl r = _regs.first();
391     if (r->is_valid())
392       _regs -= r;
393     return *this;
394   }
395 
396   bool operator==(const RegSetIterator& rhs) const {
397     return _regs.bits() == rhs._regs.bits();
398   }
399   bool operator!=(const RegSetIterator& rhs) const {

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

226 CONSTANT_REGISTER_DECLARATION(FloatRegister, z26    , (26));
227 CONSTANT_REGISTER_DECLARATION(FloatRegister, z27    , (27));
228 CONSTANT_REGISTER_DECLARATION(FloatRegister, z28    , (28));
229 CONSTANT_REGISTER_DECLARATION(FloatRegister, z29    , (29));
230 CONSTANT_REGISTER_DECLARATION(FloatRegister, z30    , (30));
231 CONSTANT_REGISTER_DECLARATION(FloatRegister, z31    , (31));
232 
233 
234 class PRegisterImpl;
235 typedef PRegisterImpl* PRegister;
236 inline PRegister as_PRegister(int encoding) {
237   return (PRegister)(intptr_t)encoding;
238 }
239 
240 // The implementation of predicate registers for the architecture
241 class PRegisterImpl: public AbstractRegisterImpl {
242  public:
243   enum {
244     number_of_registers = 16,
245     number_of_governing_registers = 8,
246     // AArch64 has 8 governing predicate registers, but p7 is used as an
247     // all-1s register so the predicates to save are from p0 to p6 if we
248     // don't have non-governing predicate registers support.
249     number_of_saved_registers = number_of_governing_registers - 1,
250     max_slots_per_register = 1
251   };
252 
253   // construction
254   inline friend PRegister as_PRegister(int encoding);
255 
256   VMReg as_VMReg();
257 
258   // derived registers, offsets, and addresses
259   PRegister successor() const     { return as_PRegister(encoding() + 1); }
260 
261   // accessors
262   int   encoding() const          { assert(is_valid(), "invalid register"); return (intptr_t)this; }
263   int   encoding_nocheck() const  { return (intptr_t)this; }
264   bool  is_valid() const          { return 0 <= (intptr_t)this && (intptr_t)this < number_of_registers; }
265   bool  is_governing() const      { return 0 <= (intptr_t)this && (intptr_t)this < number_of_governing_registers; }
266   const char* name() const;
267 };
268 
269 // The predicate registers of SVE.

364     bits >>= 31 - end->encoding();
365 
366     return AbstractRegSet(bits);
367   }
368 
369   uint32_t bits() const { return _bitset; }
370 
371 private:
372 
373   RegImpl first();
374 
375 public:
376 
377   friend class RegSetIterator<RegImpl>;
378 
379   RegSetIterator<RegImpl> begin();
380 };
381 
382 typedef AbstractRegSet<Register> RegSet;
383 typedef AbstractRegSet<FloatRegister> FloatRegSet;
384 typedef AbstractRegSet<PRegister> PRegSet;
385 
386 template <class RegImpl>
387 class RegSetIterator {
388   AbstractRegSet<RegImpl> _regs;
389 
390 public:
391   RegSetIterator(AbstractRegSet<RegImpl> x): _regs(x) {}
392   RegSetIterator(const RegSetIterator& mit) : _regs(mit._regs) {}
393 
394   RegSetIterator& operator++() {
395     RegImpl r = _regs.first();
396     if (r->is_valid())
397       _regs -= r;
398     return *this;
399   }
400 
401   bool operator==(const RegSetIterator& rhs) const {
402     return _regs.bits() == rhs._regs.bits();
403   }
404   bool operator!=(const RegSetIterator& rhs) const {
< prev index next >