1 //===- lib/Target/AMDGPU/AMDGPUCodeGenPassBuilder.cpp ---------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "AMDGPUCodeGenPassBuilder.h" 10 #include "AMDGPUISelDAGToDAG.h" 11 #include "AMDGPUTargetMachine.h" 12 #include "llvm/Analysis/UniformityAnalysis.h" 13 14 using namespace llvm; 15 16 AMDGPUCodeGenPassBuilder::AMDGPUCodeGenPassBuilder( 17 AMDGPUTargetMachine &TM, const CGPassBuilderOption &Opts, 18 PassInstrumentationCallbacks *PIC) 19 : CodeGenPassBuilder(TM, Opts, PIC) { 20 Opt.RequiresCodeGenSCCOrder = true; 21 // Exceptions and StackMaps are not supported, so these passes will never do 22 // anything. 23 // Garbage collection is not supported. 24 disablePass<StackMapLivenessPass, FuncletLayoutPass, 25 ShadowStackGCLoweringPass>(); 26 } 27 28 void AMDGPUCodeGenPassBuilder::addPreISel(AddIRPass &addPass) const { 29 // TODO: Add passes pre instruction selection. 30 // Test only, convert to real IR passes in future. 31 addPass(RequireAnalysisPass<UniformityInfoAnalysis, Function>()); 32 } 33 34 void AMDGPUCodeGenPassBuilder::addAsmPrinter(AddMachinePass &addPass, 35 CreateMCStreamer) const { 36 // TODO: Add AsmPrinter. 37 } 38 39 Error AMDGPUCodeGenPassBuilder::addInstSelector(AddMachinePass &addPass) const { 40 addPass(AMDGPUISelDAGToDAGPass(TM)); 41 return Error::success(); 42 } 43