LLVM API Documentation

GenericValue.h

Go to the documentation of this file.
00001 //===-- GenericValue.h - Represent any type of LLVM value -------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // 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/ADT/APInt.h"
00019 #include "llvm/Support/DataTypes.h"
00020 
00021 namespace llvm {
00022 
00023 typedef void* PointerTy;
00024 class APInt;
00025 
00026 struct GenericValue {
00027   union {
00028     double          DoubleVal;
00029     float           FloatVal;
00030     PointerTy       PointerVal;
00031     struct { unsigned int first; unsigned int second; } UIntPairVal;
00032     unsigned char   Untyped[8];
00033   };
00034   APInt IntVal;   // also used for long doubles
00035 
00036   GenericValue() : DoubleVal(0.0), IntVal(1,0) {}
00037   explicit GenericValue(void *V) : PointerVal(V), IntVal(1,0) { }
00038 };
00039 
00040 inline GenericValue PTOGV(void *P) { return GenericValue(P); }
00041 inline void* GVTOP(const GenericValue &GV) { return GV.PointerVal; }
00042 
00043 } // End llvm namespace
00044 #endif



This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.