[llvm] a449b85 - [AMDGPU][R600] Move R600CodeGenPassBuilder into R600TargetMachine(NFC). (#103721)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 08:10:16 PDT 2024
Author: Christudasan Devadasan
Date: 2024-08-19T20:40:12+05:30
New Revision: a449b857241dd29a1164c483d3ee73612e45cbb4
URL: https://github.com/llvm/llvm-project/commit/a449b857241dd29a1164c483d3ee73612e45cbb4
DIFF: https://github.com/llvm/llvm-project/commit/a449b857241dd29a1164c483d3ee73612e45cbb4.diff
LOG: [AMDGPU][R600] Move R600CodeGenPassBuilder into R600TargetMachine(NFC). (#103721)
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
llvm/lib/Target/AMDGPU/CMakeLists.txt
llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
llvm/lib/Target/AMDGPU/R600TargetMachine.cpp
llvm/lib/Target/AMDGPU/R600TargetMachine.h
Removed:
llvm/lib/Target/AMDGPU/R600CodeGenPassBuilder.cpp
llvm/lib/Target/AMDGPU/R600CodeGenPassBuilder.h
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index 60d6b04f819841..f15d02ac9301ef 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -32,7 +32,6 @@
#include "GCNSchedStrategy.h"
#include "GCNVOPDUtils.h"
#include "R600.h"
-#include "R600MachineFunctionInfo.h"
#include "R600TargetMachine.h"
#include "SIFixSGPRCopies.h"
#include "SIMachineFunctionInfo.h"
@@ -1214,13 +1213,6 @@ AMDGPUPassConfig::createMachineScheduler(MachineSchedContext *C) const {
return DAG;
}
-MachineFunctionInfo *R600TargetMachine::createMachineFunctionInfo(
- BumpPtrAllocator &Allocator, const Function &F,
- const TargetSubtargetInfo *STI) const {
- return R600MachineFunctionInfo::create<R600MachineFunctionInfo>(
- Allocator, F, static_cast<const R600Subtarget *>(STI));
-}
-
//===----------------------------------------------------------------------===//
// GCN Legacy Pass Setup
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Target/AMDGPU/CMakeLists.txt b/llvm/lib/Target/AMDGPU/CMakeLists.txt
index f493076f5bb8a3..c91584ae8ce59c 100644
--- a/llvm/lib/Target/AMDGPU/CMakeLists.txt
+++ b/llvm/lib/Target/AMDGPU/CMakeLists.txt
@@ -121,7 +121,6 @@ add_llvm_target(AMDGPUCodeGen
GCNVOPDUtils.cpp
R600AsmPrinter.cpp
R600ClauseMergePass.cpp
- R600CodeGenPassBuilder.cpp
R600ControlFlowFinalizer.cpp
R600EmitClauseMarkers.cpp
R600ExpandSpecialInstrs.cpp
diff --git a/llvm/lib/Target/AMDGPU/R600CodeGenPassBuilder.cpp b/llvm/lib/Target/AMDGPU/R600CodeGenPassBuilder.cpp
deleted file mode 100644
index a57b3aa0adb158..00000000000000
--- a/llvm/lib/Target/AMDGPU/R600CodeGenPassBuilder.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-//===-- 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();
-}
diff --git a/llvm/lib/Target/AMDGPU/R600CodeGenPassBuilder.h b/llvm/lib/Target/AMDGPU/R600CodeGenPassBuilder.h
deleted file mode 100644
index be7c935c094d9f..00000000000000
--- a/llvm/lib/Target/AMDGPU/R600CodeGenPassBuilder.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//===-- 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
diff --git a/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp b/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
index c79688bf038be3..7e4d9d21a0b397 100644
--- a/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
@@ -15,7 +15,6 @@
#include "AMDGPU.h"
#include "MCTargetDesc/R600MCTargetDesc.h"
#include "R600Defines.h"
-#include "R600InstrInfo.h"
#include "R600MachineFunctionInfo.h"
#include "R600Subtarget.h"
#include "R600TargetMachine.h"
diff --git a/llvm/lib/Target/AMDGPU/R600TargetMachine.cpp b/llvm/lib/Target/AMDGPU/R600TargetMachine.cpp
index fe1927e5bdf74a..a1a60b8bdfa9ee 100644
--- a/llvm/lib/Target/AMDGPU/R600TargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/R600TargetMachine.cpp
@@ -7,14 +7,16 @@
//===----------------------------------------------------------------------===//
//
/// \file
-/// The AMDGPU-R600 target machine contains all of the hardware specific
-/// information needed to emit code for R600 GPUs.
+/// This file contains both AMDGPU-R600 target machine and the CodeGen pass
+/// builder. The target machine contains all of the hardware specific
+/// information needed to emit code for R600 GPUs and the CodeGen pass builder
+/// handles the pass pipeline for new pass manager.
//
//===----------------------------------------------------------------------===//
#include "R600TargetMachine.h"
#include "R600.h"
-#include "R600CodeGenPassBuilder.h"
+#include "R600MachineFunctionInfo.h"
#include "R600MachineScheduler.h"
#include "R600TargetTransformInfo.h"
#include "llvm/Transforms/Scalar.h"
@@ -152,3 +154,35 @@ Error R600TargetMachine::buildCodeGenPipeline(
R600CodeGenPassBuilder CGPB(*this, Opts, PIC);
return CGPB.buildPipeline(MPM, Out, DwoOut, FileType);
}
+
+MachineFunctionInfo *R600TargetMachine::createMachineFunctionInfo(
+ BumpPtrAllocator &Allocator, const Function &F,
+ const TargetSubtargetInfo *STI) const {
+ return R600MachineFunctionInfo::create<R600MachineFunctionInfo>(
+ Allocator, F, static_cast<const R600Subtarget *>(STI));
+}
+
+//===----------------------------------------------------------------------===//
+// R600 CodeGen Pass Builder interface.
+//===----------------------------------------------------------------------===//
+
+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();
+}
diff --git a/llvm/lib/Target/AMDGPU/R600TargetMachine.h b/llvm/lib/Target/AMDGPU/R600TargetMachine.h
index 29e370edef2c67..b7f123a07a9c1d 100644
--- a/llvm/lib/Target/AMDGPU/R600TargetMachine.h
+++ b/llvm/lib/Target/AMDGPU/R600TargetMachine.h
@@ -55,6 +55,21 @@ class R600TargetMachine final : public AMDGPUTargetMachine {
const TargetSubtargetInfo *STI) const override;
};
+//===----------------------------------------------------------------------===//
+// R600 CodeGen Pass Builder interface.
+//===----------------------------------------------------------------------===//
+
+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;
+};
+
} // end namespace llvm
#endif // LLVM_LIB_TARGET_AMDGPU_R600TARGETMACHINE_H
More information about the llvm-commits
mailing list