diff options
Diffstat (limited to 'llvm/lib/Frontend/OpenMP')
| -rw-r--r-- | llvm/lib/Frontend/OpenMP/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | llvm/lib/Frontend/OpenMP/LLVMBuild.txt | 21 | ||||
| -rw-r--r-- | llvm/lib/Frontend/OpenMP/OMPConstants.cpp | 34 |
3 files changed, 65 insertions, 0 deletions
diff --git a/llvm/lib/Frontend/OpenMP/CMakeLists.txt b/llvm/lib/Frontend/OpenMP/CMakeLists.txt new file mode 100644 index 00000000000..5d74bcf3b9f --- /dev/null +++ b/llvm/lib/Frontend/OpenMP/CMakeLists.txt @@ -0,0 +1,10 @@ +add_llvm_component_library(LLVMFrontendOpenMP + OMPConstants.cpp + + ADDITIONAL_HEADER_DIRS + ${LLVM_MAIN_INCLUDE_DIR}/llvm/Frontend + ${LLVM_MAIN_INCLUDE_DIR}/llvm/Frontend/OpenMP + + DEPENDS + intrinsics_gen + ) diff --git a/llvm/lib/Frontend/OpenMP/LLVMBuild.txt b/llvm/lib/Frontend/OpenMP/LLVMBuild.txt new file mode 100644 index 00000000000..dfabe72fcd2 --- /dev/null +++ b/llvm/lib/Frontend/OpenMP/LLVMBuild.txt @@ -0,0 +1,21 @@ +;===- ./lib/Frontend/OpenMP/LLVMBuild.txt ----------------------*- Conf -*--===; +; +; 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 +; +;===------------------------------------------------------------------------===; +; +; This is an LLVMBuild description file for the components in this subdirectory. +; +; For more information on the LLVMBuild system, please see: +; +; http://llvm.org/docs/LLVMBuild.html +; +;===------------------------------------------------------------------------===; + +[component_0] +type = Library +name = FrontendOpenMP +parent = Frontend +required_libraries = Core Support TransformUtils diff --git a/llvm/lib/Frontend/OpenMP/OMPConstants.cpp b/llvm/lib/Frontend/OpenMP/OMPConstants.cpp new file mode 100644 index 00000000000..994fb4e2fa8 --- /dev/null +++ b/llvm/lib/Frontend/OpenMP/OMPConstants.cpp @@ -0,0 +1,34 @@ +//===- OMPConstants.cpp - Helpers related to OpenMP code generation ---===// +// +// 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 "llvm/Frontend/OpenMP/OMPConstants.h" + +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/StringSwitch.h" + +using namespace llvm; +using namespace omp; + +Directive llvm::omp::getOpenMPDirectiveKind(StringRef Str) { + return llvm::StringSwitch<Directive>(Str) +#define OMP_DIRECTIVE(Enum, Str) .Case(Str, Enum) +#include "llvm/Frontend/OpenMP/OMPKinds.def" + .Default(OMPD_unknown); +} + +StringRef llvm::omp::getOpenMPDirectiveName(Directive Kind) { + switch (Kind) { +#define OMP_DIRECTIVE(Enum, Str) \ + case Enum: \ + return Str; +#include "llvm/Frontend/OpenMP/OMPKinds.def" + } + llvm_unreachable("Invalid OpenMP directive kind"); +} |

