mirror of
				https://github.com/intel/intel-graphics-compiler.git
				synced 2025-10-30 08:18:26 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*========================== begin_copyright_notice ============================
 | |
| 
 | |
| Copyright (C) 2017-2021 Intel Corporation
 | |
| 
 | |
| SPDX-License-Identifier: MIT
 | |
| 
 | |
| ============================= end_copyright_notice ===========================*/
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include "Compiler/CISACodeGen/DeSSA.hpp"
 | |
| #include "Compiler/CISACodeGen/PatternMatchPass.hpp"
 | |
| #include "Compiler/MetaDataUtilsWrapper.h"
 | |
| #include "common/LLVMWarningsPush.hpp"
 | |
| #include <llvm/Pass.h>
 | |
| #include "common/LLVMWarningsPop.hpp"
 | |
| 
 | |
| namespace IGC {
 | |
| class CodeGenContextWrapper;
 | |
| 
 | |
| class BlockCoalescing : public llvm::FunctionPass {
 | |
| public:
 | |
|   static char ID;
 | |
| 
 | |
|   BlockCoalescing();
 | |
| 
 | |
|   virtual void getAnalysisUsage(llvm::AnalysisUsage &AU) const override {
 | |
|     AU.setPreservesAll();
 | |
|     AU.addRequired<DeSSA>();
 | |
|     AU.addRequired<CodeGenPatternMatch>();
 | |
|     AU.addRequired<MetaDataUtilsWrapper>();
 | |
|     AU.addRequired<CodeGenContextWrapper>();
 | |
|   }
 | |
| 
 | |
|   bool runOnFunction(llvm::Function &F) override;
 | |
| 
 | |
|   virtual llvm::StringRef getPassName() const override { return "BlockCoalescing"; }
 | |
|   bool IsEmptyBlock(llvm::BasicBlock *bb);
 | |
|   /// look for the next none-empty basick block
 | |
|   llvm::BasicBlock *SkipEmptyBasicBlock(llvm::BasicBlock *bb);
 | |
|   /// look for the destination to jump to if the block is empty
 | |
|   llvm::BasicBlock *FollowEmptyBlock(llvm::BasicBlock *bb);
 | |
| 
 | |
| protected:
 | |
|   llvm::DenseSet<llvm::BasicBlock *> m_emptyBlocks;
 | |
| 
 | |
| private:
 | |
|   bool hasEmptyBlockLoop(llvm::BasicBlock *EmptyBlock);
 | |
| };
 | |
| } // namespace IGC
 | 
