[llvm] [AMDGPU][NewInsertWaitcnts] Boilerplate for the new wait insertion pass (PR #226335)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 25 02:05:30 PDT 2026
================
@@ -0,0 +1,78 @@
+//===- AMDGPUNewInsertWaitcnts.cpp - Wait Instruction Insertion Pass ------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// A wait insertion pass for AMDGPU.
+//
+//===----------------------------------------------------------------------===//
+
+#include "AMDGPUNewInsertWaitcnts.h"
+#include "AMDGPU.h"
+#include "llvm/Analysis/AliasAnalysis.h"
+#include "llvm/CodeGen/MachineFunctionPass.h"
+
+using namespace llvm;
+using namespace llvm::AMDGPU;
+
+#define DEBUG_TYPE "amdgpu-new-insert-waitcnts"
+
+namespace {
+
+class AMDGPUNewInsertWaitcntsLegacy : public MachineFunctionPass {
+ InsertWaitcnts IW;
+
+public:
+ static char ID;
+
+ AMDGPUNewInsertWaitcntsLegacy() : MachineFunctionPass(ID) {}
+
+ bool runOnMachineFunction(MachineFunction &MF) override { return IW.run(MF); }
+
+ StringRef getPassName() const override { return "AMDGPU New Wait Insertion"; }
+
+ void getAnalysisUsage(AnalysisUsage &AU) const override {
+ AU.setPreservesAll();
+ MachineFunctionPass::getAnalysisUsage(AU);
+ }
+};
+
+} // end anonymous namespace
+
+INITIALIZE_PASS(AMDGPUNewInsertWaitcntsLegacy, DEBUG_TYPE,
+ "AMDGPU New Insert Waitcnts", false, false)
----------------
Pierre-vh wrote:
Use a `PASS_NAME` macro that can replace both this and the `getPassName` return value
```suggestion
PASS_NAME, false, false)
```
https://github.com/llvm/llvm-project/pull/226335
More information about the llvm-commits
mailing list