-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NewPM][AMDGPU] Add CodeGenPassBuilder (#91040)
In order to test SelectionDAG for target AMDGPU, we need CodeGenPassBuilder.
- Loading branch information
1 parent
9d15fc0
commit b4ba3fe
Showing
9 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//===- lib/Target/AMDGPU/AMDGPUCodeGenPassBuilder.cpp ---------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "AMDGPUCodeGenPassBuilder.h" | ||
#include "AMDGPUTargetMachine.h" | ||
|
||
using namespace llvm; | ||
|
||
AMDGPUCodeGenPassBuilder::AMDGPUCodeGenPassBuilder( | ||
AMDGPUTargetMachine &TM, const CGPassBuilderOption &Opts, | ||
PassInstrumentationCallbacks *PIC) | ||
: CodeGenPassBuilder(TM, Opts, PIC) { | ||
Opt.RequiresCodeGenSCCOrder = true; | ||
// Exceptions and StackMaps are not supported, so these passes will never do | ||
// anything. | ||
// Garbage collection is not supported. | ||
disablePass<StackMapLivenessPass, FuncletLayoutPass, | ||
ShadowStackGCLoweringPass>(); | ||
} | ||
|
||
void AMDGPUCodeGenPassBuilder::addPreISel(AddIRPass &addPass) const { | ||
// TODO: Add passes pre instruction selection. | ||
} | ||
|
||
void AMDGPUCodeGenPassBuilder::addAsmPrinter(AddMachinePass &addPass, | ||
CreateMCStreamer) const { | ||
// TODO: Add AsmPrinter. | ||
} | ||
|
||
Error AMDGPUCodeGenPassBuilder::addInstSelector(AddMachinePass &) const { | ||
// TODO: Add instruction selector. | ||
return Error::success(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//===- lib/Target/AMDGPU/AMDGPUCodeGenPassBuilder.h -----------*- C++ -*---===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUCODEGENPASSBUILDER_H | ||
#define LLVM_LIB_TARGET_AMDGPU_AMDGPUCODEGENPASSBUILDER_H | ||
|
||
#include "llvm/MC/MCStreamer.h" | ||
#include "llvm/Passes/CodeGenPassBuilder.h" | ||
|
||
namespace llvm { | ||
|
||
class AMDGPUTargetMachine; | ||
|
||
class AMDGPUCodeGenPassBuilder | ||
: public CodeGenPassBuilder<AMDGPUCodeGenPassBuilder, AMDGPUTargetMachine> { | ||
public: | ||
AMDGPUCodeGenPassBuilder(AMDGPUTargetMachine &TM, | ||
const CGPassBuilderOption &Opts, | ||
PassInstrumentationCallbacks *PIC); | ||
|
||
void addPreISel(AddIRPass &addPass) const; | ||
void addAsmPrinter(AddMachinePass &, CreateMCStreamer) const; | ||
Error addInstSelector(AddMachinePass &) const; | ||
}; | ||
|
||
} // namespace llvm | ||
|
||
#endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUCODEGENPASSBUILDER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//===-- R600CodeGenPassBuilder.cpp ------ Build R600 CodeGen pipeline -----===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "R600CodeGenPassBuilder.h" | ||
#include "R600TargetMachine.h" | ||
|
||
using namespace llvm; | ||
|
||
R600CodeGenPassBuilder::R600CodeGenPassBuilder( | ||
R600TargetMachine &TM, const CGPassBuilderOption &Opts, | ||
PassInstrumentationCallbacks *PIC) | ||
: CodeGenPassBuilder(TM, Opts, PIC) { | ||
Opt.RequiresCodeGenSCCOrder = true; | ||
} | ||
|
||
void R600CodeGenPassBuilder::addPreISel(AddIRPass &addPass) const { | ||
// TODO: Add passes pre instruction selection. | ||
} | ||
|
||
void R600CodeGenPassBuilder::addAsmPrinter(AddMachinePass &addPass, | ||
CreateMCStreamer) const { | ||
// TODO: Add AsmPrinter. | ||
} | ||
|
||
Error R600CodeGenPassBuilder::addInstSelector(AddMachinePass &) const { | ||
// TODO: Add instruction selector. | ||
return Error::success(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//===-- R600CodeGenPassBuilder.h -- Build R600 CodeGen pipeline -*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_LIB_TARGET_AMDGPU_R600CODEGENPASSBUILDER_H | ||
#define LLVM_LIB_TARGET_AMDGPU_R600CODEGENPASSBUILDER_H | ||
|
||
#include "llvm/MC/MCStreamer.h" | ||
#include "llvm/Passes/CodeGenPassBuilder.h" | ||
|
||
namespace llvm { | ||
|
||
class R600TargetMachine; | ||
|
||
class R600CodeGenPassBuilder | ||
: public CodeGenPassBuilder<R600CodeGenPassBuilder, R600TargetMachine> { | ||
public: | ||
R600CodeGenPassBuilder(R600TargetMachine &TM, const CGPassBuilderOption &Opts, | ||
PassInstrumentationCallbacks *PIC); | ||
|
||
void addPreISel(AddIRPass &addPass) const; | ||
void addAsmPrinter(AddMachinePass &, CreateMCStreamer) const; | ||
Error addInstSelector(AddMachinePass &) const; | ||
}; | ||
|
||
} // namespace llvm | ||
|
||
#endif // LLVM_LIB_TARGET_AMDGPU_R600CODEGENPASSBUILDER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters