Added LLVM copyright header (for lack of a better term).
[oota-llvm.git] / include / llvm / ExecutionEngine / GenericValue.h
1 //===-- GenericValue.h - Represent any type of LLVM value -------*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 // 
10 // The GenericValue class is used to represent an LLVM value of arbitrary type.
11 //
12 //===----------------------------------------------------------------------===//
13
14
15 #ifndef GENERIC_VALUE_H
16 #define GENERIC_VALUE_H
17
18 #include "Support/DataTypes.h"
19
20 typedef uint64_t PointerTy;
21
22 union GenericValue {
23   bool            BoolVal;
24   unsigned char   UByteVal;
25   signed   char   SByteVal;
26   unsigned short  UShortVal;
27   signed   short  ShortVal;
28   unsigned int    UIntVal;
29   signed   int    IntVal;
30   uint64_t        ULongVal;
31   int64_t         LongVal;
32   double          DoubleVal;
33   float           FloatVal;
34   PointerTy       PointerVal;
35   unsigned char   Untyped[8];
36
37   GenericValue() {}
38   GenericValue(void *V) {
39     PointerVal = (PointerTy)(intptr_t)V;
40   }
41 };
42
43 inline GenericValue PTOGV(void *P) { return GenericValue(P); }
44 inline void* GVTOP(const GenericValue &GV) {
45   return (void*)(intptr_t)GV.PointerVal;
46 }
47 #endif