Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/57013 )

Change subject: arch-x86: Dedent and constexpr-ize x86_traits.hh.
......................................................................

arch-x86: Dedent and constexpr-ize x86_traits.hh.

Change-Id: I285a9868be9cf4cee13bf572d9f914485e60ca26
---
M src/arch/x86/x86_traits.hh
1 file changed, 58 insertions(+), 52 deletions(-)



diff --git a/src/arch/x86/x86_traits.hh b/src/arch/x86/x86_traits.hh
index 71d0929..113326e 100644
--- a/src/arch/x86/x86_traits.hh
+++ b/src/arch/x86/x86_traits.hh
@@ -42,64 +42,61 @@

 #include "base/types.hh"

-namespace gem5
+namespace gem5::X86ISA
 {

-namespace X86ISA
+constexpr int NumMicroIntRegs = 16;
+
+constexpr int NumMMXRegs = 8;
+constexpr int NumXMMRegs = 16;
+constexpr int NumMicroFpRegs = 8;
+
+constexpr int NumCRegs = 16;
+constexpr int NumDRegs = 8;
+
+constexpr int NumSegments = 6;
+constexpr int NumSysSegments = 4;
+
+constexpr Addr IntAddrPrefixMask = 0xffffffff00000000ULL;
+constexpr Addr IntAddrPrefixIO = 0x300000000ULL;
+
+constexpr Addr PhysAddrPrefixIO = 0x8000000000000000ULL;
+constexpr Addr PhysAddrPrefixPciConfig = 0xC000000000000000ULL;
+constexpr Addr PhysAddrPrefixLocalAPIC = 0x2000000000000000ULL;
+constexpr Addr PhysAddrPrefixInterrupts = 0xA000000000000000ULL;
+// Each APIC gets two pages. One page is used for local apics to field
+// accesses from the CPU, and the other is for all APICs to communicate.
+constexpr Addr PhysAddrAPICRangeSize = 1 << 12;
+
+// Put this in an unused part of the 16 bit IO port address space.
+constexpr Addr PhysAddrIntA = 0x8000000100000000ULL;
+
+static constexpr inline Addr
+x86IOAddress(const uint32_t port)
 {
-    const int NumMicroIntRegs = 16;
+    return PhysAddrPrefixIO | port;
+}

-    const int NumMMXRegs = 8;
-    const int NumXMMRegs = 16;
-    const int NumMicroFpRegs = 8;
+static constexpr inline Addr
+x86PciConfigAddress(const uint32_t addr)
+{
+    return PhysAddrPrefixPciConfig | addr;
+}

-    const int NumCRegs = 16;
-    const int NumDRegs = 8;
+static constexpr inline Addr
+x86LocalAPICAddress(const uint8_t id, const uint16_t addr)
+{
+    assert(addr < (1 << 12));
+    return PhysAddrPrefixLocalAPIC | (id * (1 << 12)) | addr;
+}

-    const int NumSegments = 6;
-    const int NumSysSegments = 4;
+static constexpr inline Addr
+x86InterruptAddress(const uint8_t id, const uint16_t addr)
+{
+    assert(addr < PhysAddrAPICRangeSize);
+    return PhysAddrPrefixInterrupts | (id * PhysAddrAPICRangeSize) | addr;
+}

-    const Addr IntAddrPrefixMask = 0xffffffff00000000ULL;
-    const Addr IntAddrPrefixIO = 0x300000000ULL;
-
-    const Addr PhysAddrPrefixIO = 0x8000000000000000ULL;
-    const Addr PhysAddrPrefixPciConfig = 0xC000000000000000ULL;
-    const Addr PhysAddrPrefixLocalAPIC = 0x2000000000000000ULL;
-    const Addr PhysAddrPrefixInterrupts = 0xA000000000000000ULL;
-    // Each APIC gets two pages. One page is used for local apics to field
- // accesses from the CPU, and the other is for all APICs to communicate.
-    const Addr PhysAddrAPICRangeSize = 1 << 12;
-
-    // Put this in an unused part of the 16 bit IO port address space.
-    const Addr PhysAddrIntA = 0x8000000100000000ULL;
-
-    static inline Addr
-    x86IOAddress(const uint32_t port)
-    {
-        return PhysAddrPrefixIO | port;
-    }
-
-    static inline Addr
-    x86PciConfigAddress(const uint32_t addr)
-    {
-        return PhysAddrPrefixPciConfig | addr;
-    }
-
-    static inline Addr
-    x86LocalAPICAddress(const uint8_t id, const uint16_t addr)
-    {
-        assert(addr < (1 << 12));
-        return PhysAddrPrefixLocalAPIC | (id * (1 << 12)) | addr;
-    }
-
-    static inline Addr
-    x86InterruptAddress(const uint8_t id, const uint16_t addr)
-    {
-        assert(addr < PhysAddrAPICRangeSize);
- return PhysAddrPrefixInterrupts | (id * PhysAddrAPICRangeSize) | addr;
-    }
-
-} // namespace X86ISA
-} // namespace gem5
+} // namespace gem5::X86ISA

 #endif //__ARCH_X86_X86TRAITS_HH__

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/57013
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I285a9868be9cf4cee13bf572d9f914485e60ca26
Gerrit-Change-Number: 57013
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to