LLVM 22.0.0git
SPIRVStructurizer.cpp File Reference
#include "Analysis/SPIRVConvergenceRegionAnalysis.h"
#include "SPIRV.h"
#include "SPIRVStructurizerWrapper.h"
#include "SPIRVSubtarget.h"
#include "SPIRVUtils.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/CodeGen/IntrinsicLowering.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsSPIRV.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/InitializePasses.h"
#include "llvm/Transforms/Utils.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/LoopSimplify.h"
#include "llvm/Transforms/Utils/LowerMemIntrinsics.h"
#include <stack>
#include <unordered_set>

Go to the source code of this file.

Typedefs

using BlockSet = std::unordered_set<BasicBlock *>
using Edge = std::pair<BasicBlock *, BasicBlock *>

Functions

static void partialOrderVisit (BasicBlock &Start, std::function< bool(BasicBlock *)> Op)
static const ConvergenceRegiongetRegionForHeader (const ConvergenceRegion *Node, BasicBlock *BB)
static BasicBlockgetExitFor (const ConvergenceRegion *CR)
static BasicBlockgetDesignatedMergeBlock (Instruction *I)
static BasicBlockgetDesignatedContinueBlock (Instruction *I)
static bool isDefinedAsSelectionMergeBy (BasicBlock &Header, BasicBlock &Merge)
static bool hasLoopMergeInstruction (BasicBlock &BB)
static bool isMergeInstruction (Instruction *I)
static SmallPtrSet< BasicBlock *, 2 > getHeaderBlocks (Function &F)
static SmallPtrSet< BasicBlock *, 2 > getMergeBlocks (Function &F)
static std::vector< Instruction * > getMergeInstructions (BasicBlock &BB)
static SmallPtrSet< BasicBlock *, 2 > getContinueBlocks (Function &F)
static void visit (BasicBlock &Start, std::function< bool(BasicBlock *)> op)
static void replaceIfBranchTargets (BasicBlock *BB, BasicBlock *OldTarget, BasicBlock *NewTarget)
static void replaceBranchTargets (BasicBlock *BB, BasicBlock *OldTarget, BasicBlock *NewTarget)
 INITIALIZE_PASS_BEGIN (SPIRVStructurizer, "spirv-structurizer", "structurize SPIRV", false, false) INITIALIZE_PASS_END(SPIRVStructurizer

Variables

spirv structurizer
spirv structurize SPIRV
spirv structurize false

Typedef Documentation

◆ BlockSet

using BlockSet = std::unordered_set<BasicBlock *>

Definition at line 38 of file SPIRVStructurizer.cpp.

◆ Edge

using Edge = std::pair<BasicBlock *, BasicBlock *>

Definition at line 39 of file SPIRVStructurizer.cpp.

Function Documentation

◆ getContinueBlocks()

SmallPtrSet< BasicBlock *, 2 > getContinueBlocks ( Function & F)
static

◆ getDesignatedContinueBlock()

BasicBlock * getDesignatedContinueBlock ( Instruction * I)
static

◆ getDesignatedMergeBlock()

◆ getExitFor()

◆ getHeaderBlocks()

SmallPtrSet< BasicBlock *, 2 > getHeaderBlocks ( Function & F)
static

◆ getMergeBlocks()

SmallPtrSet< BasicBlock *, 2 > getMergeBlocks ( Function & F)
static

◆ getMergeInstructions()

std::vector< Instruction * > getMergeInstructions ( BasicBlock & BB)
static

Definition at line 166 of file SPIRVStructurizer.cpp.

References I, and isMergeInstruction().

◆ getRegionForHeader()

const ConvergenceRegion * getRegionForHeader ( const ConvergenceRegion * Node,
BasicBlock * BB )
static

Definition at line 52 of file SPIRVStructurizer.cpp.

References getRegionForHeader().

Referenced by getRegionForHeader().

◆ hasLoopMergeInstruction()

bool hasLoopMergeInstruction ( BasicBlock & BB)
static

Definition at line 123 of file SPIRVStructurizer.cpp.

References getDesignatedContinueBlock(), and I.

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( SPIRVStructurizer ,
"spirv-structurizer" ,
"structurize SPIRV" ,
false ,
false  )

◆ isDefinedAsSelectionMergeBy()

bool isDefinedAsSelectionMergeBy ( BasicBlock & Header,
BasicBlock & Merge )
static

Definition at line 113 of file SPIRVStructurizer.cpp.

References getDesignatedMergeBlock(), I, and Merge.

◆ isMergeInstruction()

bool isMergeInstruction ( Instruction * I)
static

Definition at line 132 of file SPIRVStructurizer.cpp.

References getDesignatedMergeBlock(), and I.

Referenced by getMergeInstructions().

◆ partialOrderVisit()

void partialOrderVisit ( BasicBlock & Start,
std::function< bool(BasicBlock *)> Op )
static

Definition at line 43 of file SPIRVStructurizer.cpp.

◆ replaceBranchTargets()

void replaceBranchTargets ( BasicBlock * BB,
BasicBlock * OldTarget,
BasicBlock * NewTarget )
static

◆ replaceIfBranchTargets()

◆ visit()

Variable Documentation

◆ false

spirv structurize false

Definition at line 1223 of file SPIRVStructurizer.cpp.

◆ SPIRV

spirv structurize SPIRV

Definition at line 1223 of file SPIRVStructurizer.cpp.

◆ structurizer

spirv structurizer

Definition at line 1222 of file SPIRVStructurizer.cpp.