GenericValue.h revision 193323
1193323Sed//===-- GenericValue.h - Represent any type of LLVM value -------*- C++ -*-===// 2193323Sed// 3193323Sed// The LLVM Compiler Infrastructure 4193323Sed// 5193323Sed// This file is distributed under the University of Illinois Open Source 6193323Sed// License. See LICENSE.TXT for details. 7193323Sed// 8193323Sed//===----------------------------------------------------------------------===// 9193323Sed// 10193323Sed// The GenericValue class is used to represent an LLVM value of arbitrary type. 11193323Sed// 12193323Sed//===----------------------------------------------------------------------===// 13193323Sed 14193323Sed 15193323Sed#ifndef GENERIC_VALUE_H 16193323Sed#define GENERIC_VALUE_H 17193323Sed 18193323Sed#include "llvm/ADT/APInt.h" 19193323Sed#include "llvm/Support/DataTypes.h" 20193323Sed 21193323Sednamespace llvm { 22193323Sed 23193323Sedtypedef void* PointerTy; 24193323Sedclass APInt; 25193323Sed 26193323Sedstruct GenericValue { 27193323Sed union { 28193323Sed double DoubleVal; 29193323Sed float FloatVal; 30193323Sed PointerTy PointerVal; 31193323Sed struct { unsigned int first; unsigned int second; } UIntPairVal; 32193323Sed unsigned char Untyped[8]; 33193323Sed }; 34193323Sed APInt IntVal; // also used for long doubles 35193323Sed 36193323Sed GenericValue() : DoubleVal(0.0), IntVal(1,0) {} 37193323Sed explicit GenericValue(void *V) : PointerVal(V), IntVal(1,0) { } 38193323Sed}; 39193323Sed 40193323Sedinline GenericValue PTOGV(void *P) { return GenericValue(P); } 41193323Sedinline void* GVTOP(const GenericValue &GV) { return GV.PointerVal; } 42193323Sed 43193323Sed} // End llvm namespace 44193323Sed#endif 45