2002-12-24 00:01:05 +00:00
|
|
|
//===-- GenericValue.h - Represent any type of LLVM value -------*- C++ -*-===//
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2002-12-24 00:01:05 +00:00
|
|
|
// The GenericValue class is used to represent an LLVM value of arbitrary type.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef GENERIC_VALUE_H
|
|
|
|
#define GENERIC_VALUE_H
|
|
|
|
|
2007-03-06 03:01:54 +00:00
|
|
|
#include "llvm/ADT/APInt.h"
|
2004-09-01 22:55:40 +00:00
|
|
|
#include "llvm/Support/DataTypes.h"
|
2002-12-24 00:01:05 +00:00
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
namespace llvm {
|
|
|
|
|
2007-03-06 03:01:54 +00:00
|
|
|
typedef void* PointerTy;
|
2007-03-03 07:36:44 +00:00
|
|
|
class APInt;
|
2007-03-06 03:01:54 +00:00
|
|
|
|
|
|
|
struct GenericValue {
|
|
|
|
union {
|
|
|
|
double DoubleVal;
|
|
|
|
float FloatVal;
|
|
|
|
PointerTy PointerVal;
|
|
|
|
struct { unsigned int first; unsigned int second; } UIntPairVal;
|
|
|
|
unsigned char Untyped[8];
|
|
|
|
};
|
2007-09-17 18:44:13 +00:00
|
|
|
APInt IntVal; // also used for long doubles
|
2007-03-06 03:01:54 +00:00
|
|
|
|
|
|
|
GenericValue() : DoubleVal(0.0), IntVal(1,0) {}
|
|
|
|
GenericValue(void *V) : PointerVal(V), IntVal(1,0) { }
|
2002-12-24 00:01:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
inline GenericValue PTOGV(void *P) { return GenericValue(P); }
|
2007-03-06 03:01:54 +00:00
|
|
|
inline void* GVTOP(const GenericValue &GV) { return GV.PointerVal; }
|
2003-11-11 22:41:34 +00:00
|
|
|
|
|
|
|
} // End llvm namespace
|
2002-12-24 00:01:05 +00:00
|
|
|
#endif
|