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