LLVM API Documentation
00001 //===-- GenericValue.h - Represent any type of LLVM value -------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the LLVM research group and is distributed under 00006 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // The GenericValue class is used to represent an LLVM value of arbitrary type. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 00015 #ifndef GENERIC_VALUE_H 00016 #define GENERIC_VALUE_H 00017 00018 #include "llvm/Support/DataTypes.h" 00019 00020 namespace llvm { 00021 00022 typedef uintptr_t PointerTy; 00023 00024 union GenericValue { 00025 bool BoolVal; 00026 unsigned char UByteVal; 00027 signed char SByteVal; 00028 unsigned short UShortVal; 00029 signed short ShortVal; 00030 unsigned int UIntVal; 00031 signed int IntVal; 00032 uint64_t ULongVal; 00033 int64_t LongVal; 00034 double DoubleVal; 00035 float FloatVal; 00036 struct { unsigned int first; unsigned int second; } UIntPairVal; 00037 PointerTy PointerVal; 00038 unsigned char Untyped[8]; 00039 00040 GenericValue() {} 00041 GenericValue(void *V) { 00042 PointerVal = (PointerTy)(intptr_t)V; 00043 } 00044 }; 00045 00046 inline GenericValue PTOGV(void *P) { return GenericValue(P); } 00047 inline void* GVTOP(const GenericValue &GV) { 00048 return (void*)(intptr_t)GV.PointerVal; 00049 } 00050 00051 } // End llvm namespace 00052 #endif