Static Value-Flow Analysis
Loading...
Searching...
No Matches
BasicTypes.h
Go to the documentation of this file.
1//===- BasicTypes.h --Basic Types of SVF-LLVM---------------------------//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-2022> <Yulei Sui>
6//
7
8// This program is free software: you can redistribute it and/or modify
9// it under the terms of the GNU Affero General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU Affero General Public License for more details.
17
18// You should have received a copy of the GNU Affero General Public License
19// along with this program. If not, see <http://www.gnu.org/licenses/>.
20//
21//===----------------------------------------------------------------------===//
22
23#ifndef SVF_FE_BASIC_TYPES_H
24#define SVF_FE_BASIC_TYPES_H
25
27
28#include <llvm/Pass.h>
29
30#include <llvm/IR/Instructions.h>
31#include <llvm/IR/GetElementPtrTypeIterator.h> //for gep iterator
32#include <llvm/IR/GlobalVariable.h> // for GlobalVariable
33#include <llvm/IR/BasicBlock.h>
34#include <llvm/IR/IntrinsicInst.h>
35#include <llvm/IR/LLVMContext.h>
36#include <llvm/IR/Metadata.h>
37#include <llvm/IR/DataLayout.h>
38#include <llvm/IR/IRBuilder.h>
39#include <llvm/IR/DebugInfo.h>
40#include <llvm/IR/InstIterator.h>
41#include <llvm/IR/GetElementPtrTypeIterator.h>
42#include <llvm/IR/DerivedTypes.h>
43#include <llvm/IR/Statepoint.h>
44#include <llvm/IR/Intrinsics.h>
45
46#include <llvm/Analysis/MemoryLocation.h>
47#include <llvm/Analysis/DominanceFrontier.h>
48#include <llvm/Analysis/PostDominators.h>
49#include <llvm/Analysis/ScalarEvolution.h>
50#include <llvm/Analysis/ScalarEvolutionExpressions.h>
51
52#include <llvm/Transforms/Utils/UnifyFunctionExitNodes.h>
53
54#include <llvm/Support/SourceMgr.h>
55
56#include <llvm/Bitcode/BitcodeWriter.h> // for WriteBitcodeToFile
57#include <llvm/Bitcode/BitcodeReader.h>
58#include <llvm/IRReader/IRReader.h> // IR reader for bit file
59#include <llvm/IR/InstVisitor.h> // for instruction visitor
60#include <llvm/IR/InstIterator.h> // for inst iteration
61
62#include <llvm/BinaryFormat/Dwarf.h> // for dwarf tags
63
64#include <llvm/Analysis/LoopInfo.h>
65#include <llvm/Demangle/Demangle.h>
66
67namespace SVF
68{
69
70typedef llvm::LLVMContext LLVMContext;
71typedef llvm::GlobalObject GlobalObject;
72typedef llvm::Use Use;
73typedef llvm::ModulePass ModulePass;
74typedef llvm::IRBuilder<> IRBuilder;
75#if LLVM_VERSION_MAJOR >= 12
76typedef llvm::UnifyFunctionExitNodesLegacyPass UnifyFunctionExitNodes;
77#else
78typedef llvm::UnifyFunctionExitNodes UnifyFunctionExitNodes;
79#endif
80
82typedef llvm::Value Value;
83typedef llvm::Type Type;
84typedef llvm::Module Module;
85typedef llvm::Function Function;
86typedef llvm::BasicBlock BasicBlock;
87typedef llvm::Instruction Instruction;
88typedef llvm::GlobalValue GlobalValue;
89
90typedef llvm::SMDiagnostic SMDiagnostic;
91typedef llvm::BlockAddress BlockAddress;
92
94typedef llvm::StructType StructType;
95typedef llvm::ArrayType ArrayType;
96typedef llvm::PointerType PointerType;
97typedef llvm::IntegerType IntegerType;
98typedef llvm::FunctionType FunctionType;
99
100// LLVM Metadata
101typedef llvm::MDString MDString;
102typedef llvm::MetadataAsValue MetadataAsValue;
103
104// LLVM data layout
105typedef llvm::StructLayout StructLayout;
106typedef llvm::ConstantStruct ConstantStruct;
107typedef llvm::MemoryLocation MemoryLocation;
108typedef llvm::DataLayout DataLayout;
109
111typedef llvm::NamedMDNode NamedMDNode;
112typedef llvm::MDNode MDNode;
113typedef llvm::DISubprogram DISubprogram;
114
115// LLVM Aliases and constants
116typedef llvm::ConstantData ConstantData;
117typedef llvm::ConstantAggregate ConstantAggregate;
118typedef llvm::ConstantAggregateZero ConstantAggregateZero;
119typedef llvm::ConstantDataSequential ConstantDataSequential;
120typedef llvm::ConstantExpr ConstantExpr;
121typedef llvm::ConstantDataArray ConstantDataArray;
122typedef llvm::ConstantData ConstantData;
123typedef llvm::ConstantArray ConstantArray;
124typedef llvm::Constant Constant;
125typedef llvm::ConstantInt ConstantInt;
126typedef llvm::ConstantFP ConstantFP;
127typedef llvm::ConstantPointerNull ConstantPointerNull;
128typedef llvm::GlobalAlias GlobalAlias;
129typedef llvm::GlobalIFunc GlobalIFunc;
130typedef llvm::GlobalVariable GlobalVariable;
131
133typedef llvm::DominatorTree DominatorTree;
134typedef llvm::DomTreeNode DomTreeNode;
135typedef llvm::DominanceFrontier DominanceFrontier;
136typedef llvm::PostDominatorTree PostDominatorTree;
137typedef llvm::DominanceFrontierBase<llvm::BasicBlock, false> DominanceFrontierBase;
138
140typedef llvm::Loop Loop;
141typedef llvm::LoopInfo LoopInfo;
142typedef llvm::User User;
143
144// LLVM Instructions
145typedef llvm::Argument Argument;
146typedef llvm::CallBase CallBase;
147typedef llvm::CallInst CallInst;
148typedef llvm::StoreInst StoreInst;
149typedef llvm::LoadInst LoadInst;
150typedef llvm::AllocaInst AllocaInst;
151typedef llvm::AtomicCmpXchgInst AtomicCmpXchgInst;
152typedef llvm::AtomicRMWInst AtomicRMWInst;
153typedef llvm::BitCastInst BitCastInst;
154typedef llvm::BranchInst BranchInst;
155typedef llvm::SwitchInst SwitchInst;
156typedef llvm::CallBrInst CallBrInst;
157typedef llvm::ReturnInst ReturnInst;
158typedef llvm::CastInst CastInst;
159typedef llvm::CmpInst CmpInst;
160typedef llvm::ExtractValueInst ExtractValueInst;
161typedef llvm::ExtractElementInst ExtractElementInst;
162typedef llvm::GetElementPtrInst GetElementPtrInst;
163typedef llvm::InvokeInst InvokeInst;
164typedef llvm::ShuffleVectorInst ShuffleVectorInst;
165typedef llvm::PHINode PHINode;
166typedef llvm::IntToPtrInst IntToPtrInst;
167typedef llvm::InsertValueInst InsertValueInst;
168typedef llvm::FenceInst FenceInst;
169typedef llvm::FreezeInst FreezeInst;
170typedef llvm::UnreachableInst UnreachableInst;
171typedef llvm::InsertElementInst InsertElementInst;
172typedef llvm::LandingPadInst LandingPadInst;
173typedef llvm::ResumeInst ResumeInst;
174typedef llvm::SelectInst SelectInst;
175typedef llvm::VAArgInst VAArgInst;
176typedef llvm::VACopyInst VACopyInst;
177typedef llvm::VAEndInst VAEndInst;
178typedef llvm::VAStartInst VAStartInst;
179typedef llvm::BinaryOperator BinaryOperator;
180typedef llvm::UnaryOperator UnaryOperator;
181typedef llvm::UndefValue UndefValue;
182typedef llvm::GEPOperator GEPOperator;
183
184// Related to Switch Case
185typedef std::pair<const BasicBlock*, const ConstantInt*> SuccBBAndCondValPair;
186typedef std::vector<SuccBBAndCondValPair> SuccBBAndCondValPairVec;
187
188// LLVM Intrinsic Instructions
189#if LLVM_VERSION_MAJOR >= 13
190typedef llvm::IntrinsicInst IntrinsicInst;
191typedef llvm::DbgInfoIntrinsic DbgInfoIntrinsic;
192typedef llvm::DbgVariableIntrinsic DbgVariableIntrinsic;
193typedef llvm::DbgDeclareInst DbgDeclareInst;
194typedef llvm::DbgInfoIntrinsic DbgInfoIntrinsic;
195typedef llvm::DbgValueInst DbgValueInst;
196typedef llvm::DbgLabelInst DbgLabelInst;
197typedef llvm::VPIntrinsic VPIntrinsic;
198typedef llvm::ConstrainedFPIntrinsic ConstrainedFPIntrinsic;
199typedef llvm::ConstrainedFPCmpIntrinsic ConstrainedFPCmpIntrinsic;
200typedef llvm::MinMaxIntrinsic MinMaxIntrinsic;
201typedef llvm::BinaryOpIntrinsic BinaryOpIntrinsic;
202typedef llvm::WithOverflowInst WithOverflowInst;
203typedef llvm::SaturatingInst SaturatingInst;
204typedef llvm::AtomicMemIntrinsic AtomicMemIntrinsic;
205typedef llvm::AtomicMemSetInst AtomicMemSetInst;
206typedef llvm::AtomicMemTransferInst AtomicMemTransferInst;
207typedef llvm::AtomicMemCpyInst AtomicMemCpyInst;
208typedef llvm::AtomicMemMoveInst AtomicMemMoveInst;
209typedef llvm::MemIntrinsic MemIntrinsic;
210typedef llvm::MemSetInst MemSetInst;
211typedef llvm::MemTransferInst MemTransferInst;
212typedef llvm::MemCpyInst MemCpyInst;
213typedef llvm::MemMoveInst MemMoveInst;
214typedef llvm::MemCpyInlineInst MemCpyInlineInst;
215typedef llvm::AnyMemIntrinsic AnyMemIntrinsic;
216typedef llvm::AnyMemSetInst AnyMemSetInst;
217typedef llvm::AnyMemTransferInst AnyMemTransferInst;
218typedef llvm::AnyMemCpyInst AnyMemCpyInst;
219typedef llvm::AnyMemMoveInst AnyMemMoveInst;
220typedef llvm::VAStartInst VAStartInst;
221typedef llvm::VAEndInst VAEndInst;
222typedef llvm::VACopyInst VACopyInst;
223typedef llvm::InstrProfIncrementInst InstrProfIncrementInst;
224typedef llvm::InstrProfIncrementInstStep InstrProfIncrementInstStep;
225typedef llvm::InstrProfValueProfileInst InstrProfValueProfileInst;
226typedef llvm::PseudoProbeInst PseudoProbeInst;
227typedef llvm::NoAliasScopeDeclInst NoAliasScopeDeclInst;
228typedef llvm::GCStatepointInst GCStatepointInst;
229typedef llvm::GCProjectionInst GCProjectionInst;
230typedef llvm::GCRelocateInst GCRelocateInst;
231typedef llvm::GCResultInst GCResultInst;
232typedef llvm::AssumeInst AssumeInst;
233#endif
234
235// LLVM Debug Information
236typedef llvm::DIType DIType;
237typedef llvm::DICompositeType DICompositeType;
238typedef llvm::DIDerivedType DIDerivedType;
239typedef llvm::DebugInfoFinder DebugInfoFinder;
240typedef llvm::DISubroutineType DISubroutineType;
241typedef llvm::DIBasicType DIBasicType;
242typedef llvm::DISubrange DISubrange;
243typedef llvm::DINode DINode;
244typedef llvm::DINodeArray DINodeArray;
245typedef llvm::DITypeRefArray DITypeRefArray;
246namespace dwarf = llvm::dwarf;
247
248// Iterators.
249typedef llvm::inst_iterator inst_iterator;
250typedef llvm::const_inst_iterator const_inst_iterator;
251typedef llvm::gep_type_iterator gep_type_iterator;
253typedef llvm::const_inst_iterator const_inst_iterator;
254typedef llvm::const_pred_iterator const_pred_iterator;
255
256// LLVM Scalar Evolution.
257typedef llvm::ScalarEvolutionWrapperPass ScalarEvolutionWrapperPass;
258typedef llvm::SCEVAddRecExpr SCEVAddRecExpr;
259typedef llvm::SCEVConstant SCEVConstant;
260typedef llvm::ScalarEvolution ScalarEvolution;
261typedef llvm::SCEV SCEV;
262
264typedef llvm::raw_fd_ostream raw_fd_ostream;
265
266// LLVM Types.
267typedef llvm::VectorType VectorType;
268#if (LLVM_VERSION_MAJOR >= 9)
269typedef llvm::FunctionCallee FunctionCallee;
270#endif
271
273#if LLVM_VERSION_MAJOR >= 11
274typedef llvm::const_succ_iterator succ_const_iterator;
275#else
276typedef llvm::succ_const_iterator succ_const_iterator;
277#endif
278} // End namespace SVF
279
280#endif // SVF_FE_BASIC_TYPES_H
for isBitcode
Definition BasicTypes.h:68
llvm::const_inst_iterator const_inst_iterator
Definition BasicTypes.h:250
llvm::DataLayout DataLayout
Definition BasicTypes.h:108
llvm::IntToPtrInst IntToPtrInst
Definition BasicTypes.h:166
llvm::DISubroutineType DISubroutineType
Definition BasicTypes.h:240
llvm::GlobalVariable GlobalVariable
Definition BasicTypes.h:130
llvm::VACopyInst VACopyInst
Definition BasicTypes.h:176
llvm::DINodeArray DINodeArray
Definition BasicTypes.h:244
llvm::GlobalAlias GlobalAlias
Definition BasicTypes.h:128
llvm::ArrayType ArrayType
Definition BasicTypes.h:95
llvm::raw_fd_ostream raw_fd_ostream
LLVM outputs.
Definition BasicTypes.h:264
llvm::Type Type
Definition BasicTypes.h:83
llvm::VectorType VectorType
Definition BasicTypes.h:267
llvm::CallBase CallBase
Definition BasicTypes.h:146
llvm::BasicBlock BasicBlock
Definition BasicTypes.h:86
llvm::inst_iterator inst_iterator
Definition BasicTypes.h:249
std::pair< const BasicBlock *, const ConstantInt * > SuccBBAndCondValPair
Definition BasicTypes.h:185
llvm::MDString MDString
Definition BasicTypes.h:101
llvm::UnaryOperator UnaryOperator
Definition BasicTypes.h:180
llvm::ConstantStruct ConstantStruct
Definition BasicTypes.h:106
llvm::StructType StructType
LLVM types.
Definition BasicTypes.h:94
llvm::DominanceFrontierBase< llvm::BasicBlock, false > DominanceFrontierBase
Definition BasicTypes.h:137
llvm::NamedMDNode NamedMDNode
LLVM metadata and debug information.
Definition BasicTypes.h:111
llvm::Use Use
Definition BasicTypes.h:72
llvm::MemoryLocation MemoryLocation
Definition BasicTypes.h:107
llvm::succ_const_iterator succ_const_iterator
LLVM Iterators.
Definition BasicTypes.h:276
llvm::bridge_gep_iterator bridge_gep_iterator
Definition BasicTypes.h:252
llvm::AllocaInst AllocaInst
Definition BasicTypes.h:150
llvm::IntegerType IntegerType
Definition BasicTypes.h:97
llvm::SwitchInst SwitchInst
Definition BasicTypes.h:155
llvm::AtomicRMWInst AtomicRMWInst
Definition BasicTypes.h:152
llvm::InsertValueInst InsertValueInst
Definition BasicTypes.h:167
llvm::SCEVAddRecExpr SCEVAddRecExpr
Definition BasicTypes.h:258
llvm::StructLayout StructLayout
Definition BasicTypes.h:105
llvm::InvokeInst InvokeInst
Definition BasicTypes.h:163
llvm::AtomicCmpXchgInst AtomicCmpXchgInst
Definition BasicTypes.h:151
llvm::Argument Argument
Definition BasicTypes.h:145
llvm::LoadInst LoadInst
Definition BasicTypes.h:149
llvm::ConstantArray ConstantArray
Definition BasicTypes.h:123
llvm::DebugInfoFinder DebugInfoFinder
Definition BasicTypes.h:239
llvm::const_pred_iterator const_pred_iterator
Definition BasicTypes.h:254
llvm::CmpInst CmpInst
Definition BasicTypes.h:159
llvm::Function Function
Definition BasicTypes.h:85
llvm::FenceInst FenceInst
Definition BasicTypes.h:168
llvm::ShuffleVectorInst ShuffleVectorInst
Definition BasicTypes.h:164
llvm::GlobalValue GlobalValue
Definition BasicTypes.h:88
llvm::InsertElementInst InsertElementInst
Definition BasicTypes.h:171
llvm::FunctionType FunctionType
Definition BasicTypes.h:98
llvm::ConstantData ConstantData
Definition BasicTypes.h:116
llvm::DINode DINode
Definition BasicTypes.h:243
llvm::MetadataAsValue MetadataAsValue
Definition BasicTypes.h:102
llvm::LoopInfo LoopInfo
Definition BasicTypes.h:141
llvm::Instruction Instruction
Definition BasicTypes.h:87
llvm::ConstantAggregate ConstantAggregate
Definition BasicTypes.h:117
llvm::Constant Constant
Definition BasicTypes.h:124
llvm::DomTreeNode DomTreeNode
Definition BasicTypes.h:134
llvm::DIDerivedType DIDerivedType
Definition BasicTypes.h:238
llvm::SMDiagnostic SMDiagnostic
Definition BasicTypes.h:90
llvm::GEPOperator GEPOperator
Definition BasicTypes.h:182
llvm::DISubprogram DISubprogram
Definition BasicTypes.h:113
llvm::UnreachableInst UnreachableInst
Definition BasicTypes.h:170
llvm::ConstantDataSequential ConstantDataSequential
Definition BasicTypes.h:119
llvm::ConstantAggregateZero ConstantAggregateZero
Definition BasicTypes.h:118
llvm::ResumeInst ResumeInst
Definition BasicTypes.h:173
std::vector< SuccBBAndCondValPair > SuccBBAndCondValPairVec
Definition BasicTypes.h:186
llvm::Value Value
LLVM Basic classes.
Definition BasicTypes.h:82
llvm::ConstantPointerNull ConstantPointerNull
Definition BasicTypes.h:127
llvm::ConstantExpr ConstantExpr
Definition BasicTypes.h:120
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74
llvm::BlockAddress BlockAddress
Definition BasicTypes.h:91
llvm::CastInst CastInst
Definition BasicTypes.h:158
llvm::FreezeInst FreezeInst
Definition BasicTypes.h:169
llvm::DISubrange DISubrange
Definition BasicTypes.h:242
llvm::DITypeRefArray DITypeRefArray
Definition BasicTypes.h:245
llvm::ScalarEvolutionWrapperPass ScalarEvolutionWrapperPass
Definition BasicTypes.h:257
llvm::gep_type_iterator gep_type_iterator
Definition BasicTypes.h:251
llvm::Module Module
Definition BasicTypes.h:84
llvm::PointerType PointerType
Definition BasicTypes.h:96
llvm::SCEV SCEV
Definition BasicTypes.h:261
llvm::GlobalIFunc GlobalIFunc
Definition BasicTypes.h:129
llvm::BinaryOperator BinaryOperator
Definition BasicTypes.h:179
llvm::PostDominatorTree PostDominatorTree
Definition BasicTypes.h:136
llvm::DominanceFrontier DominanceFrontier
Definition BasicTypes.h:135
llvm::StoreInst StoreInst
Definition BasicTypes.h:148
llvm::SelectInst SelectInst
Definition BasicTypes.h:174
llvm::VAArgInst VAArgInst
Definition BasicTypes.h:175
llvm::SCEVConstant SCEVConstant
Definition BasicTypes.h:259
llvm::Loop Loop
LLVM Loop.
Definition BasicTypes.h:140
llvm::ModulePass ModulePass
Definition BasicTypes.h:73
llvm::GetElementPtrInst GetElementPtrInst
Definition BasicTypes.h:162
llvm::CallBrInst CallBrInst
Definition BasicTypes.h:156
llvm::ReturnInst ReturnInst
Definition BasicTypes.h:157
llvm::PHINode PHINode
Definition BasicTypes.h:165
llvm::BranchInst BranchInst
Definition BasicTypes.h:154
llvm::ExtractValueInst ExtractValueInst
Definition BasicTypes.h:160
llvm::DIType DIType
Definition BasicTypes.h:236
llvm::MDNode MDNode
Definition BasicTypes.h:112
llvm::ConstantFP ConstantFP
Definition BasicTypes.h:126
llvm::ScalarEvolution ScalarEvolution
Definition BasicTypes.h:260
llvm::VAStartInst VAStartInst
Definition BasicTypes.h:178
llvm::ConstantDataArray ConstantDataArray
Definition BasicTypes.h:121
llvm::DIBasicType DIBasicType
Definition BasicTypes.h:241
llvm::VAEndInst VAEndInst
Definition BasicTypes.h:177
llvm::CallInst CallInst
Definition BasicTypes.h:147
llvm::DICompositeType DICompositeType
Definition BasicTypes.h:237
llvm::ConstantInt ConstantInt
Definition BasicTypes.h:125
llvm::UnifyFunctionExitNodes UnifyFunctionExitNodes
Definition BasicTypes.h:78
llvm::DominatorTree DominatorTree
LLVM Dominators.
Definition BasicTypes.h:133
llvm::GlobalObject GlobalObject
Definition BasicTypes.h:71
llvm::UndefValue UndefValue
Definition BasicTypes.h:181
llvm::LandingPadInst LandingPadInst
Definition BasicTypes.h:172
llvm::ExtractElementInst ExtractElementInst
Definition BasicTypes.h:161
llvm::User User
Definition BasicTypes.h:142
llvm::BitCastInst BitCastInst
Definition BasicTypes.h:153
llvm::LLVMContext LLVMContext
Definition BasicTypes.h:70