Skip to content

Commit

Permalink
8302907: [PPC64] Use more constexpr in class Register
Browse files Browse the repository at this point in the history
Backport-of: 180b94c73e9ad17d57650d4c985d4104289052a9
  • Loading branch information
TheRealMDoerr committed May 14, 2024
1 parent e0dba38 commit d2b9c01
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/hotspot/cpu/ppc/register_ppc.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022 SAP SE. All rights reserved.
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -92,14 +92,14 @@ class Register {
inline constexpr friend Register as_Register(int encoding);

// accessors
int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
constexpr int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
inline VMReg as_VMReg() const;
Register successor() const { return Register(encoding() + 1); }

// testers
bool is_valid() const { return ( 0 <= _encoding && _encoding < number_of_registers); }
bool is_volatile() const { return ( 0 <= _encoding && _encoding <= 13 ); }
bool is_nonvolatile() const { return (14 <= _encoding && _encoding <= 31 ); }
constexpr bool is_valid() const { return ( 0 <= _encoding && _encoding < number_of_registers); }
constexpr bool is_volatile() const { return ( 0 <= _encoding && _encoding <= 13 ); }
constexpr bool is_nonvolatile() const { return (14 <= _encoding && _encoding <= 31 ); }

const char* name() const;
};
Expand Down Expand Up @@ -163,12 +163,12 @@ class ConditionRegister {
inline constexpr friend ConditionRegister as_ConditionRegister(int encoding);

// accessors
int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
constexpr int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
inline VMReg as_VMReg() const;

// testers
bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }
bool is_nonvolatile() const { return (2 <= _encoding && _encoding <= 4 ); }
constexpr bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }
constexpr bool is_nonvolatile() const { return (2 <= _encoding && _encoding <= 4 ); }

const char* name() const;
};
Expand Down Expand Up @@ -207,12 +207,12 @@ class FloatRegister {
inline constexpr friend FloatRegister as_FloatRegister(int encoding);

// accessors
int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
constexpr int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
inline VMReg as_VMReg() const;
FloatRegister successor() const { return FloatRegister(encoding() + 1); }

// testers
bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }
constexpr bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }

const char* name() const;

Expand Down Expand Up @@ -279,11 +279,11 @@ class SpecialRegister {
inline constexpr friend SpecialRegister as_SpecialRegister(int encoding);

// accessors
int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
constexpr int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
inline VMReg as_VMReg() const;

// testers
bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }
constexpr bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }

const char* name() const;
};
Expand Down Expand Up @@ -318,10 +318,10 @@ class VectorRegister {
inline constexpr friend VectorRegister as_VectorRegister(int encoding);

// accessors
int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
constexpr int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }

// testers
bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }
constexpr bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }

const char* name() const;

Expand Down Expand Up @@ -387,11 +387,11 @@ class VectorSRegister {
inline constexpr friend VectorSRegister as_VectorSRegister(int encoding);

// accessors
int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
constexpr int encoding() const { assert(is_valid(), "invalid register"); return _encoding; }
inline VMReg as_VMReg() const;

// testers
bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }
constexpr bool is_valid() const { return (0 <= _encoding && _encoding < number_of_registers); }

const char* name() const;

Expand Down

1 comment on commit d2b9c01

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.