Static Value-Flow Analysis
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 
67 namespace SVF
68 {
69 
72 typedef llvm::Use Use;
74 typedef llvm::IRBuilder<> IRBuilder;
75 #if LLVM_VERSION_MAJOR >= 12
76 typedef llvm::UnifyFunctionExitNodesLegacyPass UnifyFunctionExitNodes;
77 #else
79 #endif
80 
83 typedef llvm::Type Type;
89 
92 
99 
100 // LLVM Metadata
103 
104 // LLVM data layout
109 
114 
115 // LLVM Aliases and constants
131 
137 typedef llvm::DominanceFrontierBase<llvm::BasicBlock, false> DominanceFrontierBase;
138 
140 typedef llvm::Loop Loop;
142 typedef llvm::User User;
143 
144 // LLVM Instructions
183 
184 // Related to Switch Case
185 typedef std::pair<const BasicBlock*, const ConstantInt*> SuccBBAndCondValPair;
186 typedef std::vector<SuccBBAndCondValPair> SuccBBAndCondValPairVec;
187 
188 // LLVM Intrinsic Instructions
189 #if LLVM_VERSION_MAJOR >= 13
190 typedef llvm::IntrinsicInst IntrinsicInst;
191 typedef llvm::DbgInfoIntrinsic DbgInfoIntrinsic;
192 typedef llvm::DbgVariableIntrinsic DbgVariableIntrinsic;
193 typedef llvm::DbgDeclareInst DbgDeclareInst;
194 typedef llvm::DbgInfoIntrinsic DbgInfoIntrinsic;
195 typedef llvm::DbgValueInst DbgValueInst;
196 typedef llvm::DbgLabelInst DbgLabelInst;
197 typedef llvm::VPIntrinsic VPIntrinsic;
198 typedef llvm::ConstrainedFPIntrinsic ConstrainedFPIntrinsic;
199 typedef llvm::ConstrainedFPCmpIntrinsic ConstrainedFPCmpIntrinsic;
200 typedef llvm::MinMaxIntrinsic MinMaxIntrinsic;
201 typedef llvm::BinaryOpIntrinsic BinaryOpIntrinsic;
202 typedef llvm::WithOverflowInst WithOverflowInst;
203 typedef llvm::SaturatingInst SaturatingInst;
204 typedef llvm::AtomicMemIntrinsic AtomicMemIntrinsic;
205 typedef llvm::AtomicMemSetInst AtomicMemSetInst;
206 typedef llvm::AtomicMemTransferInst AtomicMemTransferInst;
207 typedef llvm::AtomicMemCpyInst AtomicMemCpyInst;
208 typedef llvm::AtomicMemMoveInst AtomicMemMoveInst;
209 typedef llvm::MemIntrinsic MemIntrinsic;
210 typedef llvm::MemSetInst MemSetInst;
211 typedef llvm::MemTransferInst MemTransferInst;
212 typedef llvm::MemCpyInst MemCpyInst;
213 typedef llvm::MemMoveInst MemMoveInst;
214 typedef llvm::MemCpyInlineInst MemCpyInlineInst;
215 typedef llvm::AnyMemIntrinsic AnyMemIntrinsic;
216 typedef llvm::AnyMemSetInst AnyMemSetInst;
217 typedef llvm::AnyMemTransferInst AnyMemTransferInst;
218 typedef llvm::AnyMemCpyInst AnyMemCpyInst;
219 typedef llvm::AnyMemMoveInst AnyMemMoveInst;
221 typedef llvm::VAEndInst VAEndInst;
223 typedef llvm::InstrProfIncrementInst InstrProfIncrementInst;
224 typedef llvm::InstrProfIncrementInstStep InstrProfIncrementInstStep;
225 typedef llvm::InstrProfValueProfileInst InstrProfValueProfileInst;
226 typedef llvm::PseudoProbeInst PseudoProbeInst;
227 typedef llvm::NoAliasScopeDeclInst NoAliasScopeDeclInst;
228 typedef llvm::GCStatepointInst GCStatepointInst;
229 typedef llvm::GCProjectionInst GCProjectionInst;
230 typedef llvm::GCRelocateInst GCRelocateInst;
231 typedef llvm::GCResultInst GCResultInst;
232 typedef llvm::AssumeInst AssumeInst;
233 #endif
234 
235 // LLVM Debug Information
246 namespace dwarf = llvm::dwarf;
247 
248 // Iterators.
255 
256 // LLVM Scalar Evolution.
261 typedef llvm::SCEV SCEV;
262 
265 
266 // LLVM Types.
268 #if (LLVM_VERSION_MAJOR >= 9)
269 typedef llvm::FunctionCallee FunctionCallee;
270 #endif
271 
273 #if LLVM_VERSION_MAJOR >= 11
274 typedef llvm::const_succ_iterator succ_const_iterator;
275 #else
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