[llvm-commits] [llvm] r43829 - in /llvm/trunk: include/llvm/ADT/APFloat.h lib/Bitcode/Reader/DeserializeAPFloat.cpp lib/Bitcode/Writer/SerializeAPFloat.cpp
Ted Kremenek
kremenek at apple.com
Wed Nov 7 10:39:27 PST 2007
Author: kremenek
Date: Wed Nov 7 12:39:22 2007
New Revision: 43829
URL: http://llvm.org/viewvc/llvm-project?rev=43829&view=rev
Log:
Implemented generic serialization of APFloat.
Added:
llvm/trunk/lib/Bitcode/Reader/DeserializeAPFloat.cpp
llvm/trunk/lib/Bitcode/Writer/SerializeAPFloat.cpp
Modified:
llvm/trunk/include/llvm/ADT/APFloat.h
Modified: llvm/trunk/include/llvm/ADT/APFloat.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=43829&r1=43828&r2=43829&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APFloat.h (original)
+++ llvm/trunk/include/llvm/ADT/APFloat.h Wed Nov 7 12:39:22 2007
@@ -102,6 +102,7 @@
// APInt contains static functions implementing bignum arithmetic.
#include "llvm/ADT/APInt.h"
+#include "llvm/Bitcode/SerializationFwd.h"
#include "llvm/CodeGen/ValueTypes.h"
namespace llvm {
@@ -181,6 +182,12 @@
explicit APFloat(const APInt &, bool isIEEE = false);
APFloat(const APFloat &);
~APFloat();
+
+ /// @brief Used by the Bitcode serializer to emit APInts to Bitcode.
+ void Emit(Serializer& S) const;
+
+ /// @brief Used by the Bitcode deserializer to deserialize APInts.
+ static APFloat ReadVal(Deserializer& D);
/* Arithmetic. */
opStatus add(const APFloat &, roundingMode);
Added: llvm/trunk/lib/Bitcode/Reader/DeserializeAPFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/DeserializeAPFloat.cpp?rev=43829&view=auto
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/DeserializeAPFloat.cpp (added)
+++ llvm/trunk/lib/Bitcode/Reader/DeserializeAPFloat.cpp Wed Nov 7 12:39:22 2007
@@ -0,0 +1,24 @@
+//===-- SerializeAPInt.cpp - Serialization for APFloat ---------*- C++ -*--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by Ted Kremenek and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements deserialization of APFloat.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/APFloat.h"
+#include "llvm/Bitcode/Deserialize.h"
+
+using namespace llvm;
+
+APFloat APFloat::ReadVal(Deserializer& D) {
+ APInt x;
+ D.Read(x);
+ return APFloat(x);
+}
+
Added: llvm/trunk/lib/Bitcode/Writer/SerializeAPFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/SerializeAPFloat.cpp?rev=43829&view=auto
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/SerializeAPFloat.cpp (added)
+++ llvm/trunk/lib/Bitcode/Writer/SerializeAPFloat.cpp Wed Nov 7 12:39:22 2007
@@ -0,0 +1,21 @@
+//===-- SerializeAPInt.cpp - Serialization for APFloat ---------*- C++ -*--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by Ted Kremenek and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements serialization of APFloat.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/APFloat.h"
+#include "llvm/Bitcode/Serialize.h"
+
+using namespace llvm;
+
+void APFloat::Emit(Serializer& S) const {
+ S.Emit(convertToAPInt());
+}
More information about the llvm-commits
mailing list