summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJohannes Doerfert <johannes@jdoerfert.de>2019-11-04 22:00:49 -0600
committerJohannes Doerfert <johannes@jdoerfert.de>2019-12-10 00:10:09 -0600
commiteb3e81f43f019cd90da87169aeff0eaddc4c9ecb (patch)
tree14686e15855f33ad84e263946872edaf2802058c /llvm/lib
parent4448125007712d78fd114997a6fffc44b61b131d (diff)
downloadbcm5719-llvm-eb3e81f43f019cd90da87169aeff0eaddc4c9ecb.tar.gz
bcm5719-llvm-eb3e81f43f019cd90da87169aeff0eaddc4c9ecb.zip
[OpenMP][NFCI] Introduce llvm/IR/OpenMPConstants.h
Summary: The new OpenMPConstants.h is a location for all OpenMP related constants (and helpers) to live. This patch moves the directives there (the enum OpenMPDirectiveKind) and rewires Clang to use the new location. Initially part of D69785. Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim Subscribers: jholewinski, ppenzin, penzn, llvm-commits, cfe-commits, jfb, guansong, bollu, hiraditya, mgorny Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D69853
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CMakeLists.txt1
-rw-r--r--llvm/lib/Frontend/CMakeLists.txt1
-rw-r--r--llvm/lib/Frontend/LLVMBuild.txt23
-rw-r--r--llvm/lib/Frontend/OpenMP/CMakeLists.txt10
-rw-r--r--llvm/lib/Frontend/OpenMP/LLVMBuild.txt21
-rw-r--r--llvm/lib/Frontend/OpenMP/OMPConstants.cpp34
-rw-r--r--llvm/lib/LLVMBuild.txt1
7 files changed, 91 insertions, 0 deletions
diff --git a/llvm/lib/CMakeLists.txt b/llvm/lib/CMakeLists.txt
index 5a41d65b0cf..f7e08a68e67 100644
--- a/llvm/lib/CMakeLists.txt
+++ b/llvm/lib/CMakeLists.txt
@@ -8,6 +8,7 @@ add_subdirectory(CodeGen)
add_subdirectory(BinaryFormat)
add_subdirectory(Bitcode)
add_subdirectory(Bitstream)
+add_subdirectory(Frontend)
add_subdirectory(Transforms)
add_subdirectory(Linker)
add_subdirectory(Analysis)
diff --git a/llvm/lib/Frontend/CMakeLists.txt b/llvm/lib/Frontend/CMakeLists.txt
new file mode 100644
index 00000000000..9730c8414ed
--- /dev/null
+++ b/llvm/lib/Frontend/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(OpenMP)
diff --git a/llvm/lib/Frontend/LLVMBuild.txt b/llvm/lib/Frontend/LLVMBuild.txt
new file mode 100644
index 00000000000..78ec6ae5186
--- /dev/null
+++ b/llvm/lib/Frontend/LLVMBuild.txt
@@ -0,0 +1,23 @@
+;===- ./lib/Frontend/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
+;
+;===------------------------------------------------------------------------===;
+
+[common]
+subdirectories = OpenMP
+
+[component_0]
+type = Group
+name = Frontend
+parent = Libraries
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");
+}
diff --git a/llvm/lib/LLVMBuild.txt b/llvm/lib/LLVMBuild.txt
index 4c039176267..3f5383d9b1f 100644
--- a/llvm/lib/LLVMBuild.txt
+++ b/llvm/lib/LLVMBuild.txt
@@ -24,6 +24,7 @@ subdirectories =
DebugInfo
Demangle
ExecutionEngine
+ Frontend
FuzzMutate
LineEditor
Linker
OpenPOWER on IntegriCloud