1 //===-- GenericValue.h - Represent any type of LLVM value -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // The GenericValue class is used to represent an LLVM value of arbitrary type.
12 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_EXECUTIONENGINE_GENERICVALUE_H
16 #define LLVM_EXECUTIONENGINE_GENERICVALUE_H
18 #include "llvm/ADT/APInt.h"
19 #include "llvm/Support/DataTypes.h"
23 typedef void* PointerTy;
35 struct IntPair UIntPairVal;
36 unsigned char Untyped[8];
38 APInt IntVal; // also used for long doubles.
39 // For aggregate data types.
40 std::vector<GenericValue> AggregateVal;
42 // to make code faster, set GenericValue to zero could be omitted, but it is
43 // potentially can cause problems, since GenericValue to store garbage
45 GenericValue() : IntVal(1,0) {UIntPairVal.first = 0; UIntPairVal.second = 0;}
46 explicit GenericValue(void *V) : PointerVal(V), IntVal(1,0) { }
49 inline GenericValue PTOGV(void *P) { return GenericValue(P); }
50 inline void* GVTOP(const GenericValue &GV) { return GV.PointerVal; }
52 } // End llvm namespace.