From d824eb8a0e9e93fc88e4c92ad8be746be44014d6 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 11 Mar 2020 18:20:00 -0400 Subject: [PATCH] CodeGen: Add constexpr to Register constructors --- include/llvm/CodeGen/Register.h | 6 +++--- include/llvm/MC/MCRegister.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/llvm/CodeGen/Register.h b/include/llvm/CodeGen/Register.h index aa5173684e2..a933a39185f 100644 --- a/include/llvm/CodeGen/Register.h +++ b/include/llvm/CodeGen/Register.h @@ -20,8 +20,8 @@ class Register { unsigned Reg; public: - Register(unsigned Val = 0): Reg(Val) {} - Register(MCRegister Val): Reg(Val) {} + constexpr Register(unsigned Val = 0): Reg(Val) {} + constexpr Register(MCRegister Val): Reg(Val) {} // Register numbers can represent physical registers, virtual registers, and // sometimes stack slots. The unsigned values are divided into these ranges: @@ -102,7 +102,7 @@ public: return virtReg2Index(Reg); } - operator unsigned() const { + constexpr operator unsigned() const { return Reg; } diff --git a/include/llvm/MC/MCRegister.h b/include/llvm/MC/MCRegister.h index 8372947a4ba..79a8dcdadb4 100644 --- a/include/llvm/MC/MCRegister.h +++ b/include/llvm/MC/MCRegister.h @@ -23,7 +23,7 @@ class MCRegister { unsigned Reg; public: - MCRegister(unsigned Val = 0): Reg(Val) {} + constexpr MCRegister(unsigned Val = 0): Reg(Val) {} // Register numbers can represent physical registers, virtual registers, and // sometimes stack slots. The unsigned values are divided into these ranges: @@ -60,7 +60,7 @@ public: return isPhysicalRegister(Reg); } - operator unsigned() const { + constexpr operator unsigned() const { return Reg; }