arm,sparc,x86,base,cpu,sim: Replace the Twin(32|64)_t types with.
authorGabe Black <gabeblack@google.com>
Wed, 13 Dec 2017 08:53:34 +0000 (00:53 -0800)
committerGabe Black <gabeblack@google.com>
Wed, 13 Dec 2017 23:51:59 +0000 (23:51 +0000)
Replace them with std::array<>s.

Change-Id: I76624c87a1cd9b21c386a96147a18de92b8a8a34
Reviewed-on: https://gem5-review.googlesource.com/6602
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
17 files changed:
src/arch/arm/isa/insts/ldr64.isa
src/arch/arm/isa/insts/str64.isa
src/arch/arm/isa/operands.isa
src/arch/generic/memhelpers.hh
src/arch/sparc/isa/decoder.isa
src/arch/sparc/isa/includes.isa
src/arch/sparc/isa/operands.isa
src/arch/sparc/types.hh
src/arch/x86/isa/includes.isa
src/base/SConscript
src/base/bigint.cc [deleted file]
src/base/bigint.hh [deleted file]
src/cpu/simple/atomic.cc
src/cpu/simple/timing.cc
src/mem/packet_access.hh
src/sim/byteswap.hh
src/sim/insttracer.hh

index eea925e66fdf147d06061907d22f0ecfaa2a6531..e035e1d7eb74ed4a6b991f20316d02e4398300c5 100644 (file)
@@ -198,14 +198,11 @@ let {{
                     '''
                 elif self.size == 16:
                     accCode = '''
-                    Twin64_t data = cSwap(Mem%s,
-                                          isBigEndian64(xc->tcBase()));
-
-
-                    AA64FpDestP0_uw = (uint32_t)data.a;
-                    AA64FpDestP1_uw = (data.a >> 32);
-                    AA64FpDestP2_uw = (uint32_t)data.b;
-                    AA64FpDestP3_uw = (data.b >> 32);
+                    auto data = cSwap(Mem%s, isBigEndian64(xc->tcBase()));
+                    AA64FpDestP0_uw = (uint32_t)data[0];
+                    AA64FpDestP1_uw = (data[0] >> 32);
+                    AA64FpDestP2_uw = (uint32_t)data[1];
+                    AA64FpDestP3_uw = (data[1] >> 32);
                     '''
             elif self.flavor == "widen" or self.size == 8:
                 accCode = "XDest = cSwap(Mem%s, isBigEndian64(xc->tcBase()));"
@@ -242,12 +239,12 @@ let {{
                     '''
                 elif self.size == 8:
                     accCode = '''
-                        AA64FpDestP0_uw = (uint32_t)Mem_tud.a;
-                        AA64FpDestP1_uw = (uint32_t)(Mem_tud.a >> 32);
+                        AA64FpDestP0_uw = (uint32_t)Mem_tud[0];
+                        AA64FpDestP1_uw = (uint32_t)(Mem_tud[0] >> 32);
                         AA64FpDestP2_uw = 0;
                         AA64FpDestP3_uw = 0;
-                        AA64FpDest2P0_uw = (uint32_t)Mem_tud.b;
-                        AA64FpDest2P1_uw = (uint32_t)(Mem_tud.b >> 32);
+                        AA64FpDest2P0_uw = (uint32_t)Mem_tud[1];
+                        AA64FpDest2P1_uw = (uint32_t)(Mem_tud[1] >> 32);
                         AA64FpDest2P2_uw = 0;
                         AA64FpDest2P3_uw = 0;
                     '''
@@ -262,8 +259,8 @@ let {{
                         '''
                     elif self.size == 8:
                         accCode = '''
-                            XDest = Mem_tud.a;
-                            XDest2 = Mem_tud.b;
+                            XDest = Mem_tud[0];
+                            XDest2 = Mem_tud[1];
                         '''
                 else:
                     if self.size == 4:
@@ -275,8 +272,8 @@ let {{
                         '''
                     elif self.size == 8:
                         accCode = '''
-                            XDest = Mem_tud.a;
-                            XDest2 = Mem_tud.b;
+                            XDest = Mem_tud[0];
+                            XDest2 = Mem_tud[1];
                         '''
             self.codeBlobs["memacc_code"] = accCode
 
index 0b153c1ec2d3ee89d6589c6777e16f8f6770c574..324d1fc6920324e0b38b889be4898d6890368f13 100644 (file)
@@ -226,9 +226,9 @@ let {{
                     accCode = '''
                         // This temporary needs to be here so that the parser
                         // will correctly identify this instruction as a store.
-                        Twin64_t temp;
-                        temp.a = XDest_ud;
-                        temp.b = XDest2_ud;
+                        std::array<uint64_t, 2> temp;
+                        temp[0] = XDest_ud;
+                        temp[1] = XDest2_ud;
                         Mem_tud = temp;
                     '''
             self.codeBlobs["memacc_code"] = accCode
index 2e2955a80510c8745b1fb2716be990ecf9edb2cc..babf0accfb266be56f71eb2207f2e69a57ddb6a3 100644 (file)
@@ -47,7 +47,7 @@ def operand_types {{
     'sw' : 'int32_t',
     'uw' : 'uint32_t',
     'ud' : 'uint64_t',
-    'tud' : 'Twin64_t',
+    'tud' : 'std::array<uint64_t, 2>',
     'sf' : 'float',
     'df' : 'double',
     'vc' : 'TheISA::VecRegContainer',
index a0359a5a76dd2375b935667bc9b7782b7e15b786..35e666b922c5de78ac816910650475c9fc7af044 100644 (file)
@@ -114,7 +114,7 @@ writeMemAtomic(XC *xc, Trace::InstRecord *traceData, const MemT &mem,
           xc->writeMem((uint8_t *)&host_mem, sizeof(MemT), addr, flags, res);
     if (fault == NoFault && res != NULL) {
         if (flags & Request::MEM_SWAP || flags & Request::MEM_SWAP_COND)
-            *res = TheISA::gtoh((MemT)*res);
+            *(MemT *)res = TheISA::gtoh(*(MemT *)res);
         else
             *res = TheISA::gtoh(*res);
     }
index 8c23d5f0317419a64f8f95197632730219b28fd9..6ca52c406261ad1af307f7ebd295c74d30699bd2 100644 (file)
@@ -1102,8 +1102,8 @@ decode OP default Unknown::unknown()
             0x01: ldub({{Rd = Mem_ub;}});
             0x02: lduh({{Rd = Mem_uhw;}});
             0x03: ldtw({{
-                        RdLow = (Mem_tuw).a;
-                        RdHigh = (Mem_tuw).b;
+                        RdLow = Mem_tuw[0];
+                        RdHigh = Mem_tuw[1];
             }});
         }
         format Store {
@@ -1115,9 +1115,9 @@ decode OP default Unknown::unknown()
                       // will correctly identify this instruction as a store.
                       // It's probably either the parenthesis or referencing
                       // the member variable that throws confuses it.
-                      Twin32_t temp;
-                      temp.a = RdLow<31:0>;
-                      temp.b = RdHigh<31:0>;
+                      std::array<uint32_t, 2> temp;
+                      temp[0] = RdLow<31:0>;
+                      temp[1] = RdHigh<31:0>;
                       Mem_tuw = temp;
                   }});
         }
@@ -1145,63 +1145,63 @@ decode OP default Unknown::unknown()
             0x13: decode EXT_ASI {
                 // ASI_LDTD_AIUP
                 0x22: TwinLoad::ldtx_aiup(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 // ASI_LDTD_AIUS
                 0x23: TwinLoad::ldtx_aius(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 // ASI_QUAD_LDD
                 0x24: TwinLoad::ldtx_quad_ldd(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 // ASI_LDTX_REAL
                 0x26: TwinLoad::ldtx_real(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 // ASI_LDTX_N
                 0x27: TwinLoad::ldtx_n(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 // ASI_LDTX_AIUP_L
                 0x2A: TwinLoad::ldtx_aiup_l(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 // ASI_LDTX_AIUS_L
                 0x2B: TwinLoad::ldtx_aius_l(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 // ASI_LDTX_L
                 0x2C: TwinLoad::ldtx_l(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 // ASI_LDTX_REAL_L
                 0x2E: TwinLoad::ldtx_real_l(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 // ASI_LDTX_N_L
                 0x2F: TwinLoad::ldtx_n_l(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 // ASI_LDTX_P
                 0xE2: TwinLoad::ldtx_p(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 // ASI_LDTX_S
                 0xE3: TwinLoad::ldtx_s(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 // ASI_LDTX_PL
                 0xEA: TwinLoad::ldtx_pl(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 // ASI_LDTX_SL
                 0xEB: TwinLoad::ldtx_sl(
-                    {{RdLow_udw = (Mem_tudw).a;
-                      RdHigh_udw = (Mem_tudw).b;}});
+                    {{RdLow_udw = Mem_tudw[0];
+                      RdHigh_udw = Mem_tudw[1];}});
                 default: ldtwa({{
-                        RdLow = (Mem_tuw).a;
-                        RdHigh = (Mem_tuw).b;}});
+                        RdLow = Mem_tuw[0];
+                        RdHigh = Mem_tuw[1];}});
             }
         }
         format StoreAlt {
@@ -1213,9 +1213,9 @@ decode OP default Unknown::unknown()
                       // will correctly identify this instruction as a store.
                       // It's probably either the parenthesis or referencing
                       // the member variable that throws confuses it.
-                      Twin32_t temp;
-                      temp.a = RdLow<31:0>;
-                      temp.b = RdHigh<31:0>;
+                      std::array<uint32_t, 2> temp;
+                      temp[0] = RdLow<31:0>;
+                      temp[1] = RdHigh<31:0>;
                       Mem_tuw = temp;
                   }});
         }
index ff48b0aec3fccc77971183874fc8de9c1de208ef..0ff93a873bcbec3c7a7a040215065ebfbc226f8c 100644 (file)
@@ -80,7 +80,6 @@ output exec {{
 
 #include "arch/generic/memhelpers.hh"
 #include "arch/sparc/asi.hh"
-#include "base/bigint.hh"
 #include "cpu/base.hh"
 #include "cpu/exetrace.hh"
 #include "debug/Sparc.hh"
index 32a39bbee3dea17c4138838aa9df369050402a6e..26c0d87a7279c733128aecc4ecff872df1c0324e 100644 (file)
@@ -37,8 +37,8 @@ def operand_types {{
     'uw' : 'uint32_t',
     'sdw' : 'int64_t',
     'udw' : 'uint64_t',
-    'tudw' : 'Twin64_t',
-    'tuw' : 'Twin32_t',
+    'tudw' : 'std::array<uint64_t, 2>',
+    'tuw' : 'std::array<uint32_t, 2>',
     'sf' : 'float',
     'df' : 'double',
 
index ec88b9e2cb8ff6fac5fcb1a1e693ad3b9f8a5cc2..a0f757df3c87338164bf8bca4d66cc5faa844279 100644 (file)
@@ -32,7 +32,6 @@
 #define __ARCH_SPARC_TYPES_HH__
 
 #include "arch/generic/types.hh"
-#include "base/bigint.hh"
 #include "base/types.hh"
 
 namespace SparcISA
index 1fad1ec1ac63968241e714de987cf6eae20c4424..715adc9d77f297d818d07f05e6ae009ff6374431 100644 (file)
@@ -115,7 +115,6 @@ output exec {{
 #include "arch/x86/faults.hh"
 #include "arch/x86/memhelpers.hh"
 #include "arch/x86/tlb.hh"
-#include "base/bigint.hh"
 #include "base/compiler.hh"
 #include "base/condcodes.hh"
 #include "cpu/base.hh"
index d1c4a14bf0120c92b693266659be7d267cf3f2c4..a90b784866d61210b1dd764be409b8670a2d56b7 100644 (file)
@@ -36,7 +36,6 @@ if env['CP_ANNOTATE']:
 SimObject('Graphics.py')
 Source('atomicio.cc')
 Source('bitfield.cc')
-Source('bigint.cc')
 Source('imgwriter.cc')
 Source('bmpwriter.cc')
 Source('callback.cc')
diff --git a/src/base/bigint.cc b/src/base/bigint.cc
deleted file mode 100644 (file)
index ce9942c..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2006 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Gabe Black
- */
-
-#include "base/bigint.hh"
-
-#include <iostream>
-
-using namespace std;
-
-ostream & operator << (ostream & os, const Twin64_t & t)
-{
-    os << t.a << ", " << t.b;
-    return os;
-}
-
-ostream & operator << (ostream & os, const Twin32_t & t)
-{
-    os << t.a << ", " << t.b;
-    return os;
-}
diff --git a/src/base/bigint.hh b/src/base/bigint.hh
deleted file mode 100644 (file)
index a078fdd..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2006 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Ali Saidi
- */
-
-#include <iostream>
-
-#include "base/logging.hh"
-#include "base/types.hh"
-
-#ifndef __BASE_BIGINT_HH__
-#define __BASE_BIGINT_HH__
-// Create a couple of large int types for atomic reads
-struct m5_twin64_t {
-    uint64_t a;
-    uint64_t b;
-    m5_twin64_t() : a(0), b(0)
-    {}
-    m5_twin64_t(const uint64_t x) : a(x), b(x)
-    {}
-    inline m5_twin64_t& operator=(const uint64_t x)
-    {
-        a = x;
-        b = x;
-        return *this;
-    }
-
-    operator uint64_t()
-    {
-        panic("Tried to cram a twin64_t into an integer!\n");
-        return a;
-    }
-};
-
-struct m5_twin32_t {
-    uint32_t a;
-    uint32_t b;
-    m5_twin32_t()
-    {}
-    m5_twin32_t(const uint32_t x)
-    {
-        a = x;
-        b = x;
-    }
-    inline m5_twin32_t& operator=(const uint32_t x)
-    {
-        a = x;
-        b = x;
-        return *this;
-    }
-
-    operator uint32_t()
-    {
-        panic("Tried to cram a twin32_t into an integer!\n");
-        return a;
-    }
-};
-
-
-// This is for twin loads (two 64 bit values), not 1 128 bit value (as far as
-// endian conversion is concerned!
-typedef m5_twin64_t Twin64_t;
-typedef m5_twin32_t Twin32_t;
-
-// Output operator overloads
-std::ostream & operator << (std::ostream & os, const Twin64_t & t);
-std::ostream & operator << (std::ostream & os, const Twin32_t & t);
-
-#endif // __BASE_BIGINT_HH__
-
index f3596b6a5fd6ea8170a87ca4f9ea4aaa3edec32f..bc7670b232a5318ad383e418724d23382778b7dc 100644 (file)
@@ -46,7 +46,6 @@
 #include "arch/locked_mem.hh"
 #include "arch/mmapped_ipr.hh"
 #include "arch/utility.hh"
-#include "base/bigint.hh"
 #include "base/output.hh"
 #include "config/the_isa.hh"
 #include "cpu/exetrace.hh"
index 961e31935c54c198c05d5c42f8b6deaed81f0ddf..083de2b40748149d3d5ee9c749dbe9d434e4f184 100644 (file)
@@ -46,7 +46,6 @@
 #include "arch/locked_mem.hh"
 #include "arch/mmapped_ipr.hh"
 #include "arch/utility.hh"
-#include "base/bigint.hh"
 #include "config/the_isa.hh"
 #include "cpu/exetrace.hh"
 #include "debug/Config.hh"
index 1fee979cef213a0ad9f7f7470039ab45c5e155d6..92752a72011096631c0617421abee56a0b2aa8a9 100644 (file)
@@ -43,7 +43,6 @@
  */
 
 #include "arch/isa_traits.hh"
-#include "base/bigint.hh"
 #include "config/the_isa.hh"
 #include "mem/packet.hh"
 #include "sim/byteswap.hh"
index 02a05330810e29018d18252d6cc3f59b37cb26cd..2c3517f2496c4e88e7ee103bd5b1b9c52e4fa423 100644 (file)
@@ -37,7 +37,6 @@
 #ifndef __SIM_BYTE_SWAP_HH__
 #define __SIM_BYTE_SWAP_HH__
 
-#include "base/bigint.hh"
 #include "base/types.hh"
 
 // This lets us figure out what the byte order of the host system is
@@ -123,22 +122,6 @@ inline T swap_byte(T x) {
         panic("Can't byte-swap values larger than 64 bits");
 }
 
-template<>
-inline Twin64_t swap_byte<Twin64_t>(Twin64_t x)
-{
-    x.a = swap_byte(x.a);
-    x.b = swap_byte(x.b);
-    return x;
-}
-
-template<>
-inline Twin32_t swap_byte<Twin32_t>(Twin32_t x)
-{
-    x.a = swap_byte(x.a);
-    x.b = swap_byte(x.b);
-    return x;
-}
-
 template <typename T, size_t N>
 inline std::array<T, N>
 swap_byte(std::array<T, N> a)
index caeee520dd51ab0a1a7fae1439280f81e075f5b3..d57f5a04d7332427d73b0b6d0f9ddec55289fff9 100644 (file)
@@ -44,7 +44,6 @@
 #ifndef __INSTRECORD_HH__
 #define __INSTRECORD_HH__
 
-#include "base/bigint.hh"
 #include "base/types.hh"
 #include "cpu/inst_seq.hh"
 #include "cpu/static_inst.hh"
@@ -113,7 +112,7 @@ class InstRecord
     /** @ingroup data
      * What size of data was written?
      */
-    enum {
+    enum DataStatus {
         DataInvalid = 0,
         DataInt8 = 1,   // set to equal number of bytes
         DataInt16 = 2,
@@ -159,8 +158,17 @@ class InstRecord
         addr = a; size = s; flags = f; mem_valid = true;
     }
 
-    void setData(Twin64_t d) { data.as_int = d.a; data_status = DataInt64; }
-    void setData(Twin32_t d) { data.as_int = d.a; data_status = DataInt32; }
+    template <typename T, size_t N>
+    void
+    setData(std::array<T, N> d)
+    {
+        data.as_int = d[0];
+        data_status = (DataStatus)sizeof(T);
+        static_assert(sizeof(T) == DataInt8 || sizeof(T) == DataInt16 ||
+                      sizeof(T) == DataInt32 || sizeof(T) == DataInt64,
+                      "Type T has an unrecognized size.");
+    }
+
     void setData(uint64_t d) { data.as_int = d; data_status = DataInt64; }
     void setData(uint32_t d) { data.as_int = d; data_status = DataInt32; }
     void setData(uint16_t d) { data.as_int = d; data_status = DataInt16; }