clang 24.0.0git
CIROpenACCUtils.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Implementation of CIR OpenACC utilities.
10//
11//===----------------------------------------------------------------------===//
12
14
15#include "llvm/Support/ErrorHandling.h"
16
17namespace cir::acc {
18
19bool isDeviceAccessibleAddressSpace(cir::LangAddressSpace space) {
20 switch (space) {
21 case cir::LangAddressSpace::OffloadPrivate:
22 case cir::LangAddressSpace::OffloadLocal:
23 case cir::LangAddressSpace::OffloadGlobal:
24 case cir::LangAddressSpace::OffloadConstant:
25 case cir::LangAddressSpace::OffloadGlobalDevice:
26 case cir::LangAddressSpace::OffloadGlobalHost:
27 case cir::LangAddressSpace::OffloadGeneric:
28 return true;
29 case cir::LangAddressSpace::Default:
30 return false;
31 }
32 llvm_unreachable("unhandled CIR language address space");
33}
34
35bool isDeviceResidentAddressSpace(cir::LangAddressSpace space) {
36 switch (space) {
37 case cir::LangAddressSpace::OffloadPrivate:
38 case cir::LangAddressSpace::OffloadLocal:
39 case cir::LangAddressSpace::OffloadGlobal:
40 case cir::LangAddressSpace::OffloadConstant:
41 case cir::LangAddressSpace::OffloadGlobalDevice:
42 return true;
43 case cir::LangAddressSpace::Default:
44 case cir::LangAddressSpace::OffloadGlobalHost:
45 case cir::LangAddressSpace::OffloadGeneric:
46 return false;
47 }
48 llvm_unreachable("unhandled CIR language address space");
49}
50
51} // namespace cir::acc
bool isDeviceResidentAddressSpace(cir::LangAddressSpace space)
Returns true if storage in space physically resides on the device.
bool isDeviceAccessibleAddressSpace(cir::LangAddressSpace space)
Returns true if code on the device can reach storage in space.