LLVM  13.0.0git
GenericValue.h
Go to the documentation of this file.
1 //===- GenericValue.h - Represent any type of LLVM value --------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // The GenericValue class is used to represent an LLVM value of arbitrary type.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_EXECUTIONENGINE_GENERICVALUE_H
14 #define LLVM_EXECUTIONENGINE_GENERICVALUE_H
15 
16 #include "llvm/ADT/APInt.h"
17 #include <vector>
18 
19 namespace llvm {
20 
21 using PointerTy = void *;
22 
23 struct GenericValue {
24  struct IntPair {
25  unsigned int first;
26  unsigned int second;
27  };
28  union {
29  double DoubleVal;
30  float FloatVal;
33  unsigned char Untyped[8];
34  };
35  APInt IntVal; // also used for long doubles.
36  // For aggregate data types.
37  std::vector<GenericValue> AggregateVal;
38 
39  // to make code faster, set GenericValue to zero could be omitted, but it is
40  // potentially can cause problems, since GenericValue to store garbage
41  // instead of zero.
42  GenericValue() : IntVal(1, 0) {
43  UIntPairVal.first = 0;
44  UIntPairVal.second = 0;
45  }
46  explicit GenericValue(void *V) : PointerVal(V), IntVal(1, 0) {}
47 };
48 
49 inline GenericValue PTOGV(void *P) { return GenericValue(P); }
50 inline void *GVTOP(const GenericValue &GV) { return GV.PointerVal; }
51 
52 } // end namespace llvm
53 
54 #endif // LLVM_EXECUTIONENGINE_GENERICVALUE_H
llvm
Definition: AllocatorList.h:23
llvm::GenericValue::AggregateVal
std::vector< GenericValue > AggregateVal
Definition: GenericValue.h:37
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::GenericValue::UIntPairVal
struct IntPair UIntPairVal
Definition: GenericValue.h:32
llvm::GenericValue::IntPair
Definition: GenericValue.h:24
llvm::GenericValue::PointerVal
PointerTy PointerVal
Definition: GenericValue.h:31
APInt.h
llvm::GenericValue::Untyped
unsigned char Untyped[8]
Definition: GenericValue.h:33
llvm::GenericValue
Definition: GenericValue.h:23
llvm::GenericValue::IntVal
APInt IntVal
Definition: GenericValue.h:35
llvm::GVTOP
void * GVTOP(const GenericValue &GV)
Definition: GenericValue.h:50
llvm::GenericValue::IntPair::first
unsigned int first
Definition: GenericValue.h:25
llvm::GenericValue::GenericValue
GenericValue()
Definition: GenericValue.h:42
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:70
llvm::PointerTy
void * PointerTy
Definition: GenericValue.h:21
llvm::GenericValue::DoubleVal
double DoubleVal
Definition: GenericValue.h:29
llvm::GenericValue::GenericValue
GenericValue(void *V)
Definition: GenericValue.h:46
llvm::GenericValue::FloatVal
float FloatVal
Definition: GenericValue.h:30
llvm::GenericValue::IntPair::second
unsigned int second
Definition: GenericValue.h:26
llvm::PTOGV
GenericValue PTOGV(void *P)
Definition: GenericValue.h:49