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.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "Configuration.h"
15 #include "State.h"
16 #include "Types.h"
17 
18 using namespace _OMP;
19 
20 struct DeviceEnvironmentTy {
21   int32_t DebugLevel;
22 };
23 
24 #pragma omp declare target
25 
26 // TOOD: We want to change the name as soon as the old runtime is gone.
27 DeviceEnvironmentTy CONSTANT(omptarget_device_environment)
28     __attribute__((used));
29 
30 int32_t config::getDebugLevel() {
31   // TODO: Implement libomptarget initialization of DeviceEnvironmentTy
32   return 0;
33 }
34 
35 uint32_t config::getNumDevices() {
36   // TODO: Implement libomptarget initialization of DeviceEnvironmentTy
37   return 1;
38 }
39 
40 bool config::isDebugMode(config::DebugLevel Level) {
41   return config::getDebugLevel() > Level;
42 }
43 
44 #pragma omp end declare target
45