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 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_EXECUTIONENGINE_GENERICVALUE_H
15 #define LLVM_EXECUTIONENGINE_GENERICVALUE_H
17 #include "llvm/ADT/APInt.h"
22 using PointerTy = void *;
33 struct IntPair UIntPairVal;
34 unsigned char Untyped[8];
36 APInt IntVal; // also used for long doubles.
37 // For aggregate data types.
38 std::vector<GenericValue> AggregateVal;
40 // to make code faster, set GenericValue to zero could be omitted, but it is
41 // potentially can cause problems, since GenericValue to store garbage
43 GenericValue() : IntVal(1, 0) {
44 UIntPairVal.first = 0;
45 UIntPairVal.second = 0;
47 explicit GenericValue(void *V) : PointerVal(V), IntVal(1, 0) {}
50 inline GenericValue PTOGV(void *P) { return GenericValue(P); }
51 inline void *GVTOP(const GenericValue &GV) { return GV.PointerVal; }
53 } // end namespace llvm
55 #endif // LLVM_EXECUTIONENGINE_GENERICVALUE_H