Implemented prototype serialization of pointers, including support
[oota-llvm.git] / include / llvm / Bitcode / Serialization.h
1 //==- Serialization.h - Generic Object Serialization to Bitcode ---*- C++ -*-=//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Ted Kremenek and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the interface for generic object serialization to
11 // LLVM bitcode.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_BITCODE_SERIALIZE
16 #define LLVM_BITCODE_SERIALIZE
17
18 namespace llvm {
19
20 class Serializer;
21 class Deserializer;  
22 template <typename T> struct SerializeTrait;
23   
24 #define SERIALIZE_INT_TRAIT(TYPE)\
25 template <> struct SerializeTrait<TYPE> {\
26   static void Emit(Serializer& S, TYPE X);\
27   static void Read(Deserializer& S, TYPE& X);\
28   static TYPE ReadVal(Deserializer& S); };
29
30 SERIALIZE_INT_TRAIT(bool)
31 SERIALIZE_INT_TRAIT(unsigned char)
32 SERIALIZE_INT_TRAIT(unsigned short)
33 SERIALIZE_INT_TRAIT(unsigned int)
34 SERIALIZE_INT_TRAIT(unsigned long)
35
36 #undef SERIALIZE_INT_TRAIT
37   
38 } // end namespace llvm
39
40 #endif