[llvm-branch-commits] [llvm] [AMDGPU] wip: MIR pretty printing for S_WAITCNT_FENCE_soft (PR #150391)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jul 25 06:57:51 PDT 2025
================
@@ -12,10 +12,135 @@
//===----------------------------------------------------------------------===//
#include "AMDGPUMIRFormatter.h"
+#include "SIDefines.h"
#include "SIMachineFunctionInfo.h"
using namespace llvm;
+bool parseAtomicOrdering(StringRef Src, unsigned &Order) {
+ Src.consume_front(".");
+ for (unsigned I = 0; I <= (unsigned)AtomicOrdering::LAST; ++I) {
+ if (Src == toIRString((AtomicOrdering)I)) {
+ Order = I;
+ return true;
+ }
+ }
+ Order = ~0u;
+ return false;
+}
+
+static const char *fmtScope(unsigned Scope) {
+ static const char *Names[] = {"none", "singlethread", "wavefront",
+ "workgroup", "agent", "system"};
+ return Names[Scope];
+}
+
+bool parseAtomicScope(StringRef Src, unsigned &Scope) {
+ Src.consume_front(".");
+ for (unsigned I = 0;
+ I != (unsigned)AMDGPU::SIAtomicScope::NUM_SI_ATOMIC_SCOPES; ++I) {
+ if (Src == fmtScope(I)) {
+ Scope = I;
+ return true;
+ }
+ }
+ Scope = ~0u;
+ return false;
+}
+
+static const char *fmtAddrSpace(unsigned Space) {
+ static const char *Names[] = {"none", "global", "lds",
+ "scratch", "gds", "other"};
+ return Names[Space];
+}
+
+bool parseOneAddrSpace(StringRef Src, unsigned &AddrSpace) {
+ if (Src == "none") {
----------------
arsenm wrote:
StringSwitch?
https://github.com/llvm/llvm-project/pull/150391
More information about the llvm-branch-commits
mailing list