summaryrefslogtreecommitdiff
path: root/include/llvm/ExecutionEngine
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-06 03:01:54 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-06 03:01:54 +0000
commit9d87eb19be82b28d288e38eab3bbe145060a0701 (patch)
treef3c8cfeea6313d37ddd4d6e794c060fa768e9958 /include/llvm/ExecutionEngine
parent7ca0689b9b3f085d398062f7f09059f7be691829 (diff)
downloadllvm-9d87eb19be82b28d288e38eab3bbe145060a0701.tar.gz
llvm-9d87eb19be82b28d288e38eab3bbe145060a0701.tar.bz2
llvm-9d87eb19be82b28d288e38eab3bbe145060a0701.tar.xz
Make GenericeValue into a struct with a union instead of just a union. This
allows an APInt value to be constructed. Remove all the native integer types from the union. These are replaced with the single IntVal of type APInt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34945 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ExecutionEngine')
-rw-r--r--include/llvm/ExecutionEngine/ExecutionEngine.h2
-rw-r--r--include/llvm/ExecutionEngine/GenericValue.h39
2 files changed, 17 insertions, 24 deletions
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h
index 71aa18e0e5..ab2924ef29 100644
--- a/include/llvm/ExecutionEngine/ExecutionEngine.h
+++ b/include/llvm/ExecutionEngine/ExecutionEngine.h
@@ -24,7 +24,7 @@
namespace llvm {
-union GenericValue;
+struct GenericValue;
class Constant;
class Function;
class GlobalVariable;
diff --git a/include/llvm/ExecutionEngine/GenericValue.h b/include/llvm/ExecutionEngine/GenericValue.h
index 930261cecc..d0cd2cd0bc 100644
--- a/include/llvm/ExecutionEngine/GenericValue.h
+++ b/include/llvm/ExecutionEngine/GenericValue.h
@@ -15,37 +15,30 @@
#ifndef GENERIC_VALUE_H
#define GENERIC_VALUE_H
+#include "llvm/ADT/APInt.h"
#include "llvm/Support/DataTypes.h"
namespace llvm {
-typedef uintptr_t PointerTy;
+typedef void* PointerTy;
class APInt;
-class Type;
-
-union GenericValue {
- bool Int1Val;
- unsigned char Int8Val;
- unsigned short Int16Val;
- unsigned int Int32Val;
- uint64_t Int64Val;
- APInt *APIntVal;
- double DoubleVal;
- float FloatVal;
- struct { unsigned int first; unsigned int second; } UIntPairVal;
- PointerTy PointerVal;
- unsigned char Untyped[8];
-
- GenericValue() {}
- GenericValue(void *V) {
- PointerVal = (PointerTy)(intptr_t)V;
- }
+
+struct GenericValue {
+ union {
+ double DoubleVal;
+ float FloatVal;
+ PointerTy PointerVal;
+ struct { unsigned int first; unsigned int second; } UIntPairVal;
+ unsigned char Untyped[8];
+ };
+ APInt IntVal;
+
+ GenericValue() : DoubleVal(0.0), IntVal(1,0) {}
+ GenericValue(void *V) : PointerVal(V), IntVal(1,0) { }
};
inline GenericValue PTOGV(void *P) { return GenericValue(P); }
-inline void* GVTOP(const GenericValue &GV) {
- return (void*)(intptr_t)GV.PointerVal;
-}
+inline void* GVTOP(const GenericValue &GV) { return GV.PointerVal; }
} // End llvm namespace
#endif