sim: Use the new BitUnion templates in serialize.hh.

serialize.hh should not reference internal implementation details in
the underlying BitUnion types.

Change-Id: I1ce29243db63801b7788f037fdc54811bdab889c
Reviewed-on: https://gem5-review.googlesource.com/7203
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh
index b6c0263..024d29c 100644
--- a/src/sim/serialize.hh
+++ b/src/sim/serialize.hh
@@ -72,33 +72,41 @@
 template <class T>
 void paramOut(CheckpointOut &cp, const std::string &name, const T &param);
 
-template <typename BitUnion>
-void paramOut(CheckpointOut &cp, const std::string &name,
-              const BitfieldBackend::BitUnionOperators<BitUnion> &p)
+template <typename T>
+void
+paramOut(CheckpointOut &cp, const std::string &name, const BitUnionType<T> &p)
 {
-    paramOut(cp, name, p.__storage);
+    paramOut(cp, name, static_cast<BitUnionBaseType<T> >(p));
 }
 
 template <class T>
 void paramIn(CheckpointIn &cp, const std::string &name, T &param);
 
-template <typename BitUnion>
-void paramIn(CheckpointIn &cp, const std::string &name,
-             BitfieldBackend::BitUnionOperators<BitUnion> &p)
+template <typename T>
+void
+paramIn(CheckpointIn &cp, const std::string &name, BitUnionType<T> &p)
 {
-    paramIn(cp, name, p.__storage);
+    BitUnionBaseType<T> b;
+    paramIn(cp, name, b);
+    p = b;
 }
 
 template <class T>
 bool optParamIn(CheckpointIn &cp, const std::string &name, T &param,
                 bool warn = true);
 
-template <typename BitUnion>
-bool optParamIn(CheckpointIn &cp, const std::string &name,
-                BitfieldBackend::BitUnionOperators<BitUnion> &p,
-                bool warn = true)
+template <typename T>
+bool
+optParamIn(CheckpointIn &cp, const std::string &name,
+           BitUnionType<T> &p, bool warn = true)
 {
-    return optParamIn(cp, name, p.__storage, warn);
+    BitUnionBaseType<T> b;
+    if (optParamIn(cp, name, b, warn)) {
+        p = b;
+        return true;
+    } else {
+        return false;
+    }
 }
 
 template <class T>