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 && LLVM_VERSION_MAJOR <= 16
76typedef llvm::UnifyFunctionExitNodesLegacyPass UnifyFunctionExitNodes;
77#elif LLVM_VERSION_MAJOR > 16
78typedef llvm::UnifyFunctionExitNodesPass UnifyFunctionExitNodes;
79#else
80typedef llvm::UnifyFunctionExitNodes UnifyFunctionExitNodes;
81#endif
82
84typedef llvm::Value Value;
85typedef llvm::Type Type;
86typedef llvm::Module Module;
87typedef llvm::Function Function;
88typedef llvm::BasicBlock BasicBlock;
89typedef llvm::Instruction Instruction;
90typedef llvm::GlobalValue GlobalValue;
91
92typedef llvm::SMDiagnostic SMDiagnostic;
93typedef llvm::BlockAddress BlockAddress;
94
96typedef llvm::StructType StructType;
97typedef llvm::ArrayType ArrayType;
98typedef llvm::PointerType PointerType;
99typedef llvm::IntegerType IntegerType;
100typedef llvm::FunctionType FunctionType;
101
102// LLVM Metadata
103typedef llvm::MDString MDString;
104typedef llvm::MetadataAsValue MetadataAsValue;
105
106// LLVM data layout
107typedef llvm::StructLayout StructLayout;
108typedef llvm::ConstantStruct ConstantStruct;
109typedef llvm::MemoryLocation MemoryLocation;
110typedef llvm::DataLayout DataLayout;
111
113typedef llvm::NamedMDNode NamedMDNode;
114typedef llvm::MDNode MDNode;
115typedef llvm::DISubprogram DISubprogram;
116
117// LLVM Aliases and constants
118typedef llvm::ConstantData ConstantData;
119typedef llvm::ConstantAggregate ConstantAggregate;
120typedef llvm::ConstantAggregateZero ConstantAggregateZero;
121typedef llvm::ConstantDataSequential ConstantDataSequential;
122typedef llvm::ConstantExpr ConstantExpr;
123typedef llvm::ConstantDataArray ConstantDataArray;
124typedef llvm::ConstantData ConstantData;
125typedef llvm::ConstantArray ConstantArray;
126typedef llvm::Constant Constant;
127typedef llvm::ConstantInt ConstantInt;
128typedef llvm::ConstantFP ConstantFP;
129typedef llvm::ConstantPointerNull ConstantPointerNull;
130typedef llvm::GlobalAlias GlobalAlias;
131typedef llvm::GlobalIFunc GlobalIFunc;
132typedef llvm::GlobalVariable GlobalVariable;
133
135typedef llvm::DominatorTree DominatorTree;
136typedef llvm::DomTreeNode DomTreeNode;
137typedef llvm::DominanceFrontier DominanceFrontier;
138typedef llvm::PostDominatorTree PostDominatorTree;
139typedef llvm::DominanceFrontierBase<llvm::BasicBlock, false> DominanceFrontierBase;
140
142typedef llvm::Loop Loop;
143typedef llvm::LoopInfo LoopInfo;
144typedef llvm::User User;
145
146// LLVM Instructions
147typedef llvm::Argument Argument;
148typedef llvm::CallBase CallBase;
149typedef llvm::CallInst CallInst;
150typedef llvm::StoreInst StoreInst;
151typedef llvm::LoadInst LoadInst;
152typedef llvm::AllocaInst AllocaInst;
153typedef llvm::AtomicCmpXchgInst AtomicCmpXchgInst;
154typedef llvm::AtomicRMWInst AtomicRMWInst;
155typedef llvm::BitCastInst BitCastInst;
156typedef llvm::BranchInst BranchInst;
157typedef llvm::SwitchInst SwitchInst;
158typedef llvm::CallBrInst CallBrInst;
159typedef llvm::ReturnInst ReturnInst;
160typedef llvm::CastInst CastInst;
161typedef llvm::CmpInst CmpInst;
162typedef llvm::ExtractValueInst ExtractValueInst;
163typedef llvm::ExtractElementInst ExtractElementInst;
164typedef llvm::GetElementPtrInst GetElementPtrInst;
165typedef llvm::InvokeInst InvokeInst;
166typedef llvm::ShuffleVectorInst ShuffleVectorInst;
167typedef llvm::PHINode PHINode;
168typedef llvm::IntToPtrInst IntToPtrInst;
169typedef llvm::InsertValueInst InsertValueInst;
170typedef llvm::FenceInst FenceInst;
171typedef llvm::FreezeInst FreezeInst;
172typedef llvm::UnreachableInst UnreachableInst;
173typedef llvm::InsertElementInst InsertElementInst;
174typedef llvm::LandingPadInst LandingPadInst;
175typedef llvm::ResumeInst ResumeInst;
176typedef llvm::SelectInst SelectInst;
177typedef llvm::VAArgInst VAArgInst;
178typedef llvm::VACopyInst VACopyInst;
179typedef llvm::VAEndInst VAEndInst;
180typedef llvm::VAStartInst VAStartInst;
181typedef llvm::BinaryOperator BinaryOperator;
182typedef llvm::UnaryOperator UnaryOperator;
183typedef llvm::UndefValue UndefValue;
184typedef llvm::GEPOperator GEPOperator;
185
186// Related to Switch Case
187typedef std::pair<const BasicBlock*, const ConstantInt*> SuccBBAndCondValPair;
188typedef std::vector<SuccBBAndCondValPair> SuccBBAndCondValPairVec;
189
190// LLVM Intrinsic Instructions
191#if LLVM_VERSION_MAJOR >= 13
192typedef llvm::IntrinsicInst IntrinsicInst;
193typedef llvm::DbgInfoIntrinsic DbgInfoIntrinsic;
194typedef llvm::DbgVariableIntrinsic DbgVariableIntrinsic;
195typedef llvm::DbgDeclareInst DbgDeclareInst;
196typedef llvm::DbgInfoIntrinsic DbgInfoIntrinsic;
197typedef llvm::DbgValueInst DbgValueInst;
198typedef llvm::DbgLabelInst DbgLabelInst;
199typedef llvm::VPIntrinsic VPIntrinsic;
200typedef llvm::ConstrainedFPIntrinsic ConstrainedFPIntrinsic;
201typedef llvm::ConstrainedFPCmpIntrinsic ConstrainedFPCmpIntrinsic;
202typedef llvm::MinMaxIntrinsic MinMaxIntrinsic;
203typedef llvm::BinaryOpIntrinsic BinaryOpIntrinsic;
204typedef llvm::WithOverflowInst WithOverflowInst;
205typedef llvm::SaturatingInst SaturatingInst;
206typedef llvm::AtomicMemIntrinsic AtomicMemIntrinsic;
207typedef llvm::AtomicMemSetInst AtomicMemSetInst;
208typedef llvm::AtomicMemTransferInst AtomicMemTransferInst;
209typedef llvm::AtomicMemCpyInst AtomicMemCpyInst;
210typedef llvm::AtomicMemMoveInst AtomicMemMoveInst;
211typedef llvm::MemIntrinsic MemIntrinsic;
212typedef llvm::MemSetInst MemSetInst;
213typedef llvm::MemTransferInst MemTransferInst;
214typedef llvm::MemCpyInst MemCpyInst;
215typedef llvm::MemMoveInst MemMoveInst;
216typedef llvm::MemCpyInlineInst MemCpyInlineInst;
217typedef llvm::AnyMemIntrinsic AnyMemIntrinsic;
218typedef llvm::AnyMemSetInst AnyMemSetInst;
219typedef llvm::AnyMemTransferInst AnyMemTransferInst;
220typedef llvm::AnyMemCpyInst AnyMemCpyInst;
221typedef llvm::AnyMemMoveInst AnyMemMoveInst;
222typedef llvm::VAStartInst VAStartInst;
223typedef llvm::VAEndInst VAEndInst;
224typedef llvm::VACopyInst VACopyInst;
225typedef llvm::InstrProfIncrementInst InstrProfIncrementInst;
226typedef llvm::InstrProfIncrementInstStep InstrProfIncrementInstStep;
227typedef llvm::InstrProfValueProfileInst InstrProfValueProfileInst;
228typedef llvm::PseudoProbeInst PseudoProbeInst;
229typedef llvm::NoAliasScopeDeclInst NoAliasScopeDeclInst;
230typedef llvm::GCStatepointInst GCStatepointInst;
231typedef llvm::GCProjectionInst GCProjectionInst;
232typedef llvm::GCRelocateInst GCRelocateInst;
233typedef llvm::GCResultInst GCResultInst;
234typedef llvm::AssumeInst AssumeInst;
235#endif
236
237// LLVM Debug Information
238typedef llvm::DIType DIType;
239typedef llvm::DICompositeType DICompositeType;
240typedef llvm::DIDerivedType DIDerivedType;
241typedef llvm::DebugInfoFinder DebugInfoFinder;
242typedef llvm::DISubroutineType DISubroutineType;
243typedef llvm::DIBasicType DIBasicType;
244typedef llvm::DISubrange DISubrange;
245typedef llvm::DINode DINode;
246typedef llvm::DINodeArray DINodeArray;
247typedef llvm::DITypeRefArray DITypeRefArray;
248namespace dwarf = llvm::dwarf;
249
250// Iterators.
251typedef llvm::inst_iterator inst_iterator;
252typedef llvm::const_inst_iterator const_inst_iterator;
253typedef llvm::gep_type_iterator gep_type_iterator;
255typedef llvm::const_inst_iterator const_inst_iterator;
256typedef llvm::const_pred_iterator const_pred_iterator;
257
258// LLVM Scalar Evolution.
259typedef llvm::ScalarEvolutionWrapperPass ScalarEvolutionWrapperPass;
260typedef llvm::SCEVAddRecExpr SCEVAddRecExpr;
261typedef llvm::SCEVConstant SCEVConstant;
262typedef llvm::ScalarEvolution ScalarEvolution;
263typedef llvm::SCEV SCEV;
264
266typedef llvm::raw_fd_ostream raw_fd_ostream;
267
268// LLVM Types.
269typedef llvm::VectorType VectorType;
270#if (LLVM_VERSION_MAJOR >= 9)
271typedef llvm::FunctionCallee FunctionCallee;
272#endif
273
275#if LLVM_VERSION_MAJOR >= 11
276typedef llvm::const_succ_iterator succ_const_iterator;
277#else
278typedef llvm::succ_const_iterator succ_const_iterator;
279#endif
280} // End namespace SVF
281
282#endif // SVF_FE_BASIC_TYPES_H
for isBitcode
Definition BasicTypes.h:68
llvm::const_inst_iterator const_inst_iterator
Definition BasicTypes.h:252
llvm::DataLayout DataLayout
Definition BasicTypes.h:110
llvm::IntToPtrInst IntToPtrInst
Definition BasicTypes.h:168
llvm::DISubroutineType DISubroutineType
Definition BasicTypes.h:242
llvm::GlobalVariable GlobalVariable
Definition BasicTypes.h:132
llvm::VACopyInst VACopyInst
Definition BasicTypes.h:178
llvm::DINodeArray DINodeArray
Definition BasicTypes.h:246
llvm::GlobalAlias GlobalAlias
Definition BasicTypes.h:130
llvm::ArrayType ArrayType
Definition BasicTypes.h:97
llvm::raw_fd_ostream raw_fd_ostream
LLVM outputs.
Definition BasicTypes.h:266
llvm::Type Type
Definition BasicTypes.h:85
llvm::VectorType VectorType
Definition BasicTypes.h:269
llvm::CallBase CallBase
Definition BasicTypes.h:148
llvm::BasicBlock BasicBlock
Definition BasicTypes.h:88
llvm::inst_iterator inst_iterator
Definition BasicTypes.h:251
std::pair< const BasicBlock *, const ConstantInt * > SuccBBAndCondValPair
Definition BasicTypes.h:187
llvm::MDString MDString
Definition BasicTypes.h:103
llvm::UnaryOperator UnaryOperator
Definition BasicTypes.h:182
llvm::ConstantStruct ConstantStruct
Definition BasicTypes.h:108
llvm::StructType StructType
LLVM types.
Definition BasicTypes.h:96
llvm::DominanceFrontierBase< llvm::BasicBlock, false > DominanceFrontierBase
Definition BasicTypes.h:139
llvm::NamedMDNode NamedMDNode
LLVM metadata and debug information.
Definition BasicTypes.h:113
llvm::Use Use
Definition BasicTypes.h:72
llvm::MemoryLocation MemoryLocation
Definition BasicTypes.h:109
llvm::succ_const_iterator succ_const_iterator
LLVM Iterators.
Definition BasicTypes.h:278
llvm::bridge_gep_iterator bridge_gep_iterator
Definition BasicTypes.h:254
llvm::AllocaInst AllocaInst
Definition BasicTypes.h:152
llvm::IntegerType IntegerType
Definition BasicTypes.h:99
llvm::SwitchInst SwitchInst
Definition BasicTypes.h:157
llvm::AtomicRMWInst AtomicRMWInst
Definition BasicTypes.h:154
llvm::InsertValueInst InsertValueInst
Definition BasicTypes.h:169
llvm::SCEVAddRecExpr SCEVAddRecExpr
Definition BasicTypes.h:260
llvm::StructLayout StructLayout
Definition BasicTypes.h:107
llvm::InvokeInst InvokeInst
Definition BasicTypes.h:165
llvm::AtomicCmpXchgInst AtomicCmpXchgInst
Definition BasicTypes.h:153
llvm::Argument Argument
Definition BasicTypes.h:147
llvm::LoadInst LoadInst
Definition BasicTypes.h:151
llvm::ConstantArray ConstantArray
Definition BasicTypes.h:125
llvm::DebugInfoFinder DebugInfoFinder
Definition BasicTypes.h:241
llvm::const_pred_iterator const_pred_iterator
Definition BasicTypes.h:256
llvm::CmpInst CmpInst
Definition BasicTypes.h:161
llvm::Function Function
Definition BasicTypes.h:87
llvm::FenceInst FenceInst
Definition BasicTypes.h:170
llvm::ShuffleVectorInst ShuffleVectorInst
Definition BasicTypes.h:166
llvm::GlobalValue GlobalValue
Definition BasicTypes.h:90
llvm::InsertElementInst InsertElementInst
Definition BasicTypes.h:173
llvm::FunctionType FunctionType
Definition BasicTypes.h:100
llvm::ConstantData ConstantData
Definition BasicTypes.h:118
llvm::DINode DINode
Definition BasicTypes.h:245
llvm::MetadataAsValue MetadataAsValue
Definition BasicTypes.h:104
llvm::LoopInfo LoopInfo
Definition BasicTypes.h:143
llvm::Instruction Instruction
Definition BasicTypes.h:89
llvm::ConstantAggregate ConstantAggregate
Definition BasicTypes.h:119
llvm::Constant Constant
Definition BasicTypes.h:126
llvm::DomTreeNode DomTreeNode
Definition BasicTypes.h:136
llvm::DIDerivedType DIDerivedType
Definition BasicTypes.h:240
llvm::SMDiagnostic SMDiagnostic
Definition BasicTypes.h:92
llvm::GEPOperator GEPOperator
Definition BasicTypes.h:184
llvm::DISubprogram DISubprogram
Definition BasicTypes.h:115
llvm::UnreachableInst UnreachableInst
Definition BasicTypes.h:172
llvm::ConstantDataSequential ConstantDataSequential
Definition BasicTypes.h:121
llvm::ConstantAggregateZero ConstantAggregateZero
Definition BasicTypes.h:120
llvm::ResumeInst ResumeInst
Definition BasicTypes.h:175
std::vector< SuccBBAndCondValPair > SuccBBAndCondValPairVec
Definition BasicTypes.h:188
llvm::Value Value
LLVM Basic classes.
Definition BasicTypes.h:84
llvm::ConstantPointerNull ConstantPointerNull
Definition BasicTypes.h:129
llvm::ConstantExpr ConstantExpr
Definition BasicTypes.h:122
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74
llvm::BlockAddress BlockAddress
Definition BasicTypes.h:93
llvm::CastInst CastInst
Definition BasicTypes.h:160
llvm::FreezeInst FreezeInst
Definition BasicTypes.h:171
llvm::DISubrange DISubrange
Definition BasicTypes.h:244
llvm::DITypeRefArray DITypeRefArray
Definition BasicTypes.h:247
llvm::ScalarEvolutionWrapperPass ScalarEvolutionWrapperPass
Definition BasicTypes.h:259
llvm::gep_type_iterator gep_type_iterator
Definition BasicTypes.h:253
llvm::Module Module
Definition BasicTypes.h:86
llvm::PointerType PointerType
Definition BasicTypes.h:98
llvm::SCEV SCEV
Definition BasicTypes.h:263
llvm::GlobalIFunc GlobalIFunc
Definition BasicTypes.h:131
llvm::BinaryOperator BinaryOperator
Definition BasicTypes.h:181
llvm::PostDominatorTree PostDominatorTree
Definition BasicTypes.h:138
llvm::DominanceFrontier DominanceFrontier
Definition BasicTypes.h:137
llvm::StoreInst StoreInst
Definition BasicTypes.h:150
llvm::SelectInst SelectInst
Definition BasicTypes.h:176
llvm::VAArgInst VAArgInst
Definition BasicTypes.h:177
llvm::SCEVConstant SCEVConstant
Definition BasicTypes.h:261
llvm::Loop Loop
LLVM Loop.
Definition BasicTypes.h:142
llvm::ModulePass ModulePass
Definition BasicTypes.h:73
llvm::GetElementPtrInst GetElementPtrInst
Definition BasicTypes.h:164
llvm::CallBrInst CallBrInst
Definition BasicTypes.h:158
llvm::ReturnInst ReturnInst
Definition BasicTypes.h:159
llvm::PHINode PHINode
Definition BasicTypes.h:167
llvm::BranchInst BranchInst
Definition BasicTypes.h:156
llvm::ExtractValueInst ExtractValueInst
Definition BasicTypes.h:162
llvm::DIType DIType
Definition BasicTypes.h:238
llvm::MDNode MDNode
Definition BasicTypes.h:114
llvm::ConstantFP ConstantFP
Definition BasicTypes.h:128
llvm::ScalarEvolution ScalarEvolution
Definition BasicTypes.h:262
llvm::VAStartInst VAStartInst
Definition BasicTypes.h:180
llvm::ConstantDataArray ConstantDataArray
Definition BasicTypes.h:123
llvm::DIBasicType DIBasicType
Definition BasicTypes.h:243
llvm::VAEndInst VAEndInst
Definition BasicTypes.h:179
llvm::CallInst CallInst
Definition BasicTypes.h:149
llvm::DICompositeType DICompositeType
Definition BasicTypes.h:239
llvm::ConstantInt ConstantInt
Definition BasicTypes.h:127
llvm::UnifyFunctionExitNodes UnifyFunctionExitNodes
Definition BasicTypes.h:80
llvm::DominatorTree DominatorTree
LLVM Dominators.
Definition BasicTypes.h:135
llvm::GlobalObject GlobalObject
Definition BasicTypes.h:71
llvm::UndefValue UndefValue
Definition BasicTypes.h:183
llvm::LandingPadInst LandingPadInst
Definition BasicTypes.h:174
llvm::ExtractElementInst ExtractElementInst
Definition BasicTypes.h:163
llvm::User User
Definition BasicTypes.h:144
llvm::BitCastInst BitCastInst
Definition BasicTypes.h:155
llvm::LLVMContext LLVMContext
Definition BasicTypes.h:70