[llvm-branch-commits] [clang] [CIR][AMDGPU] Lower Language specific address spaces and implement AMDGPU target (PR #179084)
David Rivera via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Mar 13 02:23:38 PDT 2026
================
@@ -0,0 +1,47 @@
+//===- AMDGPU.cpp - Emit CIR for AMDGPU -----------------------------------===//
+//
+// 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 "../TargetLoweringInfo.h"
+#include "clang/CIR/Dialect/IR/CIROpsEnums.h"
+#include "llvm/Support/ErrorHandling.h"
+
+namespace cir {
+
+namespace {
+
+class AMDGPUTargetLoweringInfo : public TargetLoweringInfo {
+public:
+ // Address space mapping from:
+ // https://llvm.org/docs/AMDGPUUsage.html#address-spaces
+ unsigned getTargetAddrSpaceFromCIRAddrSpace(
----------------
RiverDave wrote:
Hey Matt, Sorry for taking a while to get back to you.
`cir::LangAddressSpace` isn't a renaming of `clang::LangAS`. It's fundamentally a many-to-one unification. cuda_shared, opencl_local, and sycl_local all collapse to a single OffloadLocal at CIRGen time (this is the
design from the https://discourse.llvm.org/t/rfc-clangir-unified-address-space-design-in-clangir/79728).
Therefore `TargetInfo::getTargetAddressSpace(LangAS)` is our mapping of the unified representation back the target one.
https://github.com/llvm/llvm-project/pull/179084
More information about the llvm-branch-commits
mailing list