[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / openmp / libomptarget / DeviceRTL / src / Configuration.cpp
blobee8a98d703618f6db266c5e134f428ea0f595989
1 //===- Configuration.cpp - OpenMP device configuration interface -- C++ -*-===//
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 // This file contains the data object of the constant device environment and the
10 // query API.
12 //===----------------------------------------------------------------------===//
14 #include "Configuration.h"
15 #include "DeviceEnvironment.h"
16 #include "State.h"
17 #include "Types.h"
19 using namespace _OMP;
21 #pragma omp declare target
23 extern uint32_t __omp_rtl_debug_kind; // defined by CGOpenMPRuntimeGPU
25 // TODO: We want to change the name as soon as the old runtime is gone.
26 DeviceEnvironmentTy CONSTANT(omptarget_device_environment)
27 __attribute__((used, retain, weak));
29 uint32_t config::getDebugKind() {
30 return __omp_rtl_debug_kind & omptarget_device_environment.DebugKind;
33 uint32_t config::getNumDevices() {
34 return omptarget_device_environment.NumDevices;
37 uint32_t config::getDeviceNum() {
38 return omptarget_device_environment.DeviceNum;
41 uint64_t config::getDynamicMemorySize() {
42 return omptarget_device_environment.DynamicMemSize;
45 bool config::isDebugMode(config::DebugKind Kind) {
46 return config::getDebugKind() & Kind;
49 #pragma omp end declare target