Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.6 KiB

  1. //===-- GenericValue.h - Represent any type of LLVM value -------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // The GenericValue class is used to represent an LLVM value of arbitrary type.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_EXECUTIONENGINE_GENERICVALUE_H
  14. #define LLVM_EXECUTIONENGINE_GENERICVALUE_H
  15. #include "llvm/ADT/APInt.h"
  16. #include "llvm/Support/DataTypes.h"
  17. namespace llvm {
  18. typedef void* PointerTy;
  19. class APInt;
  20. struct GenericValue {
  21. struct IntPair {
  22. unsigned int first;
  23. unsigned int second;
  24. };
  25. union {
  26. double DoubleVal;
  27. float FloatVal;
  28. PointerTy PointerVal;
  29. struct IntPair UIntPairVal;
  30. unsigned char Untyped[8];
  31. };
  32. APInt IntVal; // also used for long doubles.
  33. // For aggregate data types.
  34. std::vector<GenericValue> AggregateVal;
  35. // to make code faster, set GenericValue to zero could be omitted, but it is
  36. // potentially can cause problems, since GenericValue to store garbage
  37. // instead of zero.
  38. GenericValue() : IntVal(1,0) {UIntPairVal.first = 0; UIntPairVal.second = 0;}
  39. explicit GenericValue(void *V) : PointerVal(V), IntVal(1,0) { }
  40. };
  41. inline GenericValue PTOGV(void *P) { return GenericValue(P); }
  42. inline void* GVTOP(const GenericValue &GV) { return GV.PointerVal; }
  43. } // End llvm namespace.
  44. #endif