diff options
author | maxim-yurchuk <maxim-yurchuk@yandex-team.com> | 2024-10-09 12:29:46 +0300 |
---|---|---|
committer | maxim-yurchuk <maxim-yurchuk@yandex-team.com> | 2024-10-09 13:14:22 +0300 |
commit | 9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80 (patch) | |
tree | a8fb3181d5947c0d78cf402aa56e686130179049 /contrib/libs/llvm16/include | |
parent | a44b779cd359f06c3ebbef4ec98c6b38609d9d85 (diff) | |
download | ydb-9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80.tar.gz |
publishFullContrib: true for ydb
<HIDDEN_URL>
commit_hash:c82a80ac4594723cebf2c7387dec9c60217f603e
Diffstat (limited to 'contrib/libs/llvm16/include')
78 files changed, 19216 insertions, 0 deletions
diff --git a/contrib/libs/llvm16/include/.yandex_meta/licenses.list.txt b/contrib/libs/llvm16/include/.yandex_meta/licenses.list.txt new file mode 100644 index 0000000000..43639bf84c --- /dev/null +++ b/contrib/libs/llvm16/include/.yandex_meta/licenses.list.txt @@ -0,0 +1,289 @@ +====================Apache-2.0 WITH LLVM-exception==================== + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + + +====================Apache-2.0 WITH LLVM-exception==================== + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + + +====================Apache-2.0 WITH LLVM-exception==================== +/* Part of the LLVM Project, under the Apache License v2.0 with LLVM */ +/* Exceptions. */ +/* See https://llvm.org/LICENSE.txt for license information. */ + + +====================Apache-2.0 WITH LLVM-exception==================== +/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ + + +====================Apache-2.0 WITH LLVM-exception==================== +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. + + +====================Apache-2.0 WITH LLVM-exception==================== +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + + +====================Apache-2.0 WITH LLVM-exception==================== +/// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +/// See https://llvm.org/LICENSE.txt for license information. + + +====================Apache-2.0 WITH LLVM-exception==================== +/// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + + +====================Apache-2.0 WITH LLVM-exception==================== +Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +See https://llvm.org/LICENSE.txt for license information. + + +====================Apache-2.0 WITH LLVM-exception==================== +SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +====================Apache-2.0 WITH LLVM-exception==================== +|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| +|* Exceptions. *| +|* See https://llvm.org/LICENSE.txt for license information. *| + + +====================Apache-2.0 WITH LLVM-exception==================== +|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +|* See https://llvm.org/LICENSE.txt for license information. + + +====================Apache-2.0 WITH LLVM-exception==================== +|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + + +====================Apache-2.0 WITH LLVM-exception==================== +|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| + + +====================BSD-2-Clause==================== + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + +====================BSD-2-Clause==================== + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +====================CC0-1.0==================== +|* SPDX-License-Identifier: CC0-1.0 *| + + +====================COPYRIGHT==================== + Copyright (C) 2012-2016, Yann Collet. + + +====================COPYRIGHT==================== + static bool isChar6(char C) { return isAlnum(C) || C == '.' || C == '_'; } + static unsigned EncodeChar6(char C) { + if (C >= 'a' && C <= 'z') return C-'a'; + + +====================COPYRIGHT==================== + * Copyright © 1991-2015 Unicode, Inc. All rights reserved. + + +====================COPYRIGHT==================== + * This software was written by Alexander Peslyak in 2001. No copyright is + * claimed, and the software is hereby placed in the public domain. + * In case this attempt to disclaim copyright and place the software in the + * public domain is deemed null and void, then the software is + * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the + * general public under the following terms: + + +====================COPYRIGHT==================== +// <copyright file="Program.cpp" company="Microsoft Corporation"> +// Copyright (C) Microsoft Corporation. All rights reserved. + + +====================File: tools/polly/lib/External/isl/AUTHORS==================== +isl was written by + + Sven Verdoolaege +2006-2007 Leiden Institute of Advanced Computer Science + Universiteit Leiden + Niels Bohrweg 1 + 2333 CA Leiden + The Netherlands +2008-2009 K.U.Leuven + Departement Computerwetenschappen + Celestijnenlaan 200A + B-3001 Leuven + Belgium +2010-2011 INRIA Saclay - Ile-de-France + Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod + 91893 Orsay + France +2011-2012 consultant for Leiden Institute of Advanced Computer Science +2012-2014 Ecole Normale Superieure + 45 rue d'Ulm, 75230 Paris + France +2014-2015 INRIA Rocquencourt + Domaine de Voluceau - Rocquencourt, B.P. 105 + 78153 Le Chesnay + France +2015-2020 Polly Labs +2018-2020 Cerebras Systems + 175 S San Antonio Rd + Los Altos, CA + USA + +Contributions by + +Mythri Alle +Riyadh Baghdadi +Serge Belyshev +Albert Cohen +Ray Donnelly +Johannes Doerfert +Andi Drebes +Ron Estrin +Clement Foyer +Armin Groesslinger +Tobias Grosser +Frederik Harwath +Alexandre Isoard +Andreas Kloeckner +Michael Kruse +Manjunath Kudlur +Alexander Matz +Chielo Newctle +Sebastian Pop +Louis-Noel Pouchet +Benoit Pradelle +Uday Bondhugula +Andreas Simbuerger +Tianjiao Sun +Malhar Thakkar +Sergei Trofimovich +Miheer Vaidya +Sven van Haastregt +Oleksandr Zinenko + +The merge sort implementation was written by Jeffrey Stedfast. + + +====================MIT==================== +// <license> +// The MIT License (MIT) + + +====================MIT==================== +// Licensed under the MIT license. + + +====================MIT==================== +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + + +====================Public-Domain==================== + * [0] https://hyperelliptic.org/nacl/nacl-20110221.tar.bz2 (public domain + * code) + + +====================Public-Domain==================== + * Homepage: + * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 + * + * Author: + * Alexander Peslyak, better known as Solar Designer <solar at openwall.com> + * + * This software was written by Alexander Peslyak in 2001. No copyright is + * claimed, and the software is hereby placed in the public domain. + * In case this attempt to disclaim copyright and place the software in the + * public domain is deemed null and void, then the software is + * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the + * general public under the following terms: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted. + * + * There's ABSOLUTELY NO WARRANTY, express or implied. + + +====================Public-Domain==================== +// This code is taken from public domain + + +====================Public-Domain AND CC0-1.0==================== +|* Released into the public domain with CC0 1.0 *| + + +====================Unicode==================== + * Distributed under the Terms of Use in + * http://www.unicode.org/copyright.html. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of the Unicode data files and any associated documentation + * (the "Data Files") or Unicode software and any associated documentation + * (the "Software") to deal in the Data Files or Software + * without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, and/or sell copies of + * the Data Files or Software, and to permit persons to whom the Data Files + * or Software are furnished to do so, provided that + * (a) this copyright and permission notice appear with all copies + * of the Data Files or Software, + * (b) this copyright and permission notice appear in associated + * documentation, and + * (c) there is clear notice in each modified Data File or in the Software + * as well as in the documentation associated with the Data File(s) or + * Software that the data or software has been modified. + * + * THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF + * ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT OF THIRD PARTY RIGHTS. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS + * NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL + * DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THE DATA FILES OR SOFTWARE. + * + * Except as contained in this notice, the name of a copyright holder + * shall not be used in advertising or otherwise to promote the sale, + * use or other dealings in these Data Files or Software without prior + * written authorization of the copyright holder. diff --git a/contrib/libs/llvm16/include/llvm-c/module.modulemap b/contrib/libs/llvm16/include/llvm-c/module.modulemap new file mode 100644 index 0000000000..a456119595 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm-c/module.modulemap @@ -0,0 +1,4 @@ +module LLVM_C { + umbrella "." + module * { export * } +} diff --git a/contrib/libs/llvm16/include/llvm/ADT/IntervalTree.h b/contrib/libs/llvm16/include/llvm/ADT/IntervalTree.h new file mode 100644 index 0000000000..df39d72cfa --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/ADT/IntervalTree.h @@ -0,0 +1,704 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- IntervalTree.h ------------------------------------------*- C++ -*-===// +// +// 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 file implements an interval tree. +// +// Further information: +// https://en.wikipedia.org/wiki/Interval_tree +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_INTERVALTREE_H +#define LLVM_ADT_INTERVALTREE_H + +#include "llvm/ADT/SmallSet.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/Support/Allocator.h" +#include "llvm/Support/Format.h" +#include "llvm/Support/raw_ostream.h" +#include <algorithm> +#include <cassert> +#include <iterator> + +// IntervalTree is a light tree data structure to hold intervals. It allows +// finding all intervals that overlap with any given point. At this time, +// it does not support any deletion or rebalancing operations. +// +// The IntervalTree is designed to be set up once, and then queried without +// any further additions. +// +// Synopsis: +// Closed intervals delimited by PointT objects are mapped to ValueT objects. +// +// Restrictions: +// PointT must be a fundamental type. +// ValueT must be a fundamental or pointer type. +// +// template <typename PointT, typename ValueT, typename DataT> +// class IntervalTree { +// public: +// +// IntervalTree(); +// ~IntervalTree(): +// +// using IntervalReferences = SmallVector<IntervalData *>; +// +// void create(); +// void insert(PointT Left, PointT Right, ValueT Value); +// +// IntervalReferences getContaining(PointT Point); +// static void sortIntervals(IntervalReferences &Intervals, Sorting Sort); +// +// find_iterator begin(PointType Point) const; +// find_iterator end() const; +// +// bool empty() const; +// void clear(); +// +// void print(raw_ostream &OS, bool HexFormat = true); +// }; +// +//===----------------------------------------------------------------------===// +// +// In the below given dataset +// +// [a, b] <- (x) +// +// 'a' and 'b' describe a range and 'x' the value for that interval. +// +// The following data are purely for illustrative purposes: +// +// [30, 35] <- (3035), [39, 50] <- (3950), [55, 61] <- (5561), +// [31, 56] <- (3156), [12, 21] <- (1221), [25, 41] <- (2541), +// [49, 65] <- (4965), [71, 79] <- (7179), [11, 16] <- (1116), +// [20, 30] <- (2030), [36, 54] <- (3654), [60, 70] <- (6070), +// [74, 80] <- (7480), [15, 40] <- (1540), [43, 43] <- (4343), +// [50, 75] <- (5075), [10, 85] <- (1085) +// +// The data represents a set of overlapping intervals: +// +// 30--35 39------------50 55----61 +// 31------------------------56 +// 12--------21 25------------41 49-------------65 71-----79 +// 11----16 20-----30 36----------------54 60------70 74---- 80 +// 15---------------------40 43--43 50--------------------75 +// 10----------------------------------------------------------------------85 +// +// The items are stored in a binary tree with each node storing: +// +// MP: A middle point. +// IL: All intervals whose left value are completely to the left of the middle +// point. They are sorted in ascending order by their beginning point. +// IR: All intervals whose right value are completely to the right of the +// middle point. They are sorted in descending order by their ending point. +// LS: Left subtree. +// RS: Right subtree. +// +// As IL and IR will contain the same intervals, in order to optimize space, +// instead of storing intervals on each node, we use two vectors that will +// contain the intervals described by IL and IR. Each node will contain an +// index into that vector (global bucket), to indicate the beginning of the +// intervals assigned to the node. +// +// The following is the output from print(): +// +// 0: MP:43 IR [10,85] [31,56] [36,54] [39,50] [43,43] +// 0: MP:43 IL [10,85] [31,56] [36,54] [39,50] [43,43] +// 1: MP:25 IR [25,41] [15,40] [20,30] +// 1: MP:25 IL [15,40] [20,30] [25,41] +// 2: MP:15 IR [12,21] [11,16] +// 2: MP:15 IL [11,16] [12,21] +// 2: MP:36 IR [] +// 2: MP:36 IL [] +// 3: MP:31 IR [30,35] +// 3: MP:31 IL [30,35] +// 1: MP:61 IR [50,75] [60,70] [49,65] [55,61] +// 1: MP:61 IL [49,65] [50,75] [55,61] [60,70] +// 2: MP:74 IR [74,80] [71,79] +// 2: MP:74 IL [71,79] [74,80] +// +// with: +// 0: Root Node. +// MP: Middle point. +// IL: Intervals to the left (in ascending order by beginning point). +// IR: Intervals to the right (in descending order by ending point). +// +// Root +// | +// V +// +------------MP:43------------+ +// | IL IR | +// | [10,85] [10,85] | +// LS | [31,56] [31,56] | RS +// | [36,54] [36,54] | +// | [39,50] [39,50] | +// | [43,43] [43,43] | +// V V +// +------------MP:25------------+ MP:61------------+ +// | IL IR | IL IR | +// | [15,40] [25,41] | [49,65] [50,75] | +// LS | [20,30] [15,40] | RS [50,75] [60,70] | RS +// | [25,41] [20,30] | [55,61] [49,65] | +// | | [60,70] [55,61] | +// V V V +// MP:15 +-------MP:36 MP:74 +// IL IR | IL IR IL IR +// [11,16] [12,21] LS | [] [] [71,79] [74,80] +// [12,21] [11,16] | [74,80] [71,79] +// V +// MP:31 +// IL IR +// [30,35] [30,35] +// +// The creation of an interval tree is done in 2 steps: +// 1) Insert the interval items by calling +// void insert(PointT Left, PointT Right, ValueT Value); +// Left, Right: the interval left and right limits. +// Value: the data associated with that specific interval. +// +// 2) Create the interval tree by calling +// void create(); +// +// Once the tree is created, it is switched to query mode. +// Query the tree by using iterators or container. +// +// a) Iterators over intervals overlapping the given point with very weak +// ordering guarantees. +// find_iterator begin(PointType Point) const; +// find_iterator end() const; +// Point: a target point to be tested for inclusion in any interval. +// +// b) Container: +// IntervalReferences getContaining(PointT Point); +// Point: a target point to be tested for inclusion in any interval. +// Returns vector with all the intervals containing the target point. +// +// The returned intervals are in their natural tree location. They can +// be sorted: +// +// static void sortIntervals(IntervalReferences &Intervals, Sorting Sort); +// +// Ability to print the constructed interval tree: +// void print(raw_ostream &OS, bool HexFormat = true); +// Display the associated data in hexadecimal format. + +namespace llvm { + +//===----------------------------------------------------------------------===// +//--- IntervalData ----// +//===----------------------------------------------------------------------===// +/// An interval data composed by a \a Left and \a Right points and an +/// associated \a Value. +/// \a PointT corresponds to the interval endpoints type. +/// \a ValueT corresponds to the interval value type. +template <typename PointT, typename ValueT> class IntervalData { +protected: + using PointType = PointT; + using ValueType = ValueT; + +private: + PointType Left; + PointType Right; + ValueType Value; + +public: + IntervalData() = delete; + IntervalData(PointType Left, PointType Right, ValueType Value) + : Left(Left), Right(Right), Value(Value) { + assert(Left <= Right && "'Left' must be less or equal to 'Right'"); + } + virtual ~IntervalData() = default; + PointType left() const { return Left; } + PointType right() const { return Right; } + ValueType value() const { return Value; } + + /// Return true if \a Point is inside the left bound of closed interval \a + /// [Left;Right]. This is Left <= Point for closed intervals. + bool left(const PointType &Point) const { return left() <= Point; } + + /// Return true if \a Point is inside the right bound of closed interval \a + /// [Left;Right]. This is Point <= Right for closed intervals. + bool right(const PointType &Point) const { return Point <= right(); } + + /// Return true when \a Point is contained in interval \a [Left;Right]. + /// This is Left <= Point <= Right for closed intervals. + bool contains(const PointType &Point) const { + return left(Point) && right(Point); + } +}; + +//===----------------------------------------------------------------------===// +//--- IntervalTree ----// +//===----------------------------------------------------------------------===// +// Helper class template that is used by the IntervalTree to ensure that one +// does instantiate using only fundamental and/or pointer types. +template <typename T> +using PointTypeIsValid = std::bool_constant<std::is_fundamental<T>::value>; + +template <typename T> +using ValueTypeIsValid = std::bool_constant<std::is_fundamental<T>::value || + std::is_pointer<T>::value>; + +template <typename PointT, typename ValueT, + typename DataT = IntervalData<PointT, ValueT>> +class IntervalTree { + static_assert(PointTypeIsValid<PointT>::value, + "PointT must be a fundamental type"); + static_assert(ValueTypeIsValid<ValueT>::value, + "ValueT must be a fundamental or pointer type"); + +public: + using PointType = PointT; + using ValueType = ValueT; + using DataType = DataT; + using Allocator = BumpPtrAllocator; + + enum class Sorting { Ascending, Descending }; + using IntervalReferences = SmallVector<const DataType *, 4>; + +private: + using IntervalVector = SmallVector<DataType, 4>; + using PointsVector = SmallVector<PointType, 4>; + + class IntervalNode { + PointType MiddlePoint; // MP - Middle point. + IntervalNode *Left = nullptr; // LS - Left subtree. + IntervalNode *Right = nullptr; // RS - Right subtree. + unsigned BucketIntervalsStart = 0; // Starting index in global bucket. + unsigned BucketIntervalsSize = 0; // Size of bucket. + + public: + PointType middle() const { return MiddlePoint; } + unsigned start() const { return BucketIntervalsStart; } + unsigned size() const { return BucketIntervalsSize; } + + IntervalNode(PointType Point, unsigned Start) + : MiddlePoint(Point), BucketIntervalsStart(Start) {} + + friend IntervalTree; + }; + + Allocator &NodeAllocator; // Allocator used for creating interval nodes. + IntervalNode *Root = nullptr; // Interval tree root. + IntervalVector Intervals; // Storage for each interval and all of the fields + // point back into it. + PointsVector EndPoints; // Sorted left and right points of all the intervals. + + // These vectors provide storage that nodes carve buckets of overlapping + // intervals out of. All intervals are recorded on each vector. + // The bucket with the intervals associated to a node, is determined by + // the fields 'BucketIntervalStart' and 'BucketIntervalSize' in the node. + // The buckets in the first vector are sorted in ascending order using + // the left value and the buckets in the second vector are sorted in + // descending order using the right value. Every interval in a bucket + // contains the middle point for the node. + IntervalReferences IntervalsLeft; // Intervals to the left of middle point. + IntervalReferences IntervalsRight; // Intervals to the right of middle point. + + // Working vector used during the tree creation to sort the intervals. It is + // cleared once the tree is created. + IntervalReferences References; + + /// Recursively delete the constructed tree. + void deleteTree(IntervalNode *Node) { + if (Node) { + deleteTree(Node->Left); + deleteTree(Node->Right); + Node->~IntervalNode(); + NodeAllocator.Deallocate(Node); + } + } + + /// Print the interval list (left and right) for a given \a Node. + static void printList(raw_ostream &OS, IntervalReferences &IntervalSet, + unsigned Start, unsigned Size, bool HexFormat = true) { + assert(Start + Size <= IntervalSet.size() && + "Start + Size must be in bounds of the IntervalSet"); + const char *Format = HexFormat ? "[0x%08x,0x%08x] " : "[%2d,%2d] "; + if (Size) { + for (unsigned Position = Start; Position < Start + Size; ++Position) + OS << format(Format, IntervalSet[Position]->left(), + IntervalSet[Position]->right()); + } else { + OS << "[]"; + } + OS << "\n"; + } + + /// Print an interval tree \a Node. + void printNode(raw_ostream &OS, unsigned Level, IntervalNode *Node, + bool HexFormat = true) { + const char *Format = HexFormat ? "MP:0x%08x " : "MP:%2d "; + auto PrintNodeData = [&](StringRef Text, IntervalReferences &IntervalSet) { + OS << format("%5d: ", Level); + OS.indent(Level * 2); + OS << format(Format, Node->middle()) << Text << " "; + printList(OS, IntervalSet, Node->start(), Node->size(), HexFormat); + }; + + PrintNodeData("IR", IntervalsRight); + PrintNodeData("IL", IntervalsLeft); + } + + /// Recursively print all the interval nodes. + void printTree(raw_ostream &OS, unsigned Level, IntervalNode *Node, + bool HexFormat = true) { + if (Node) { + printNode(OS, Level, Node, HexFormat); + ++Level; + printTree(OS, Level, Node->Left, HexFormat); + printTree(OS, Level, Node->Right, HexFormat); + } + } + + /// Recursively construct the interval tree. + /// IntervalsSize: Number of intervals that have been processed and it will + /// be used as the start for the intervals bucket for a node. + /// PointsBeginIndex, PointsEndIndex: Determine the range into the EndPoints + /// vector of end points to be processed. + /// ReferencesBeginIndex, ReferencesSize: Determine the range into the + /// intervals being processed. + IntervalNode *createTree(unsigned &IntervalsSize, int PointsBeginIndex, + int PointsEndIndex, int ReferencesBeginIndex, + int ReferencesSize) { + // We start by taking the entire range of all the intervals and dividing + // it in half at x_middle (in practice, x_middle should be picked to keep + // the tree relatively balanced). + // This gives three sets of intervals, those completely to the left of + // x_middle which we'll call S_left, those completely to the right of + // x_middle which we'll call S_right, and those overlapping x_middle + // which we'll call S_middle. + // The intervals in S_left and S_right are recursively divided in the + // same manner until there are no intervals remaining. + + if (PointsBeginIndex > PointsEndIndex || + ReferencesBeginIndex >= ReferencesSize) + return nullptr; + + int MiddleIndex = (PointsBeginIndex + PointsEndIndex) / 2; + PointType MiddlePoint = EndPoints[MiddleIndex]; + + unsigned NewBucketStart = IntervalsSize; + unsigned NewBucketSize = 0; + int ReferencesRightIndex = ReferencesSize; + + IntervalNode *Root = + new (NodeAllocator) IntervalNode(MiddlePoint, NewBucketStart); + + // A quicksort implementation where all the intervals that overlap + // with the pivot are put into the "bucket", and "References" is the + // partition space where we recursively sort the remaining intervals. + for (int Index = ReferencesBeginIndex; Index < ReferencesRightIndex;) { + + // Current interval contains the middle point. + if (References[Index]->contains(MiddlePoint)) { + IntervalsLeft[IntervalsSize] = References[Index]; + IntervalsRight[IntervalsSize] = References[Index]; + ++IntervalsSize; + Root->BucketIntervalsSize = ++NewBucketSize; + + if (Index < --ReferencesRightIndex) + std::swap(References[Index], References[ReferencesRightIndex]); + if (ReferencesRightIndex < --ReferencesSize) + std::swap(References[ReferencesRightIndex], + References[ReferencesSize]); + continue; + } + + if (References[Index]->left() > MiddlePoint) { + if (Index < --ReferencesRightIndex) + std::swap(References[Index], References[ReferencesRightIndex]); + continue; + } + ++Index; + } + + // Sort intervals on the left and right of the middle point. + if (NewBucketSize > 1) { + // Sort the intervals in ascending order by their beginning point. + std::stable_sort(IntervalsLeft.begin() + NewBucketStart, + IntervalsLeft.begin() + NewBucketStart + NewBucketSize, + [](const DataType *LHS, const DataType *RHS) { + return LHS->left() < RHS->left(); + }); + // Sort the intervals in descending order by their ending point. + std::stable_sort(IntervalsRight.begin() + NewBucketStart, + IntervalsRight.begin() + NewBucketStart + NewBucketSize, + [](const DataType *LHS, const DataType *RHS) { + return LHS->right() > RHS->right(); + }); + } + + if (PointsBeginIndex <= MiddleIndex - 1) { + Root->Left = createTree(IntervalsSize, PointsBeginIndex, MiddleIndex - 1, + ReferencesBeginIndex, ReferencesRightIndex); + } + + if (MiddleIndex + 1 <= PointsEndIndex) { + Root->Right = createTree(IntervalsSize, MiddleIndex + 1, PointsEndIndex, + ReferencesRightIndex, ReferencesSize); + } + + return Root; + } + +public: + class find_iterator { + public: + using iterator_category = std::forward_iterator_tag; + using value_type = DataType; + using difference_type = DataType; + using pointer = DataType *; + using reference = DataType &; + + private: + const IntervalReferences *AscendingBuckets = nullptr; + const IntervalReferences *DescendingBuckets = nullptr; + + // Current node and index while traversing the intervals that contain + // the reference point. + IntervalNode *Node = nullptr; + PointType Point; + unsigned Index = 0; + + // For the current node, check if we have intervals that contain the + // reference point. We return when the node does have intervals that + // contain such point. Otherwise we keep descending on that branch. + void initNode() { + Index = 0; + while (Node) { + // Return if the reference point is the same as the middle point or + // the current node doesn't have any intervals at all. + if (Point == Node->middle()) { + if (Node->size() == 0) { + // No intervals that contain the reference point. + Node = nullptr; + } + return; + } + + if (Point < Node->middle()) { + // The reference point can be at the left or right of the middle + // point. Return if the current node has intervals that contain the + // reference point; otherwise descend on the respective branch. + if (Node->size() && (*AscendingBuckets)[Node->start()]->left(Point)) { + return; + } + Node = Node->Left; + } else { + if (Node->size() && + (*DescendingBuckets)[Node->start()]->right(Point)) { + return; + } + Node = Node->Right; + } + } + } + + // Given the current node (which was initialized by initNode), move to + // the next interval in the list of intervals that contain the reference + // point. Otherwise move to the next node, as the intervals contained + // in that node, can contain the reference point. + void nextInterval() { + // If there are available intervals that contain the reference point, + // traverse them; otherwise move to the left or right node, depending + // on the middle point value. + if (++Index < Node->size()) { + if (Node->middle() == Point) + return; + if (Point < Node->middle()) { + // Reference point is on the left. + if (!(*AscendingBuckets)[Node->start() + Index]->left(Point)) { + // The intervals don't contain the reference point. Move to the + // next node, preserving the descending order. + Node = Node->Left; + initNode(); + } + } else { + // Reference point is on the right. + if (!(*DescendingBuckets)[Node->start() + Index]->right(Point)) { + // The intervals don't contain the reference point. Move to the + // next node, preserving the ascending order. + Node = Node->Right; + initNode(); + } + } + } else { + // We have traversed all the intervals in the current node. + if (Point == Node->middle()) { + Node = nullptr; + Index = 0; + return; + } + // Select a branch based on the middle point. + Node = Point < Node->middle() ? Node->Left : Node->Right; + initNode(); + } + } + + find_iterator() = default; + explicit find_iterator(const IntervalReferences *Left, + const IntervalReferences *Right, IntervalNode *Node, + PointType Point) + : AscendingBuckets(Left), DescendingBuckets(Right), Node(Node), + Point(Point), Index(0) { + initNode(); + } + + const DataType *current() const { + return (Point <= Node->middle()) + ? (*AscendingBuckets)[Node->start() + Index] + : (*DescendingBuckets)[Node->start() + Index]; + } + + public: + find_iterator &operator++() { + nextInterval(); + return *this; + } + + find_iterator operator++(int) { + find_iterator Iter(*this); + nextInterval(); + return Iter; + } + + /// Dereference operators. + const DataType *operator->() const { return current(); } + const DataType &operator*() const { return *(current()); } + + /// Comparison operators. + friend bool operator==(const find_iterator &LHS, const find_iterator &RHS) { + return (!LHS.Node && !RHS.Node && !LHS.Index && !RHS.Index) || + (LHS.Point == RHS.Point && LHS.Node == RHS.Node && + LHS.Index == RHS.Index); + } + friend bool operator!=(const find_iterator &LHS, const find_iterator &RHS) { + return !(LHS == RHS); + } + + friend IntervalTree; + }; + +private: + find_iterator End; + +public: + explicit IntervalTree(Allocator &NodeAllocator) + : NodeAllocator(NodeAllocator) {} + ~IntervalTree() { clear(); } + + /// Return true when no intervals are mapped. + bool empty() const { return Root == nullptr; } + + /// Remove all entries. + void clear() { + deleteTree(Root); + Root = nullptr; + Intervals.clear(); + IntervalsLeft.clear(); + IntervalsRight.clear(); + EndPoints.clear(); + } + + /// Add a mapping of [Left;Right] to \a Value. + void insert(PointType Left, PointType Right, ValueType Value) { + assert(empty() && "Invalid insertion. Interval tree already constructed."); + Intervals.emplace_back(Left, Right, Value); + } + + /// Return all the intervals in their natural tree location, that + /// contain the given point. + IntervalReferences getContaining(PointType Point) const { + assert(!empty() && "Interval tree it is not constructed."); + IntervalReferences IntervalSet; + for (find_iterator Iter = find(Point), E = find_end(); Iter != E; ++Iter) + IntervalSet.push_back(const_cast<DataType *>(&(*Iter))); + return IntervalSet; + } + + /// Sort the given intervals using the following sort options: + /// Ascending: return the intervals with the smallest at the front. + /// Descending: return the intervals with the biggest at the front. + static void sortIntervals(IntervalReferences &IntervalSet, Sorting Sort) { + std::stable_sort(IntervalSet.begin(), IntervalSet.end(), + [Sort](const DataType *RHS, const DataType *LHS) { + return Sort == Sorting::Ascending + ? (LHS->right() - LHS->left()) > + (RHS->right() - RHS->left()) + : (LHS->right() - LHS->left()) < + (RHS->right() - RHS->left()); + }); + } + + /// Print the interval tree. + /// When \a HexFormat is true, the interval tree interval ranges and + /// associated values are printed in hexadecimal format. + void print(raw_ostream &OS, bool HexFormat = true) { + printTree(OS, 0, Root, HexFormat); + } + + /// Create the interval tree. + void create() { + assert(empty() && "Interval tree already constructed."); + // Sorted vector of unique end points values of all the intervals. + // Records references to the collected intervals. + SmallVector<PointType, 4> Points; + for (const DataType &Data : Intervals) { + Points.push_back(Data.left()); + Points.push_back(Data.right()); + References.push_back(std::addressof(Data)); + } + std::stable_sort(Points.begin(), Points.end()); + auto Last = std::unique(Points.begin(), Points.end()); + Points.erase(Last, Points.end()); + + EndPoints.assign(Points.begin(), Points.end()); + + IntervalsLeft.resize(Intervals.size()); + IntervalsRight.resize(Intervals.size()); + + // Given a set of n intervals, construct a data structure so that + // we can efficiently retrieve all intervals overlapping another + // interval or point. + unsigned IntervalsSize = 0; + Root = + createTree(IntervalsSize, /*PointsBeginIndex=*/0, EndPoints.size() - 1, + /*ReferencesBeginIndex=*/0, References.size()); + + // Save to clear this storage, as it used only to sort the intervals. + References.clear(); + } + + /// Iterator to start a find operation; it returns find_end() if the + /// tree has not been built. + /// There is no support to iterate over all the elements of the tree. + find_iterator find(PointType Point) const { + return empty() + ? find_end() + : find_iterator(&IntervalsLeft, &IntervalsRight, Root, Point); + } + + /// Iterator to end find operation. + find_iterator find_end() const { return End; } +}; + +} // namespace llvm + +#endif // LLVM_ADT_INTERVALTREE_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/ADT/Optional.h b/contrib/libs/llvm16/include/llvm/ADT/Optional.h new file mode 100644 index 0000000000..6854427bf7 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/ADT/Optional.h @@ -0,0 +1,38 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- Optional.h - Simple variant for passing optional values --*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// This file provides Optional, a template class modeled in the spirit of +/// OCaml's 'opt' variant. The idea is to strongly type whether or not +/// a value can be optional. +/// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_OPTIONAL_H +#define LLVM_ADT_OPTIONAL_H + +#include <optional> + +namespace llvm { +// Legacy alias of llvm::Optional to std::optional. +// FIXME: Remove this after LLVM 16. +template <class T> using Optional = std::optional<T>; +} // namespace llvm + +#endif // LLVM_ADT_OPTIONAL_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/ADT/TypeSwitch.h b/contrib/libs/llvm16/include/llvm/ADT/TypeSwitch.h new file mode 100644 index 0000000000..cba4c37d72 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/ADT/TypeSwitch.h @@ -0,0 +1,198 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- TypeSwitch.h - Switch functionality for RTTI casting -*- C++ -*-----===// +// +// 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 +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// This file implements the TypeSwitch template, which mimics a switch() +/// statement whose cases are type names. +/// +//===-----------------------------------------------------------------------===/ + +#ifndef LLVM_ADT_TYPESWITCH_H +#define LLVM_ADT_TYPESWITCH_H + +#include "llvm/ADT/STLExtras.h" +#include "llvm/Support/Casting.h" +#include <optional> + +namespace llvm { +namespace detail { + +template <typename DerivedT, typename T> class TypeSwitchBase { +public: + TypeSwitchBase(const T &value) : value(value) {} + TypeSwitchBase(TypeSwitchBase &&other) : value(other.value) {} + ~TypeSwitchBase() = default; + + /// TypeSwitchBase is not copyable. + TypeSwitchBase(const TypeSwitchBase &) = delete; + void operator=(const TypeSwitchBase &) = delete; + void operator=(TypeSwitchBase &&other) = delete; + + /// Invoke a case on the derived class with multiple case types. + template <typename CaseT, typename CaseT2, typename... CaseTs, + typename CallableT> + // This is marked always_inline and nodebug so it doesn't show up in stack + // traces at -O0 (or other optimization levels). Large TypeSwitch's are + // common, are equivalent to a switch, and don't add any value to stack + // traces. + LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG DerivedT & + Case(CallableT &&caseFn) { + DerivedT &derived = static_cast<DerivedT &>(*this); + return derived.template Case<CaseT>(caseFn) + .template Case<CaseT2, CaseTs...>(caseFn); + } + + /// Invoke a case on the derived class, inferring the type of the Case from + /// the first input of the given callable. + /// Note: This inference rules for this overload are very simple: strip + /// pointers and references. + template <typename CallableT> DerivedT &Case(CallableT &&caseFn) { + using Traits = function_traits<std::decay_t<CallableT>>; + using CaseT = std::remove_cv_t<std::remove_pointer_t< + std::remove_reference_t<typename Traits::template arg_t<0>>>>; + + DerivedT &derived = static_cast<DerivedT &>(*this); + return derived.template Case<CaseT>(std::forward<CallableT>(caseFn)); + } + +protected: + /// Trait to check whether `ValueT` provides a 'dyn_cast' method with type + /// `CastT`. + template <typename ValueT, typename CastT> + using has_dyn_cast_t = + decltype(std::declval<ValueT &>().template dyn_cast<CastT>()); + + /// Attempt to dyn_cast the given `value` to `CastT`. This overload is + /// selected if `value` already has a suitable dyn_cast method. + template <typename CastT, typename ValueT> + static decltype(auto) castValue( + ValueT &&value, + std::enable_if_t<is_detected<has_dyn_cast_t, ValueT, CastT>::value> * = + nullptr) { + return value.template dyn_cast<CastT>(); + } + + /// Attempt to dyn_cast the given `value` to `CastT`. This overload is + /// selected if llvm::dyn_cast should be used. + template <typename CastT, typename ValueT> + static decltype(auto) castValue( + ValueT &&value, + std::enable_if_t<!is_detected<has_dyn_cast_t, ValueT, CastT>::value> * = + nullptr) { + return dyn_cast<CastT>(value); + } + + /// The root value we are switching on. + const T value; +}; +} // end namespace detail + +/// This class implements a switch-like dispatch statement for a value of 'T' +/// using dyn_cast functionality. Each `Case<T>` takes a callable to be invoked +/// if the root value isa<T>, the callable is invoked with the result of +/// dyn_cast<T>() as a parameter. +/// +/// Example: +/// Operation *op = ...; +/// LogicalResult result = TypeSwitch<Operation *, LogicalResult>(op) +/// .Case<ConstantOp>([](ConstantOp op) { ... }) +/// .Default([](Operation *op) { ... }); +/// +template <typename T, typename ResultT = void> +class TypeSwitch : public detail::TypeSwitchBase<TypeSwitch<T, ResultT>, T> { +public: + using BaseT = detail::TypeSwitchBase<TypeSwitch<T, ResultT>, T>; + using BaseT::BaseT; + using BaseT::Case; + TypeSwitch(TypeSwitch &&other) = default; + + /// Add a case on the given type. + template <typename CaseT, typename CallableT> + TypeSwitch<T, ResultT> &Case(CallableT &&caseFn) { + if (result) + return *this; + + // Check to see if CaseT applies to 'value'. + if (auto caseValue = BaseT::template castValue<CaseT>(this->value)) + result.emplace(caseFn(caseValue)); + return *this; + } + + /// As a default, invoke the given callable within the root value. + template <typename CallableT> + [[nodiscard]] ResultT Default(CallableT &&defaultFn) { + if (result) + return std::move(*result); + return defaultFn(this->value); + } + /// As a default, return the given value. + [[nodiscard]] ResultT Default(ResultT defaultResult) { + if (result) + return std::move(*result); + return defaultResult; + } + + [[nodiscard]] operator ResultT() { + assert(result && "Fell off the end of a type-switch"); + return std::move(*result); + } + +private: + /// The pointer to the result of this switch statement, once known, + /// null before that. + std::optional<ResultT> result; +}; + +/// Specialization of TypeSwitch for void returning callables. +template <typename T> +class TypeSwitch<T, void> + : public detail::TypeSwitchBase<TypeSwitch<T, void>, T> { +public: + using BaseT = detail::TypeSwitchBase<TypeSwitch<T, void>, T>; + using BaseT::BaseT; + using BaseT::Case; + TypeSwitch(TypeSwitch &&other) = default; + + /// Add a case on the given type. + template <typename CaseT, typename CallableT> + TypeSwitch<T, void> &Case(CallableT &&caseFn) { + if (foundMatch) + return *this; + + // Check to see if any of the types apply to 'value'. + if (auto caseValue = BaseT::template castValue<CaseT>(this->value)) { + caseFn(caseValue); + foundMatch = true; + } + return *this; + } + + /// As a default, invoke the given callable within the root value. + template <typename CallableT> void Default(CallableT &&defaultFn) { + if (!foundMatch) + defaultFn(this->value); + } + +private: + /// A flag detailing if we have already found a match. + bool foundMatch = false; +}; +} // end namespace llvm + +#endif // LLVM_ADT_TYPESWITCH_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/Bitcode/BitcodeConvenience.h b/contrib/libs/llvm16/include/llvm/Bitcode/BitcodeConvenience.h new file mode 100644 index 0000000000..be880b8870 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Bitcode/BitcodeConvenience.h @@ -0,0 +1,498 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- llvm/Bitcode/BitcodeConvenience.h - Convenience Wrappers -*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +/// +/// \file Convenience wrappers for the LLVM bitcode format and bitstream APIs. +/// +/// This allows you to use a sort of DSL to declare and use bitcode +/// abbreviations and records. Example: +/// +/// \code +/// using Metadata = BCRecordLayout< +/// METADATA_ID, // ID +/// BCFixed<16>, // Module format major version +/// BCFixed<16>, // Module format minor version +/// BCBlob // misc. version information +/// >; +/// Metadata metadata(Out); +/// metadata.emit(ScratchRecord, VERSION_MAJOR, VERSION_MINOR, Data); +/// \endcode +/// +/// For details on the bitcode format, see +/// http://llvm.org/docs/BitCodeFormat.html +/// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_BITCODE_BITCODECONVENIENCE_H +#define LLVM_BITCODE_BITCODECONVENIENCE_H + +#include "llvm/Bitstream/BitCodes.h" +#include "llvm/Bitstream/BitstreamWriter.h" +#include <cstdint> +#include <optional> + +namespace llvm { +namespace detail { +/// Convenience base for all kinds of bitcode abbreviation fields. +/// +/// This just defines common properties queried by the metaprogramming. +template <bool Compound = false> class BCField { +public: + static const bool IsCompound = Compound; + + /// Asserts that the given data is a valid value for this field. + template <typename T> static void assertValid(const T &data) {} + + /// Converts a raw numeric representation of this value to its preferred + /// type. + template <typename T> static T convert(T rawValue) { return rawValue; } +}; +} // namespace detail + +/// Represents a literal operand in a bitcode record. +/// +/// The value of a literal operand is the same for all instances of the record, +/// so it is only emitted in the abbreviation definition. +/// +/// Note that because this uses a compile-time template, you cannot have a +/// literal operand that is fixed at run-time without dropping down to the +/// raw LLVM APIs. +template <uint64_t Value> class BCLiteral : public detail::BCField<> { +public: + static void emitOp(llvm::BitCodeAbbrev &abbrev) { + abbrev.Add(llvm::BitCodeAbbrevOp(Value)); + } + + template <typename T> static void assertValid(const T &data) { + assert(data == Value && "data value does not match declared literal value"); + } +}; + +/// Represents a fixed-width value in a bitcode record. +/// +/// Note that the LLVM bitcode format only supports unsigned values. +template <unsigned Width> class BCFixed : public detail::BCField<> { +public: + static_assert(Width <= 64, "fixed-width field is too large"); + + static void emitOp(llvm::BitCodeAbbrev &abbrev) { + abbrev.Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed, Width)); + } + + static void assertValid(const bool &data) { + assert(llvm::isUInt<Width>(data) && + "data value does not fit in the given bit width"); + } + + template <typename T> static void assertValid(const T &data) { + assert(data >= 0 && "cannot encode signed integers"); + assert(llvm::isUInt<Width>(data) && + "data value does not fit in the given bit width"); + } +}; + +/// Represents a variable-width value in a bitcode record. +/// +/// The \p Width parameter should include the continuation bit. +/// +/// Note that the LLVM bitcode format only supports unsigned values. +template <unsigned Width> class BCVBR : public detail::BCField<> { + static_assert(Width >= 2, "width does not have room for continuation bit"); + +public: + static void emitOp(llvm::BitCodeAbbrev &abbrev) { + abbrev.Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, Width)); + } + + template <typename T> static void assertValid(const T &data) { + assert(data >= 0 && "cannot encode signed integers"); + } +}; + +/// Represents a character encoded in LLVM's Char6 encoding. +/// +/// This format is suitable for encoding decimal numbers (without signs or +/// exponents) and C identifiers (without dollar signs), but not much else. +/// +/// \sa http://llvm.org/docs/BitCodeFormat.html#char6-encoded-value +class BCChar6 : public detail::BCField<> { +public: + static void emitOp(llvm::BitCodeAbbrev &abbrev) { + abbrev.Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Char6)); + } + + template <typename T> static void assertValid(const T &data) { + assert(llvm::BitCodeAbbrevOp::isChar6(data) && "invalid Char6 data"); + } + + template <typename T> char convert(T rawValue) { + return static_cast<char>(rawValue); + } +}; + +/// Represents an untyped blob of bytes. +/// +/// If present, this must be the last field in a record. +class BCBlob : public detail::BCField<true> { +public: + static void emitOp(llvm::BitCodeAbbrev &abbrev) { + abbrev.Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob)); + } +}; + +/// Represents an array of some other type. +/// +/// If present, this must be the last field in a record. +template <typename ElementTy> class BCArray : public detail::BCField<true> { + static_assert(!ElementTy::IsCompound, "arrays can only contain scalar types"); + +public: + static void emitOp(llvm::BitCodeAbbrev &abbrev) { + abbrev.Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Array)); + ElementTy::emitOp(abbrev); + } +}; + +namespace detail { +/// Attaches the last field to an abbreviation. +/// +/// This is the base case for \c emitOps. +/// +/// \sa BCRecordLayout::emitAbbrev +template <typename FieldTy> static void emitOps(llvm::BitCodeAbbrev &abbrev) { + FieldTy::emitOp(abbrev); +} + +/// Attaches fields to an abbreviation. +/// +/// This is the recursive case for \c emitOps. +/// +/// \sa BCRecordLayout::emitAbbrev +template <typename FieldTy, typename Next, typename... Rest> +static void emitOps(llvm::BitCodeAbbrev &abbrev) { + static_assert(!FieldTy::IsCompound, + "arrays and blobs may not appear in the middle of a record"); + FieldTy::emitOp(abbrev); + emitOps<Next, Rest...>(abbrev); +} + +/// Helper class for dealing with a scalar element in the middle of a record. +/// +/// \sa BCRecordLayout +template <typename ElementTy, typename... Fields> class BCRecordCoding { +public: + template <typename BufferTy, typename ElementDataTy, typename... DataTy> + static void emit(llvm::BitstreamWriter &Stream, BufferTy &buffer, + unsigned code, ElementDataTy element, DataTy &&...data) { + static_assert(!ElementTy::IsCompound, + "arrays and blobs may not appear in the middle of a record"); + ElementTy::assertValid(element); + buffer.push_back(element); + BCRecordCoding<Fields...>::emit(Stream, buffer, code, + std::forward<DataTy>(data)...); + } + + template <typename T, typename ElementDataTy, typename... DataTy> + static void read(ArrayRef<T> buffer, ElementDataTy &element, + DataTy &&...data) { + assert(!buffer.empty() && "too few elements in buffer"); + element = ElementTy::convert(buffer.front()); + BCRecordCoding<Fields...>::read(buffer.slice(1), + std::forward<DataTy>(data)...); + } + + template <typename T, typename... DataTy> + static void read(ArrayRef<T> buffer, std::nullopt_t, DataTy &&...data) { + assert(!buffer.empty() && "too few elements in buffer"); + BCRecordCoding<Fields...>::read(buffer.slice(1), + std::forward<DataTy>(data)...); + } +}; + +/// Helper class for dealing with a scalar element at the end of a record. +/// +/// This has a separate implementation because up until now we've only been +/// \em building the record (into a data buffer), and now we need to hand it +/// off to the BitstreamWriter to be emitted. +/// +/// \sa BCRecordLayout +template <typename ElementTy> class BCRecordCoding<ElementTy> { +public: + template <typename BufferTy, typename DataTy> + static void emit(llvm::BitstreamWriter &Stream, BufferTy &buffer, + unsigned code, const DataTy &data) { + static_assert(!ElementTy::IsCompound, + "arrays and blobs need special handling"); + ElementTy::assertValid(data); + buffer.push_back(data); + Stream.EmitRecordWithAbbrev(code, buffer); + } + + template <typename T, typename DataTy> + static void read(ArrayRef<T> buffer, DataTy &data) { + assert(buffer.size() == 1 && "record data does not match layout"); + data = ElementTy::convert(buffer.front()); + } + + template <typename T> static void read(ArrayRef<T> buffer, std::nullopt_t) { + assert(buffer.size() == 1 && "record data does not match layout"); + (void)buffer; + } + + template <typename T> static void read(ArrayRef<T> buffer) = delete; +}; + +/// Helper class for dealing with an array at the end of a record. +/// +/// \sa BCRecordLayout::emitRecord +template <typename ElementTy> class BCRecordCoding<BCArray<ElementTy>> { +public: + template <typename BufferTy> + static void emit(llvm::BitstreamWriter &Stream, BufferTy &buffer, + unsigned code, StringRef data) { + // TODO: validate array data. + Stream.EmitRecordWithArray(code, buffer, data); + } + + template <typename BufferTy, typename ArrayTy> + static void emit(llvm::BitstreamWriter &Stream, BufferTy &buffer, + unsigned code, const ArrayTy &array) { +#ifndef NDEBUG + for (auto &element : array) + ElementTy::assertValid(element); +#endif + buffer.reserve(buffer.size() + std::distance(array.begin(), array.end())); + std::copy(array.begin(), array.end(), std::back_inserter(buffer)); + Stream.EmitRecordWithAbbrev(code, buffer); + } + + template <typename BufferTy, typename ElementDataTy, typename... DataTy> + static void emit(llvm::BitstreamWriter &Stream, BufferTy &buffer, + unsigned code, ElementDataTy element, DataTy... data) { + std::array<ElementDataTy, 1 + sizeof...(data)> array{{element, data...}}; + emit(Stream, buffer, code, array); + } + + template <typename BufferTy> + static void emit(llvm::BitstreamWriter &Stream, BufferTy &Buffer, + unsigned code, std::nullopt_t) { + Stream.EmitRecordWithAbbrev(code, Buffer); + } + + template <typename T> + static void read(ArrayRef<T> Buffer, ArrayRef<T> &rawData) { + rawData = Buffer; + } + + template <typename T, typename ArrayTy> + static void read(ArrayRef<T> buffer, ArrayTy &array) { + array.append(llvm::map_iterator(buffer.begin(), T::convert), + llvm::map_iterator(buffer.end(), T::convert)); + } + + template <typename T> static void read(ArrayRef<T> buffer, std::nullopt_t) { + (void)buffer; + } + + template <typename T> static void read(ArrayRef<T> buffer) = delete; +}; + +/// Helper class for dealing with a blob at the end of a record. +/// +/// \sa BCRecordLayout +template <> class BCRecordCoding<BCBlob> { +public: + template <typename BufferTy> + static void emit(llvm::BitstreamWriter &Stream, BufferTy &buffer, + unsigned code, StringRef data) { + Stream.EmitRecordWithBlob(code, buffer, data); + } + + template <typename T> static void read(ArrayRef<T> buffer) { (void)buffer; } + + /// Blob data is not stored in the buffer if you are using the correct + /// accessor; this method should not be used. + template <typename T, typename DataTy> + static void read(ArrayRef<T> buffer, DataTy &data) = delete; +}; + +/// A type trait whose \c type field is the last of its template parameters. +template <typename Head, typename... Tail> struct last_type { + using type = typename last_type<Tail...>::type; +}; + +template <typename Head> struct last_type<Head> { using type = Head; }; + +/// A type trait whose \c value field is \c true if the last type is BCBlob. +template <typename... Types> +using has_blob = std::is_same<BCBlob, typename last_type<int, Types...>::type>; + +/// A type trait whose \c value field is \c true if the given type is a +/// BCArray (of any element kind). +template <typename T> struct is_array { +private: + template <typename E> static bool check(BCArray<E> *); + static int check(...); + +public: + typedef bool value_type; + static constexpr bool value = !std::is_same<decltype(check((T *)nullptr)), + decltype(check(false))>::value; +}; + +/// A type trait whose \c value field is \c true if the last type is a +/// BCArray (of any element kind). +template <typename... Types> +using has_array = is_array<typename last_type<int, Types...>::type>; +} // namespace detail + +/// Represents a single bitcode record type. +/// +/// This class template is meant to be instantiated and then given a name, +/// so that from then on that name can be used. +template <typename IDField, typename... Fields> class BCGenericRecordLayout { + llvm::BitstreamWriter &Stream; + +public: + /// The abbreviation code used for this record in the current block. + /// + /// Note that this is not the same as the semantic record code, which is the + /// first field of the record. + const unsigned AbbrevCode; + + /// Create a layout and register it with the given bitstream writer. + explicit BCGenericRecordLayout(llvm::BitstreamWriter &Stream) + : Stream(Stream), AbbrevCode(emitAbbrev(Stream)) {} + + /// Emit a record to the bitstream writer, using the given buffer for scratch + /// space. + /// + /// Note that even fixed arguments must be specified here. + template <typename BufferTy, typename... Data> + void emit(BufferTy &buffer, unsigned id, Data &&...data) const { + emitRecord(Stream, buffer, AbbrevCode, id, std::forward<Data>(data)...); + } + + /// Registers this record's layout with the bitstream reader. + /// + /// eturns The abbreviation code for the newly-registered record type. + static unsigned emitAbbrev(llvm::BitstreamWriter &Stream) { + auto Abbrev = std::make_shared<llvm::BitCodeAbbrev>(); + detail::emitOps<IDField, Fields...>(*Abbrev); + return Stream.EmitAbbrev(std::move(Abbrev)); + } + + /// Emit a record identified by \p abbrCode to bitstream reader \p Stream, + /// using \p buffer for scratch space. + /// + /// Note that even fixed arguments must be specified here. Blobs are passed + /// as StringRefs, while arrays can be passed inline, as aggregates, or as + /// pre-encoded StringRef data. Skipped values and empty arrays should use + /// the special Nothing value. + template <typename BufferTy, typename... Data> + static void emitRecord(llvm::BitstreamWriter &Stream, BufferTy &buffer, + unsigned abbrCode, unsigned recordID, Data &&...data) { + static_assert(sizeof...(data) <= sizeof...(Fields) || + detail::has_array<Fields...>::value, + "Too many record elements"); + static_assert(sizeof...(data) >= sizeof...(Fields), + "Too few record elements"); + buffer.clear(); + detail::BCRecordCoding<IDField, Fields...>::emit( + Stream, buffer, abbrCode, recordID, std::forward<Data>(data)...); + } + + /// Extract record data from \p buffer into the given data fields. + /// + /// Note that even fixed arguments must be specified here. Pass \c Nothing + /// if you don't care about a particular parameter. Blob data is not included + /// in the buffer and should be handled separately by the caller. + template <typename ElementTy, typename... Data> + static void readRecord(ArrayRef<ElementTy> buffer, Data &&...data) { + static_assert(sizeof...(data) <= sizeof...(Fields), + "Too many record elements"); + static_assert(sizeof...(Fields) <= + sizeof...(data) + detail::has_blob<Fields...>::value, + "Too few record elements"); + return detail::BCRecordCoding<Fields...>::read(buffer, + std::forward<Data>(data)...); + } + + /// Extract record data from \p buffer into the given data fields. + /// + /// Note that even fixed arguments must be specified here. Pass \c Nothing + /// if you don't care about a particular parameter. Blob data is not included + /// in the buffer and should be handled separately by the caller. + template <typename BufferTy, typename... Data> + static void readRecord(BufferTy &buffer, Data &&...data) { + return readRecord(llvm::ArrayRef(buffer), std::forward<Data>(data)...); + } +}; + +/// A record with a fixed record code. +template <unsigned RecordCode, typename... Fields> +class BCRecordLayout + : public BCGenericRecordLayout<BCLiteral<RecordCode>, Fields...> { + using Base = BCGenericRecordLayout<BCLiteral<RecordCode>, Fields...>; + +public: + enum : unsigned { + /// The record code associated with this layout. + Code = RecordCode + }; + + /// Create a layout and register it with the given bitstream writer. + explicit BCRecordLayout(llvm::BitstreamWriter &Stream) : Base(Stream) {} + + /// Emit a record to the bitstream writer, using the given buffer for scratch + /// space. + /// + /// Note that even fixed arguments must be specified here. + template <typename BufferTy, typename... Data> + void emit(BufferTy &buffer, Data &&...data) const { + Base::emit(buffer, RecordCode, std::forward<Data>(data)...); + } + + /// Emit a record identified by \p abbrCode to bitstream reader \p Stream, + /// using \p buffer for scratch space. + /// + /// Note that even fixed arguments must be specified here. Currently, arrays + /// and blobs can only be passed as StringRefs. + template <typename BufferTy, typename... Data> + static void emitRecord(llvm::BitstreamWriter &Stream, BufferTy &buffer, + unsigned abbrCode, Data &&...data) { + Base::emitRecord(Stream, buffer, abbrCode, RecordCode, + std::forward<Data>(data)...); + } +}; + +/// RAII object to pair entering and exiting a sub-block. +class BCBlockRAII { + llvm::BitstreamWriter &Stream; + +public: + BCBlockRAII(llvm::BitstreamWriter &Stream, unsigned block, unsigned abbrev) + : Stream(Stream) { + Stream.EnterSubblock(block, abbrev); + } + + ~BCBlockRAII() { Stream.ExitBlock(); } +}; +} // namespace llvm + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/CodeGen/MachORelocation.h b/contrib/libs/llvm16/include/llvm/CodeGen/MachORelocation.h new file mode 100644 index 0000000000..20b31a21f4 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/CodeGen/MachORelocation.h @@ -0,0 +1,66 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//=== MachORelocation.h - Mach-O Relocation Info ----------------*- C++ -*-===// +// +// 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 file defines the MachORelocation class. +// +//===----------------------------------------------------------------------===// + + +#ifndef LLVM_CODEGEN_MACHORELOCATION_H +#define LLVM_CODEGEN_MACHORELOCATION_H + +#include "llvm/Support/DataTypes.h" + +namespace llvm { + + /// MachORelocation - This struct contains information about each relocation + /// that needs to be emitted to the file. + /// see <mach-o/reloc.h> + class MachORelocation { + uint32_t r_address; // offset in the section to what is being relocated + uint32_t r_symbolnum; // symbol index if r_extern == 1 else section index + bool r_pcrel; // was relocated pc-relative already + uint8_t r_length; // length = 2 ^ r_length + bool r_extern; // + uint8_t r_type; // if not 0, machine-specific relocation type. + bool r_scattered; // 1 = scattered, 0 = non-scattered + int32_t r_value; // the value the item to be relocated is referring + // to. + public: + uint32_t getPackedFields() const { + if (r_scattered) + return (1 << 31) | (r_pcrel << 30) | ((r_length & 3) << 28) | + ((r_type & 15) << 24) | (r_address & 0x00FFFFFF); + else + return (r_symbolnum << 8) | (r_pcrel << 7) | ((r_length & 3) << 5) | + (r_extern << 4) | (r_type & 15); + } + uint32_t getAddress() const { return r_scattered ? r_value : r_address; } + uint32_t getRawAddress() const { return r_address; } + + MachORelocation(uint32_t addr, uint32_t index, bool pcrel, uint8_t len, + bool ext, uint8_t type, bool scattered = false, + int32_t value = 0) : + r_address(addr), r_symbolnum(index), r_pcrel(pcrel), r_length(len), + r_extern(ext), r_type(type), r_scattered(scattered), r_value(value) {} + }; + +} // end llvm namespace + +#endif // LLVM_CODEGEN_MACHORELOCATION_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/Config/AsmParsers.def.in b/contrib/libs/llvm16/include/llvm/Config/AsmParsers.def.in new file mode 100644 index 0000000000..2e5fa33ace --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Config/AsmParsers.def.in @@ -0,0 +1,29 @@ +/*===- llvm/Config/AsmParsers.def - LLVM Assembly Parsers -------*- C++ -*-===*\ +|* *| +|* 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 file enumerates all of the assembly-language parsers *| +|* supported by this build of LLVM. Clients of this file should define *| +|* the LLVM_ASM_PARSER macro to be a function-like macro with a *| +|* single parameter (the name of the target whose assembly can be *| +|* generated); including this file will then enumerate all of the *| +|* targets with assembly parsers. *| +|* *| +|* The set of targets supported by LLVM is generated at configuration *| +|* time, at which point this header is generated. Do not modify this *| +|* header directly. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_ASM_PARSER +# error Please define the macro LLVM_ASM_PARSER(TargetName) +#endif + +@LLVM_ENUM_ASM_PARSERS@ + +#undef LLVM_ASM_PARSER diff --git a/contrib/libs/llvm16/include/llvm/Config/AsmPrinters.def.in b/contrib/libs/llvm16/include/llvm/Config/AsmPrinters.def.in new file mode 100644 index 0000000000..56419d9c14 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Config/AsmPrinters.def.in @@ -0,0 +1,29 @@ +/*===- llvm/Config/AsmPrinters.def - LLVM Assembly Printers -----*- C++ -*-===*\ +|* *| +|* 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 file enumerates all of the assembly-language printers *| +|* supported by this build of LLVM. Clients of this file should define *| +|* the LLVM_ASM_PRINTER macro to be a function-like macro with a *| +|* single parameter (the name of the target whose assembly can be *| +|* generated); including this file will then enumerate all of the *| +|* targets with assembly printers. *| +|* *| +|* The set of targets supported by LLVM is generated at configuration *| +|* time, at which point this header is generated. Do not modify this *| +|* header directly. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_ASM_PRINTER +# error Please define the macro LLVM_ASM_PRINTER(TargetName) +#endif + +@LLVM_ENUM_ASM_PRINTERS@ + +#undef LLVM_ASM_PRINTER diff --git a/contrib/libs/llvm16/include/llvm/Config/Disassemblers.def.in b/contrib/libs/llvm16/include/llvm/Config/Disassemblers.def.in new file mode 100644 index 0000000000..b110b1588d --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Config/Disassemblers.def.in @@ -0,0 +1,29 @@ +/*===- llvm/Config/Disassemblers.def - LLVM Assembly Parsers ----*- C++ -*-===*\ +|* *| +|* 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 file enumerates all of the assembly-language parsers *| +|* supported by this build of LLVM. Clients of this file should define *| +|* the LLVM_DISASSEMBLER macro to be a function-like macro with a *| +|* single parameter (the name of the target whose assembly can be *| +|* generated); including this file will then enumerate all of the *| +|* targets with assembly parsers. *| +|* *| +|* The set of targets supported by LLVM is generated at configuration *| +|* time, at which point this header is generated. Do not modify this *| +|* header directly. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_DISASSEMBLER +# error Please define the macro LLVM_DISASSEMBLER(TargetName) +#endif + +@LLVM_ENUM_DISASSEMBLERS@ + +#undef LLVM_DISASSEMBLER diff --git a/contrib/libs/llvm16/include/llvm/Config/TargetExegesis.def.in b/contrib/libs/llvm16/include/llvm/Config/TargetExegesis.def.in new file mode 100644 index 0000000000..884a154551 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Config/TargetExegesis.def.in @@ -0,0 +1,29 @@ +/*===----- llvm/Config/TargetExegesis.def - LLVM Target Exegesis-*- C++ -*-===*\ +|* *| +|* 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 file enumerates all of the target's of llvm-exegesis *| +|* supported by this build of LLVM. Clients of this file should define *| +|* the LLVM_EXEGISIS macro to be a function-like macro with a *| +|* single parameter (the name of the target whose assembly can be *| +|* generated); including this file will then enumerate all of the *| +|* targets with target llvm-exegsis support. *| +|* *| +|* The set of targets supported by LLVM is generated at configuration *| +|* time, at which point this header is generated. Do not modify this *| +|* header directly. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_EXEGESIS +# error Please define the macro LLVM_EXEGESIS(TargetName) +#endif + +@LLVM_ENUM_EXEGESIS@ + +#undef LLVM_EXEGESIS diff --git a/contrib/libs/llvm16/include/llvm/Config/TargetMCAs.def.in b/contrib/libs/llvm16/include/llvm/Config/TargetMCAs.def.in new file mode 100644 index 0000000000..0409b93cbf --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Config/TargetMCAs.def.in @@ -0,0 +1,29 @@ +/*===------ llvm/Config/TargetMCAs.def - LLVM Target MCAs -------*- C++ -*-===*\ +|* *| +|* 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 file enumerates all of the target MCAs *| +|* supported by this build of LLVM. Clients of this file should define *| +|* the LLVM_TARGETMCA macro to be a function-like macro with a *| +|* single parameter (the name of the target whose assembly can be *| +|* generated); including this file will then enumerate all of the *| +|* targets with target MCAs. *| +|* *| +|* The set of targets supported by LLVM is generated at configuration *| +|* time, at which point this header is generated. Do not modify this *| +|* header directly. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_TARGETMCA +# error Please define the macro LLVM_TARGETMCA(TargetName) +#endif + +@LLVM_ENUM_TARGETMCAS@ + +#undef LLVM_TARGETMCA diff --git a/contrib/libs/llvm16/include/llvm/Config/Targets.def.in b/contrib/libs/llvm16/include/llvm/Config/Targets.def.in new file mode 100644 index 0000000000..0da9b948c9 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Config/Targets.def.in @@ -0,0 +1,28 @@ +/*===- llvm/Config/Targets.def - LLVM Target Architectures ------*- C++ -*-===*\ +|* *| +|* 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 file enumerates all of the target architectures supported by *| +|* this build of LLVM. Clients of this file should define the *| +|* LLVM_TARGET macro to be a function-like macro with a single *| +|* parameter (the name of the target); including this file will then *| +|* enumerate all of the targets. *| +|* *| +|* The set of targets supported by LLVM is generated at configuration *| +|* time, at which point this header is generated. Do not modify this *| +|* header directly. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_TARGET +# error Please define the macro LLVM_TARGET(TargetName) +#endif + +@LLVM_ENUM_TARGETS@ + +#undef LLVM_TARGET diff --git a/contrib/libs/llvm16/include/llvm/Config/abi-breaking.h.cmake b/contrib/libs/llvm16/include/llvm/Config/abi-breaking.h.cmake new file mode 100644 index 0000000000..2d27e02b1d --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Config/abi-breaking.h.cmake @@ -0,0 +1,62 @@ +/*===------- llvm/Config/abi-breaking.h - llvm configuration -------*- C -*-===*/ +/* */ +/* 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 file controls the C++ ABI break introduced in LLVM public header. */ + +#ifndef LLVM_ABI_BREAKING_CHECKS_H +#define LLVM_ABI_BREAKING_CHECKS_H + +/* Define to enable checks that alter the LLVM C++ ABI */ +#cmakedefine01 LLVM_ENABLE_ABI_BREAKING_CHECKS + +/* Define to enable reverse iteration of unordered llvm containers */ +#cmakedefine01 LLVM_ENABLE_REVERSE_ITERATION + +/* Allow selectively disabling link-time mismatch checking so that header-only + ADT content from LLVM can be used without linking libSupport. */ +#if !defined(LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING) || !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING + +// ABI_BREAKING_CHECKS protection: provides link-time failure when clients build +// mismatch with LLVM +#if defined(_MSC_VER) +// Use pragma with MSVC +#define LLVM_XSTR(s) LLVM_STR(s) +#define LLVM_STR(s) #s +#pragma detect_mismatch("LLVM_ENABLE_ABI_BREAKING_CHECKS", LLVM_XSTR(LLVM_ENABLE_ABI_BREAKING_CHECKS)) +#undef LLVM_XSTR +#undef LLVM_STR +#elif defined(_WIN32) || defined(__CYGWIN__) // Win32 w/o #pragma detect_mismatch +// FIXME: Implement checks without weak. +#elif defined(__cplusplus) +#if !(defined(_AIX) && defined(__GNUC__) && !defined(__clang__)) +#define LLVM_HIDDEN_VISIBILITY __attribute__ ((visibility("hidden"))) +#else +// GCC on AIX does not support visibility attributes. Symbols are not +// exported by default on AIX. +#define LLVM_HIDDEN_VISIBILITY +#endif +namespace llvm { +#if LLVM_ENABLE_ABI_BREAKING_CHECKS +extern int EnableABIBreakingChecks; +LLVM_HIDDEN_VISIBILITY +__attribute__((weak)) int *VerifyEnableABIBreakingChecks = + &EnableABIBreakingChecks; +#else +extern int DisableABIBreakingChecks; +LLVM_HIDDEN_VISIBILITY +__attribute__((weak)) int *VerifyDisableABIBreakingChecks = + &DisableABIBreakingChecks; +#endif +} +#undef LLVM_HIDDEN_VISIBILITY +#endif // _MSC_VER + +#endif // LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING + +#endif diff --git a/contrib/libs/llvm16/include/llvm/Config/config.h.cmake b/contrib/libs/llvm16/include/llvm/Config/config.h.cmake new file mode 100644 index 0000000000..29ac536b4c --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Config/config.h.cmake @@ -0,0 +1,337 @@ +#ifndef CONFIG_H +#define CONFIG_H + +// Include this header only under the llvm source tree. +// This is a private header. + +/* Exported configuration */ +#include "llvm/Config/llvm-config.h" + +/* Bug report URL. */ +#define BUG_REPORT_URL "${BUG_REPORT_URL}" + +/* Define to 1 to enable backtraces, and to 0 otherwise. */ +#cmakedefine01 ENABLE_BACKTRACES + +/* Define to 1 to enable crash overrides, and to 0 otherwise. */ +#cmakedefine01 ENABLE_CRASH_OVERRIDES + +/* Define to 1 to enable crash memory dumps, and to 0 otherwise. */ +#cmakedefine01 LLVM_ENABLE_CRASH_DUMPS + +/* Define to 1 to prefer forward slashes on Windows, and to 0 prefer + backslashes. */ +#cmakedefine01 LLVM_WINDOWS_PREFER_FORWARD_SLASH + +/* Define to 1 if you have the `backtrace' function. */ +#cmakedefine HAVE_BACKTRACE ${HAVE_BACKTRACE} + +#define BACKTRACE_HEADER <${BACKTRACE_HEADER}> + +/* Define to 1 if you have the <CrashReporterClient.h> header file. */ +#cmakedefine HAVE_CRASHREPORTERCLIENT_H + +/* can use __crashreporter_info__ */ +#cmakedefine01 HAVE_CRASHREPORTER_INFO + +/* Define to 1 if you have the declaration of `arc4random', and to 0 if you + don't. */ +#cmakedefine01 HAVE_DECL_ARC4RANDOM + +/* Define to 1 if you have the declaration of `FE_ALL_EXCEPT', and to 0 if you + don't. */ +#cmakedefine01 HAVE_DECL_FE_ALL_EXCEPT + +/* Define to 1 if you have the declaration of `FE_INEXACT', and to 0 if you + don't. */ +#cmakedefine01 HAVE_DECL_FE_INEXACT + +/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you + don't. */ +#cmakedefine01 HAVE_DECL_STRERROR_S + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H} + +/* Define if dlopen() is available on this platform. */ +#cmakedefine HAVE_DLOPEN ${HAVE_DLOPEN} + +/* Define if dladdr() is available on this platform. */ +#cmakedefine HAVE_DLADDR ${HAVE_DLADDR} + +/* Define to 1 if we can register EH frames on this platform. */ +#cmakedefine HAVE_REGISTER_FRAME ${HAVE_REGISTER_FRAME} + +/* Define to 1 if we can deregister EH frames on this platform. */ +#cmakedefine HAVE_DEREGISTER_FRAME ${HAVE_DEREGISTER_FRAME} + +/* Define if __unw_add_dynamic_fde() is available on this platform. */ +#cmakedefine HAVE_UNW_ADD_DYNAMIC_FDE ${HAVE_UNW_ADD_DYNAMIC_FDE} + +/* Define to 1 if you have the <errno.h> header file. */ +#cmakedefine HAVE_ERRNO_H ${HAVE_ERRNO_H} + +/* Define to 1 if you have the <fcntl.h> header file. */ +#cmakedefine HAVE_FCNTL_H ${HAVE_FCNTL_H} + +/* Define to 1 if you have the <fenv.h> header file. */ +#cmakedefine HAVE_FENV_H ${HAVE_FENV_H} + +/* Define if libffi is available on this platform. */ +#cmakedefine HAVE_FFI_CALL ${HAVE_FFI_CALL} + +/* Define to 1 if you have the <ffi/ffi.h> header file. */ +#cmakedefine HAVE_FFI_FFI_H ${HAVE_FFI_FFI_H} + +/* Define to 1 if you have the <ffi.h> header file. */ +#cmakedefine HAVE_FFI_H ${HAVE_FFI_H} + +/* Define to 1 if you have the `futimens' function. */ +#cmakedefine HAVE_FUTIMENS ${HAVE_FUTIMENS} + +/* Define to 1 if you have the `futimes' function. */ +#cmakedefine HAVE_FUTIMES ${HAVE_FUTIMES} + +/* Define to 1 if you have the `getpagesize' function. */ +#cmakedefine HAVE_GETPAGESIZE ${HAVE_GETPAGESIZE} + +/* Define to 1 if you have the `getrlimit' function. */ +#cmakedefine HAVE_GETRLIMIT ${HAVE_GETRLIMIT} + +/* Define to 1 if you have the `getrusage' function. */ +#cmakedefine HAVE_GETRUSAGE ${HAVE_GETRUSAGE} + +/* Define to 1 if you have the `isatty' function. */ +#cmakedefine HAVE_ISATTY 1 + +/* Define to 1 if you have the `edit' library (-ledit). */ +#cmakedefine HAVE_LIBEDIT ${HAVE_LIBEDIT} + +/* Define to 1 if you have the `pfm' library (-lpfm). */ +#cmakedefine HAVE_LIBPFM ${HAVE_LIBPFM} + +/* Define to 1 if the `perf_branch_entry' struct has field cycles. */ +#cmakedefine LIBPFM_HAS_FIELD_CYCLES ${LIBPFM_HAS_FIELD_CYCLES} + +/* Define to 1 if you have the `psapi' library (-lpsapi). */ +#cmakedefine HAVE_LIBPSAPI ${HAVE_LIBPSAPI} + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#cmakedefine HAVE_LIBPTHREAD ${HAVE_LIBPTHREAD} + +/* Define to 1 if you have the `pthread_getname_np' function. */ +#cmakedefine HAVE_PTHREAD_GETNAME_NP ${HAVE_PTHREAD_GETNAME_NP} + +/* Define to 1 if you have the `pthread_setname_np' function. */ +#cmakedefine HAVE_PTHREAD_SETNAME_NP ${HAVE_PTHREAD_SETNAME_NP} + +/* Define to 1 if you have the <link.h> header file. */ +#cmakedefine HAVE_LINK_H ${HAVE_LINK_H} + +/* Define to 1 if you have the <mach/mach.h> header file. */ +#cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H} + +/* Define to 1 if you have the `mallctl' function. */ +#cmakedefine HAVE_MALLCTL ${HAVE_MALLCTL} + +/* Define to 1 if you have the `mallinfo' function. */ +#cmakedefine HAVE_MALLINFO ${HAVE_MALLINFO} + +/* Define to 1 if you have the `mallinfo2' function. */ +#cmakedefine HAVE_MALLINFO2 ${HAVE_MALLINFO2} + +/* Define to 1 if you have the <malloc/malloc.h> header file. */ +#cmakedefine HAVE_MALLOC_MALLOC_H ${HAVE_MALLOC_MALLOC_H} + +/* Define to 1 if you have the `malloc_zone_statistics' function. */ +#cmakedefine HAVE_MALLOC_ZONE_STATISTICS ${HAVE_MALLOC_ZONE_STATISTICS} + +/* Define to 1 if you have the `posix_spawn' function. */ +#cmakedefine HAVE_POSIX_SPAWN ${HAVE_POSIX_SPAWN} + +/* Define to 1 if you have the `pread' function. */ +#cmakedefine HAVE_PREAD ${HAVE_PREAD} + +/* Define to 1 if you have the <pthread.h> header file. */ +#cmakedefine HAVE_PTHREAD_H ${HAVE_PTHREAD_H} + +/* Have pthread_mutex_lock */ +#cmakedefine HAVE_PTHREAD_MUTEX_LOCK ${HAVE_PTHREAD_MUTEX_LOCK} + +/* Have pthread_rwlock_init */ +#cmakedefine HAVE_PTHREAD_RWLOCK_INIT ${HAVE_PTHREAD_RWLOCK_INIT} + +/* Define to 1 if you have the `sbrk' function. */ +#cmakedefine HAVE_SBRK ${HAVE_SBRK} + +/* Define to 1 if you have the `setenv' function. */ +#cmakedefine HAVE_SETENV ${HAVE_SETENV} + +/* Define to 1 if you have the `setrlimit' function. */ +#cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT} + +/* Define to 1 if you have the `sigaltstack' function. */ +#cmakedefine HAVE_SIGALTSTACK ${HAVE_SIGALTSTACK} + +/* Define to 1 if you have the <signal.h> header file. */ +#cmakedefine HAVE_SIGNAL_H ${HAVE_SIGNAL_H} + +/* Define to 1 if you have the `strerror' function. */ +#cmakedefine HAVE_STRERROR ${HAVE_STRERROR} + +/* Define to 1 if you have the `strerror_r' function. */ +#cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R} + +/* Define to 1 if you have the `sysconf' function. */ +#cmakedefine HAVE_SYSCONF ${HAVE_SYSCONF} + +/* Define to 1 if you have the <sys/ioctl.h> header file. */ +#cmakedefine HAVE_SYS_IOCTL_H ${HAVE_SYS_IOCTL_H} + +/* Define to 1 if you have the <sys/mman.h> header file. */ +#cmakedefine HAVE_SYS_MMAN_H ${HAVE_SYS_MMAN_H} + +/* Define to 1 if you have the <sys/param.h> header file. */ +#cmakedefine HAVE_SYS_PARAM_H ${HAVE_SYS_PARAM_H} + +/* Define to 1 if you have the <sys/resource.h> header file. */ +#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H} + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#cmakedefine HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H} + +/* Define to 1 if you have the <sys/time.h> header file. */ +#cmakedefine HAVE_SYS_TIME_H ${HAVE_SYS_TIME_H} + +/* Define to 1 if stat struct has st_mtimespec member .*/ +#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC ${HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC} + +/* Define to 1 if stat struct has st_mtim member. */ +#cmakedefine HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC ${HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC} + +/* Define to 1 if you have the <sys/types.h> header file. */ +#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H} + +/* Define if the setupterm() function is supported this platform. */ +#cmakedefine LLVM_ENABLE_TERMINFO ${LLVM_ENABLE_TERMINFO} + +/* Define to 1 if you have the <termios.h> header file. */ +#cmakedefine HAVE_TERMIOS_H ${HAVE_TERMIOS_H} + +/* Define to 1 if you have the <unistd.h> header file. */ +#cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H} + +/* Define to 1 if you have the <valgrind/valgrind.h> header file. */ +#cmakedefine HAVE_VALGRIND_VALGRIND_H ${HAVE_VALGRIND_VALGRIND_H} + +/* Have host's _alloca */ +#cmakedefine HAVE__ALLOCA ${HAVE__ALLOCA} + +/* Define to 1 if you have the `_chsize_s' function. */ +#cmakedefine HAVE__CHSIZE_S ${HAVE__CHSIZE_S} + +/* Define to 1 if you have the `_Unwind_Backtrace' function. */ +#cmakedefine HAVE__UNWIND_BACKTRACE ${HAVE__UNWIND_BACKTRACE} + +/* Have host's __alloca */ +#cmakedefine HAVE___ALLOCA ${HAVE___ALLOCA} + +/* Have host's __ashldi3 */ +#cmakedefine HAVE___ASHLDI3 ${HAVE___ASHLDI3} + +/* Have host's __ashrdi3 */ +#cmakedefine HAVE___ASHRDI3 ${HAVE___ASHRDI3} + +/* Have host's __chkstk */ +#cmakedefine HAVE___CHKSTK ${HAVE___CHKSTK} + +/* Have host's __chkstk_ms */ +#cmakedefine HAVE___CHKSTK_MS ${HAVE___CHKSTK_MS} + +/* Have host's __cmpdi2 */ +#cmakedefine HAVE___CMPDI2 ${HAVE___CMPDI2} + +/* Have host's __divdi3 */ +#cmakedefine HAVE___DIVDI3 ${HAVE___DIVDI3} + +/* Have host's __fixdfdi */ +#cmakedefine HAVE___FIXDFDI ${HAVE___FIXDFDI} + +/* Have host's __fixsfdi */ +#cmakedefine HAVE___FIXSFDI ${HAVE___FIXSFDI} + +/* Have host's __floatdidf */ +#cmakedefine HAVE___FLOATDIDF ${HAVE___FLOATDIDF} + +/* Have host's __lshrdi3 */ +#cmakedefine HAVE___LSHRDI3 ${HAVE___LSHRDI3} + +/* Have host's __main */ +#cmakedefine HAVE___MAIN ${HAVE___MAIN} + +/* Have host's __moddi3 */ +#cmakedefine HAVE___MODDI3 ${HAVE___MODDI3} + +/* Have host's __udivdi3 */ +#cmakedefine HAVE___UDIVDI3 ${HAVE___UDIVDI3} + +/* Have host's __umoddi3 */ +#cmakedefine HAVE___UMODDI3 ${HAVE___UMODDI3} + +/* Have host's ___chkstk */ +#cmakedefine HAVE____CHKSTK ${HAVE____CHKSTK} + +/* Have host's ___chkstk_ms */ +#cmakedefine HAVE____CHKSTK_MS ${HAVE____CHKSTK_MS} + +/* Linker version detected at compile time. */ +#cmakedefine HOST_LINK_VERSION "${HOST_LINK_VERSION}" + +/* Define if overriding target triple is enabled */ +#cmakedefine LLVM_TARGET_TRIPLE_ENV "${LLVM_TARGET_TRIPLE_ENV}" + +/* Whether tools show host and target info when invoked with --version */ +#cmakedefine01 LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO + +/* Define if libxml2 is supported on this platform. */ +#cmakedefine LLVM_ENABLE_LIBXML2 ${LLVM_ENABLE_LIBXML2} + +/* Define to the extension used for shared libraries, say, ".so". */ +#cmakedefine LTDL_SHLIB_EXT "${LTDL_SHLIB_EXT}" + +/* Define to the extension used for plugin libraries, say, ".so". */ +#cmakedefine LLVM_PLUGIN_EXT "${LLVM_PLUGIN_EXT}" + +/* Define to the address where bug reports for this package should be sent. */ +#cmakedefine PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}" + +/* Define to the full name of this package. */ +#cmakedefine PACKAGE_NAME "${PACKAGE_NAME}" + +/* Define to the full name and version of this package. */ +#cmakedefine PACKAGE_STRING "${PACKAGE_STRING}" + +/* Define to the version of this package. */ +#cmakedefine PACKAGE_VERSION "${PACKAGE_VERSION}" + +/* Define to the vendor of this package. */ +#cmakedefine PACKAGE_VENDOR "${PACKAGE_VENDOR}" + +/* Define to a function implementing stricmp */ +#cmakedefine stricmp ${stricmp} + +/* Define to a function implementing strdup */ +#cmakedefine strdup ${strdup} + +/* Whether GlobalISel rule coverage is being collected */ +#cmakedefine01 LLVM_GISEL_COV_ENABLED + +/* Define to the default GlobalISel coverage file prefix */ +#cmakedefine LLVM_GISEL_COV_PREFIX "${LLVM_GISEL_COV_PREFIX}" + +/* Whether Timers signpost passes in Xcode Instruments */ +#cmakedefine01 LLVM_SUPPORT_XCODE_SIGNPOSTS + +#cmakedefine HAVE_PROC_PID_RUSAGE 1 + +#endif diff --git a/contrib/libs/llvm16/include/llvm/Config/llvm-config.h.cmake b/contrib/libs/llvm16/include/llvm/Config/llvm-config.h.cmake new file mode 100644 index 0000000000..012ae2174c --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Config/llvm-config.h.cmake @@ -0,0 +1,129 @@ +/*===------- llvm/Config/llvm-config.h - llvm configuration -------*- C -*-===*/ +/* */ +/* 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 file enumerates variables from the LLVM configuration so that they + can be in exported headers and won't override package specific directives. + This is a C header that can be included in the llvm-c headers. */ + +#ifndef LLVM_CONFIG_H +#define LLVM_CONFIG_H + +/* Define if LLVM_ENABLE_DUMP is enabled */ +#cmakedefine LLVM_ENABLE_DUMP + +/* Target triple LLVM will generate code for by default */ +/* Doesn't use `cmakedefine` because it is allowed to be empty. */ +#define LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" + +/* Define if threads enabled */ +#cmakedefine01 LLVM_ENABLE_THREADS + +/* Has gcc/MSVC atomic intrinsics */ +#cmakedefine01 LLVM_HAS_ATOMICS + +/* Host triple LLVM will be executed on */ +#cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}" + +/* LLVM architecture name for the native architecture, if available */ +#cmakedefine LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH} + +/* LLVM name for the native AsmParser init function, if available */ +#cmakedefine LLVM_NATIVE_ASMPARSER LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser + +/* LLVM name for the native AsmPrinter init function, if available */ +#cmakedefine LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter + +/* LLVM name for the native Disassembler init function, if available */ +#cmakedefine LLVM_NATIVE_DISASSEMBLER LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler + +/* LLVM name for the native Target init function, if available */ +#cmakedefine LLVM_NATIVE_TARGET LLVMInitialize${LLVM_NATIVE_ARCH}Target + +/* LLVM name for the native TargetInfo init function, if available */ +#cmakedefine LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo + +/* LLVM name for the native target MC init function, if available */ +#cmakedefine LLVM_NATIVE_TARGETMC LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC + +/* LLVM name for the native target MCA init function, if available */ +#cmakedefine LLVM_NATIVE_TARGETMCA LLVMInitialize${LLVM_NATIVE_ARCH}TargetMCA + +/* Define if this is Unixish platform */ +#cmakedefine LLVM_ON_UNIX ${LLVM_ON_UNIX} + +/* Define if we have the Intel JIT API runtime support library */ +#cmakedefine01 LLVM_USE_INTEL_JITEVENTS + +/* Define if we have the oprofile JIT-support library */ +#cmakedefine01 LLVM_USE_OPROFILE + +/* Define if we have the perf JIT-support library */ +#cmakedefine01 LLVM_USE_PERF + +/* Major version of the LLVM API */ +#define LLVM_VERSION_MAJOR ${LLVM_VERSION_MAJOR} + +/* Minor version of the LLVM API */ +#define LLVM_VERSION_MINOR ${LLVM_VERSION_MINOR} + +/* Patch version of the LLVM API */ +#define LLVM_VERSION_PATCH ${LLVM_VERSION_PATCH} + +/* LLVM version string */ +#define LLVM_VERSION_STRING "${PACKAGE_VERSION}" + +/* Whether LLVM records statistics for use with GetStatistics(), + * PrintStatistics() or PrintStatisticsJSON() + */ +#cmakedefine01 LLVM_FORCE_ENABLE_STATS + +/* Define if we have z3 and want to build it */ +#cmakedefine LLVM_WITH_Z3 ${LLVM_WITH_Z3} + +/* Define if we have curl and want to use it */ +#cmakedefine LLVM_ENABLE_CURL ${LLVM_ENABLE_CURL} + +/* Define if we have cpp-httplib and want to use it */ +#cmakedefine LLVM_ENABLE_HTTPLIB ${LLVM_ENABLE_HTTPLIB} + +/* Define if zlib compression is available */ +#cmakedefine01 LLVM_ENABLE_ZLIB + +/* Define if zstd compression is available */ +#cmakedefine01 LLVM_ENABLE_ZSTD + +/* Define if LLVM is using tflite instead of libtensorflow */ +#cmakedefine LLVM_HAVE_TFLITE + +/* Define to 1 if you have the <sysexits.h> header file. */ +#cmakedefine HAVE_SYSEXITS_H ${HAVE_SYSEXITS_H} + +/* Define if the xar_open() function is supported on this platform. */ +#cmakedefine LLVM_HAVE_LIBXAR ${LLVM_HAVE_LIBXAR} + +/* Define if building libLLVM shared library */ +#cmakedefine LLVM_BUILD_LLVM_DYLIB + +/* Define if building LLVM with BUILD_SHARED_LIBS */ +#cmakedefine LLVM_BUILD_SHARED_LIBS + +/* Define if building LLVM with LLVM_FORCE_USE_OLD_TOOLCHAIN_LIBS */ +#cmakedefine LLVM_FORCE_USE_OLD_TOOLCHAIN ${LLVM_FORCE_USE_OLD_TOOLCHAIN} + +/* Define if llvm_unreachable should be optimized with undefined behavior + * in non assert builds */ +#cmakedefine01 LLVM_UNREACHABLE_OPTIMIZE + +/* Define to 1 if you have the DIA SDK installed, and to 0 if you don't. */ +#cmakedefine01 LLVM_ENABLE_DIA_SDK + +/* Define if plugins enabled */ +#cmakedefine LLVM_ENABLE_PLUGINS + +#endif diff --git a/contrib/libs/llvm16/include/llvm/DWARFLinkerParallel/DWARFLinker.h b/contrib/libs/llvm16/include/llvm/DWARFLinkerParallel/DWARFLinker.h new file mode 100644 index 0000000000..ae538b49a1 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DWARFLinkerParallel/DWARFLinker.h @@ -0,0 +1,27 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DWARFLinker.h --------------------------------------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DWARFLINKERPARALLEL_DWARFLINKER_H +#define LLVM_DWARFLINKERPARALLEL_DWARFLINKER_H + +namespace llvm { +namespace dwarflinker_parallel {} // end namespace dwarflinker_parallel +} // end namespace llvm + +#endif // LLVM_DWARFLINKERPARALLEL_DWARFLINKER_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/CodeView/FunctionId.h b/contrib/libs/llvm16/include/llvm/DebugInfo/CodeView/FunctionId.h new file mode 100644 index 0000000000..8de994911b --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/CodeView/FunctionId.h @@ -0,0 +1,66 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- FunctionId.h ---------------------------------------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_CODEVIEW_FUNCTIONID_H +#define LLVM_DEBUGINFO_CODEVIEW_FUNCTIONID_H + +#include <cinttypes> + +namespace llvm { +namespace codeview { + +class FunctionId { +public: + FunctionId() : Index(0) {} + + explicit FunctionId(uint32_t Index) : Index(Index) {} + + uint32_t getIndex() const { return Index; } + +private: + uint32_t Index; +}; + +inline bool operator==(const FunctionId &A, const FunctionId &B) { + return A.getIndex() == B.getIndex(); +} + +inline bool operator!=(const FunctionId &A, const FunctionId &B) { + return A.getIndex() != B.getIndex(); +} + +inline bool operator<(const FunctionId &A, const FunctionId &B) { + return A.getIndex() < B.getIndex(); +} + +inline bool operator<=(const FunctionId &A, const FunctionId &B) { + return A.getIndex() <= B.getIndex(); +} + +inline bool operator>(const FunctionId &A, const FunctionId &B) { + return A.getIndex() > B.getIndex(); +} + +inline bool operator>=(const FunctionId &A, const FunctionId &B) { + return A.getIndex() >= B.getIndex(); +} +} +} + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/CodeView/TypeSymbolEmitter.h b/contrib/libs/llvm16/include/llvm/DebugInfo/CodeView/TypeSymbolEmitter.h new file mode 100644 index 0000000000..9500bdb088 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/CodeView/TypeSymbolEmitter.h @@ -0,0 +1,46 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- TypeSymbolEmitter.h --------------------------------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESYMBOLEMITTER_H +#define LLVM_DEBUGINFO_CODEVIEW_TYPESYMBOLEMITTER_H + +namespace llvm { +class StringRef; + +namespace codeview { +class TypeIndex; + +class TypeSymbolEmitter { +private: + TypeSymbolEmitter(const TypeSymbolEmitter &) = delete; + TypeSymbolEmitter &operator=(const TypeSymbolEmitter &) = delete; + +protected: + TypeSymbolEmitter() {} + +public: + virtual ~TypeSymbolEmitter() {} + +public: + virtual void writeUserDefinedType(TypeIndex TI, StringRef Name) = 0; +}; +} +} + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVCompare.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVCompare.h new file mode 100644 index 0000000000..c8d663e255 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVCompare.h @@ -0,0 +1,100 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVCompare.h ---------------------------------------------*- C++ -*-===// +// +// 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 file defines the LVCompare class, which is used to describe a logical +// view comparison. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVCOMPARE_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVCOMPARE_H + +#include "llvm/DebugInfo/LogicalView/Core/LVObject.h" + +namespace llvm { +namespace logicalview { + +class LVReader; + +// Record the elements missing or added and their compare pass. +using LVPassEntry = std::tuple<LVReader *, LVElement *, LVComparePass>; +using LVPassTable = std::vector<LVPassEntry>; + +class LVCompare final { + raw_ostream &OS; + LVScopes ScopeStack; + + // As the comparison is performed twice (by exchanging the reference + // and target readers) the element missing/added status does specify + // the comparison pass. + // By recording each missing/added elements along with its pass, it + // allows checking which elements were missing/added during each pass. + LVPassTable PassTable; + + // Reader used on the LHS of the comparison. + // In the 'Missing' pass, it points to the reference reader. + // In the 'Added' pass it points to the target reader. + LVReader *Reader = nullptr; + + bool FirstMissing = true; + bool PrintLines = false; + bool PrintScopes = false; + bool PrintSymbols = false; + bool PrintTypes = false; + + static void setInstance(LVCompare *Compare); + + void printCurrentStack(); + void printSummary() const; + +public: + LVCompare() = delete; + LVCompare(raw_ostream &OS); + LVCompare(const LVCompare &) = delete; + LVCompare &operator=(const LVCompare &) = delete; + ~LVCompare() = default; + + static LVCompare &getInstance(); + + // Scopes stack used during the missing/added reporting. + void push(LVScope *Scope) { ScopeStack.push_back(Scope); } + void pop() { ScopeStack.pop_back(); } + + // Perform comparison between the 'Reference' and 'Target' scopes tree. + Error execute(LVReader *ReferenceReader, LVReader *TargetReader); + + void addPassEntry(LVReader *Reader, LVElement *Element, LVComparePass Pass) { + PassTable.emplace_back(Reader, Element, Pass); + } + const LVPassTable &getPassTable() const & { return PassTable; } + + void printItem(LVElement *Element, LVComparePass Pass); + void print(raw_ostream &OS) const; + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const { print(dbgs()); } +#endif +}; + +inline LVCompare &getComparator() { return LVCompare::getInstance(); } + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVCOMPARE_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVElement.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVElement.h new file mode 100644 index 0000000000..1b840ee8c2 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVElement.h @@ -0,0 +1,363 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVElement.h ---------------------------------------------*- C++ -*-===// +// +// 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 file defines the LVElement class, which is used to describe a debug +// information element. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVELEMENT_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVELEMENT_H + +#include "llvm/DebugInfo/LogicalView/Core/LVObject.h" +#include "llvm/Support/Casting.h" +#include <map> +#include <set> +#include <vector> + +namespace llvm { +namespace logicalview { + +// RTTI Subclasses ID. +enum class LVSubclassID : unsigned char { + LV_ELEMENT, + LV_LINE_FIRST, + LV_LINE, + LV_LINE_DEBUG, + LV_LINE_ASSEMBLER, + LV_LINE_LAST, + lV_SCOPE_FIRST, + LV_SCOPE, + LV_SCOPE_AGGREGATE, + LV_SCOPE_ALIAS, + LV_SCOPE_ARRAY, + LV_SCOPE_COMPILE_UNIT, + LV_SCOPE_ENUMERATION, + LV_SCOPE_FORMAL_PACK, + LV_SCOPE_FUNCTION, + LV_SCOPE_FUNCTION_INLINED, + LV_SCOPE_FUNCTION_TYPE, + LV_SCOPE_NAMESPACE, + LV_SCOPE_ROOT, + LV_SCOPE_TEMPLATE_PACK, + LV_SCOPE_LAST, + LV_SYMBOL_FIRST, + LV_SYMBOL, + LV_SYMBOL_LAST, + LV_TYPE_FIRST, + LV_TYPE, + LV_TYPE_DEFINITION, + LV_TYPE_ENUMERATOR, + LV_TYPE_IMPORT, + LV_TYPE_PARAM, + LV_TYPE_SUBRANGE, + LV_TYPE_LAST +}; + +enum class LVElementKind { Discarded, Global, Optimized, LastEntry }; +using LVElementKindSet = std::set<LVElementKind>; +using LVElementDispatch = std::map<LVElementKind, LVElementGetFunction>; +using LVElementRequest = std::vector<LVElementGetFunction>; + +class LVElement : public LVObject { + enum class Property { + IsLine, // A logical line. + IsScope, // A logical scope. + IsSymbol, // A logical symbol. + IsType, // A logical type. + IsEnumClass, + IsExternal, + HasType, + HasAugmentedName, + IsTypedefReduced, + IsArrayResolved, + IsMemberPointerResolved, + IsTemplateResolved, + IsInlined, + IsInlinedAbstract, + InvalidFilename, + HasReference, + HasReferenceAbstract, + HasReferenceExtension, + HasReferenceSpecification, + QualifiedResolved, + IncludeInPrint, + IsStatic, + TransformName, + IsScoped, // CodeView local type. + IsNested, // CodeView nested type. + IsScopedAlready, // CodeView nested type inserted in correct scope. + IsArtificial, + IsReferencedType, + IsSystem, + OffsetFromTypeIndex, + IsAnonymous, + LastEntry + }; + // Typed bitvector with properties for this element. + LVProperties<Property> Properties; + static LVElementDispatch Dispatch; + + /// RTTI. + const LVSubclassID SubclassID; + + // Indexes in the String Pool. + size_t NameIndex = 0; + size_t QualifiedNameIndex = 0; + size_t FilenameIndex = 0; + + uint16_t AccessibilityCode : 2; // DW_AT_accessibility. + uint16_t InlineCode : 2; // DW_AT_inline. + uint16_t VirtualityCode : 2; // DW_AT_virtuality. + + // The given Specification points to an element that is connected via the + // DW_AT_specification, DW_AT_abstract_origin or DW_AT_extension attribute. + void setFileLine(LVElement *Specification); + + // Get the qualified name that include its parents name. + void resolveQualifiedName(); + +protected: + // Type of this element. + LVElement *ElementType = nullptr; + + // Print the FileName Index. + void printFileIndex(raw_ostream &OS, bool Full = true) const override; + +public: + LVElement(LVSubclassID ID) + : LVObject(), SubclassID(ID), AccessibilityCode(0), InlineCode(0), + VirtualityCode(0) {} + LVElement(const LVElement &) = delete; + LVElement &operator=(const LVElement &) = delete; + virtual ~LVElement() = default; + + LVSubclassID getSubclassID() const { return SubclassID; } + + PROPERTY(Property, IsLine); + PROPERTY(Property, IsScope); + PROPERTY(Property, IsSymbol); + PROPERTY(Property, IsType); + PROPERTY(Property, IsEnumClass); + PROPERTY(Property, IsExternal); + PROPERTY(Property, HasType); + PROPERTY(Property, HasAugmentedName); + PROPERTY(Property, IsTypedefReduced); + PROPERTY(Property, IsArrayResolved); + PROPERTY(Property, IsMemberPointerResolved); + PROPERTY(Property, IsTemplateResolved); + PROPERTY(Property, IsInlined); + PROPERTY(Property, IsInlinedAbstract); + PROPERTY(Property, InvalidFilename); + PROPERTY(Property, HasReference); + PROPERTY(Property, HasReferenceAbstract); + PROPERTY(Property, HasReferenceExtension); + PROPERTY(Property, HasReferenceSpecification); + PROPERTY(Property, QualifiedResolved); + PROPERTY(Property, IncludeInPrint); + PROPERTY(Property, IsStatic); + PROPERTY(Property, TransformName); + PROPERTY(Property, IsScoped); + PROPERTY(Property, IsNested); + PROPERTY(Property, IsScopedAlready); + PROPERTY(Property, IsArtificial); + PROPERTY(Property, IsReferencedType); + PROPERTY(Property, IsSystem); + PROPERTY(Property, OffsetFromTypeIndex); + PROPERTY(Property, IsAnonymous); + + bool isNamed() const override { return NameIndex != 0; } + bool isTyped() const override { return ElementType != nullptr; } + bool isFiled() const override { return FilenameIndex != 0; } + + // The Element class type can point to a Type or Scope. + bool getIsKindType() const { return ElementType && ElementType->getIsType(); } + bool getIsKindScope() const { + return ElementType && ElementType->getIsScope(); + } + + StringRef getName() const override { + return getStringPool().getString(NameIndex); + } + void setName(StringRef ElementName) override; + + // Get pathname associated with the Element. + StringRef getPathname() const { + return getStringPool().getString(getFilenameIndex()); + } + + // Set filename associated with the Element. + void setFilename(StringRef Filename); + + // Set the Element qualified name. + void setQualifiedName(StringRef Name) { + QualifiedNameIndex = getStringPool().getIndex(Name); + } + StringRef getQualifiedName() const { + return getStringPool().getString(QualifiedNameIndex); + } + + size_t getNameIndex() const { return NameIndex; } + size_t getQualifiedNameIndex() const { return QualifiedNameIndex; } + + // Element type name. + StringRef getTypeName() const; + + virtual StringRef getProducer() const { return StringRef(); } + virtual void setProducer(StringRef ProducerName) {} + + virtual bool isCompileUnit() const { return false; } + virtual bool isRoot() const { return false; } + + virtual void setReference(LVElement *Element) {} + virtual void setReference(LVScope *Scope) {} + virtual void setReference(LVSymbol *Symbol) {} + virtual void setReference(LVType *Type) {} + + virtual void setLinkageName(StringRef LinkageName) {} + virtual StringRef getLinkageName() const { return StringRef(); } + virtual size_t getLinkageNameIndex() const { return 0; } + + virtual uint32_t getCallLineNumber() const { return 0; } + virtual void setCallLineNumber(uint32_t Number) {} + virtual size_t getCallFilenameIndex() const { return 0; } + virtual void setCallFilenameIndex(size_t Index) {} + size_t getFilenameIndex() const { return FilenameIndex; } + void setFilenameIndex(size_t Index) { FilenameIndex = Index; } + + // Set the File location for the Element. + void setFile(LVElement *Reference = nullptr); + + virtual bool isBase() const { return false; } + virtual bool isTemplateParam() const { return false; } + + virtual uint32_t getBitSize() const { return 0; } + virtual void setBitSize(uint32_t Size) {} + + virtual int64_t getCount() const { return 0; } + virtual void setCount(int64_t Value) {} + virtual int64_t getLowerBound() const { return 0; } + virtual void setLowerBound(int64_t Value) {} + virtual int64_t getUpperBound() const { return 0; } + virtual void setUpperBound(int64_t Value) {} + virtual std::pair<unsigned, unsigned> getBounds() const { return {}; } + virtual void setBounds(unsigned Lower, unsigned Upper) {} + + // Access DW_AT_GNU_discriminator attribute. + virtual uint32_t getDiscriminator() const { return 0; } + virtual void setDiscriminator(uint32_t Value) {} + + // Process the values for a DW_TAG_enumerator. + virtual std::string getValue() const { return {}; } + virtual void setValue(StringRef Value) {} + virtual size_t getValueIndex() const { return 0; } + + // DWARF Accessibility Codes. + uint32_t getAccessibilityCode() const { return AccessibilityCode; } + void setAccessibilityCode(uint32_t Access) { AccessibilityCode = Access; } + StringRef + accessibilityString(uint32_t Access = dwarf::DW_ACCESS_private) const; + + // DWARF Inline Codes. + uint32_t getInlineCode() const { return InlineCode; } + void setInlineCode(uint32_t Code) { InlineCode = Code; } + StringRef inlineCodeString(uint32_t Code) const; + + // DWARF Virtuality Codes. + uint32_t getVirtualityCode() const { return VirtualityCode; } + void setVirtualityCode(uint32_t Virtuality) { VirtualityCode = Virtuality; } + StringRef + virtualityString(uint32_t Virtuality = dwarf::DW_VIRTUALITY_none) const; + + // DWARF Extern Codes. + StringRef externalString() const; + + LVElement *getType() const { return ElementType; } + LVType *getTypeAsType() const; + LVScope *getTypeAsScope() const; + + void setType(LVElement *Element = nullptr) { + ElementType = Element; + if (Element) { + setHasType(); + Element->setIsReferencedType(); + } + } + + // Set the type for the element, handling template parameters. + void setGenericType(LVElement *Element); + + StringRef getTypeQualifiedName() const { + return ElementType ? ElementType->getQualifiedName() : ""; + } + + StringRef typeAsString() const; + std::string typeOffsetAsString() const; + std::string discriminatorAsString() const; + + LVScope *traverseParents(LVScopeGetFunction GetFunction) const; + + LVScope *getFunctionParent() const; + virtual LVScope *getCompileUnitParent() const; + + // Print any referenced element. + void printReference(raw_ostream &OS, bool Full, LVElement *Parent) const; + + // Print the linkage name (Symbols and functions). + void printLinkageName(raw_ostream &OS, bool Full, LVElement *Parent, + LVScope *Scope) const; + void printLinkageName(raw_ostream &OS, bool Full, LVElement *Parent) const; + + // Generate the full name for the Element. + void resolveFullname(LVElement *BaseType, StringRef Name = emptyString()); + + // Generate a name for unnamed elements. + void generateName(std::string &Prefix) const; + void generateName(); + + virtual bool removeElement(LVElement *Element) { return false; } + virtual void updateLevel(LVScope *Parent, bool Moved = false); + + // During the parsing of the debug information, the logical elements are + // created with information extracted from its description entries (DIE). + // But they are not complete for the logical view concept. A second pass + // is executed in order to collect their additional information. + // The following functions 'resolve' some of their properties, such as + // name, references, parents, extra information based on the element kind. + virtual void resolve(); + virtual void resolveExtra() {} + virtual void resolveName(); + virtual void resolveReferences() {} + void resolveParents(); + + bool referenceMatch(const LVElement *Element) const; + + // Returns true if current element is logically equal to the given 'Element'. + bool equals(const LVElement *Element) const; + + // Report the current element as missing or added during comparison. + virtual void report(LVComparePass Pass) {} + + static LVElementDispatch &getDispatch() { return Dispatch; } +}; + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVELEMENT_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVLine.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVLine.h new file mode 100644 index 0000000000..4716a17c03 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVLine.h @@ -0,0 +1,175 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVLine.h ------------------------------------------------*- C++ -*-===// +// +// 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 file defines the LVLine class, which is used to describe a debug +// information line. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVLINE_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVLINE_H + +#include "llvm/DebugInfo/LogicalView/Core/LVElement.h" + +namespace llvm { +namespace logicalview { + +enum class LVLineKind { + IsBasicBlock, + IsDiscriminator, + IsEndSequence, + IsEpilogueBegin, + IsLineDebug, + IsLineAssembler, + IsNewStatement, // Shared with CodeView 'IsStatement' flag. + IsPrologueEnd, + IsAlwaysStepInto, // CodeView + IsNeverStepInto, // CodeView + LastEntry +}; +using LVLineKindSet = std::set<LVLineKind>; +using LVLineDispatch = std::map<LVLineKind, LVLineGetFunction>; +using LVLineRequest = std::vector<LVLineGetFunction>; + +// Class to represent a logical line. +class LVLine : public LVElement { + // Typed bitvector with kinds for this line. + LVProperties<LVLineKind> Kinds; + static LVLineDispatch Dispatch; + + // Find the current line in the given 'Targets'. + LVLine *findIn(const LVLines *Targets) const; + +public: + LVLine() : LVElement(LVSubclassID::LV_LINE) { + setIsLine(); + setIncludeInPrint(); + } + LVLine(const LVLine &) = delete; + LVLine &operator=(const LVLine &) = delete; + virtual ~LVLine() = default; + + static bool classof(const LVElement *Element) { + return Element->getSubclassID() == LVSubclassID::LV_LINE; + } + + KIND(LVLineKind, IsBasicBlock); + KIND(LVLineKind, IsDiscriminator); + KIND(LVLineKind, IsEndSequence); + KIND(LVLineKind, IsEpilogueBegin); + KIND(LVLineKind, IsLineDebug); + KIND(LVLineKind, IsLineAssembler); + KIND(LVLineKind, IsNewStatement); + KIND(LVLineKind, IsPrologueEnd); + KIND(LVLineKind, IsAlwaysStepInto); + KIND(LVLineKind, IsNeverStepInto); + + const char *kind() const override; + + // Use the offset to store the line address. + uint64_t getAddress() const { return getOffset(); } + void setAddress(uint64_t address) { setOffset(address); } + + // String used for printing objects with no line number. + std::string noLineAsString(bool ShowZero = false) const override; + + // Line number for display; in the case of Inlined Functions, we use the + // DW_AT_call_line attribute; otherwise use DW_AT_decl_line attribute. + std::string lineNumberAsString(bool ShowZero = false) const override { + return lineAsString(getLineNumber(), getDiscriminator(), ShowZero); + } + + static LVLineDispatch &getDispatch() { return Dispatch; } + + // Iterate through the 'References' set and check that all its elements + // are present in the 'Targets' set. For a missing element, mark its + // parents as missing. + static void markMissingParents(const LVLines *References, + const LVLines *Targets); + + // Returns true if current line is logically equal to the given 'Line'. + virtual bool equals(const LVLine *Line) const; + + // Returns true if the given 'References' are logically equal to the + // given 'Targets'. + static bool equals(const LVLines *References, const LVLines *Targets); + + // Report the current line as missing or added during comparison. + void report(LVComparePass Pass) override; + + void print(raw_ostream &OS, bool Full = true) const override; + void printExtra(raw_ostream &OS, bool Full = true) const override {} + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const override { print(dbgs()); } +#endif +}; + +// Class to represent a DWARF line record object. +class LVLineDebug final : public LVLine { + // Discriminator value (DW_LNE_set_discriminator). The DWARF standard + // defines the discriminator as an unsigned LEB128 integer. + uint32_t Discriminator = 0; + +public: + LVLineDebug() : LVLine() { setIsLineDebug(); } + LVLineDebug(const LVLineDebug &) = delete; + LVLineDebug &operator=(const LVLineDebug &) = delete; + ~LVLineDebug() = default; + + // Additional line information. It includes attributes that describes + // states in the machine instructions (basic block, end prologue, etc). + std::string statesInfo(bool Formatted) const; + + // Access DW_LNE_set_discriminator attribute. + uint32_t getDiscriminator() const override { return Discriminator; } + void setDiscriminator(uint32_t Value) override { + Discriminator = Value; + setIsDiscriminator(); + } + + // Returns true if current line is logically equal to the given 'Line'. + bool equals(const LVLine *Line) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +// Class to represent an assembler line extracted from the text section. +class LVLineAssembler final : public LVLine { +public: + LVLineAssembler() : LVLine() { setIsLineAssembler(); } + LVLineAssembler(const LVLineAssembler &) = delete; + LVLineAssembler &operator=(const LVLineAssembler &) = delete; + ~LVLineAssembler() = default; + + // Print blanks as the line number. + std::string noLineAsString(bool ShowZero) const override { + return std::string(8, ' '); + }; + + // Returns true if current line is logically equal to the given 'Line'. + bool equals(const LVLine *Line) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVLINE_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h new file mode 100644 index 0000000000..40f7ac0f59 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h @@ -0,0 +1,208 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVLocation.h --------------------------------------------*- C++ -*-===// +// +// 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 file defines the LVOperation and LVLocation classes, which are used +// to describe variable locations. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVLOCATION_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVLOCATION_H + +#include "llvm/DebugInfo/LogicalView/Core/LVObject.h" + +namespace llvm { +namespace logicalview { + +using LVLineRange = std::pair<LVLine *, LVLine *>; + +// The DW_AT_data_member_location attribute is a simple member offset. +const LVSmall LVLocationMemberOffset = 0; + +class LVOperation final { + // To describe an operation: + // OpCode + // Operands[0]: First operand. + // Operands[1]: Second operand. + // OP_bregx, OP_bit_piece, OP_[GNU_]const_type, + // OP_[GNU_]deref_type, OP_[GNU_]entry_value, OP_implicit_value, + // OP_[GNU_]implicit_pointer, OP_[GNU_]regval_type, OP_xderef_type. + LVSmall Opcode = 0; + uint64_t Operands[2]; + +public: + LVOperation() = delete; + LVOperation(LVSmall Opcode, LVUnsigned Operand1, LVUnsigned Operand2) + : Opcode(Opcode) { + Operands[0] = Operand1; + Operands[1] = Operand2; + } + LVOperation(const LVOperation &) = delete; + LVOperation &operator=(const LVOperation &) = delete; + ~LVOperation() = default; + + LVSmall getOpcode() const { return Opcode; } + uint64_t getOperand1() const { return Operands[0]; } + uint64_t getOperand2() const { return Operands[1]; } + std::string getOperandsDWARFInfo(); + std::string getOperandsCodeViewInfo(); + + void print(raw_ostream &OS, bool Full = true) const; + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() { print(dbgs()); } +#endif +}; + +class LVLocation : public LVObject { + enum class Property { + IsAddressRange, + IsBaseClassOffset, + IsBaseClassStep, + IsClassOffset, + IsFixedAddress, + IsLocationSimple, + IsGapEntry, + IsOperation, + IsOperationList, + IsRegister, + IsStackOffset, + IsDiscardedRange, + IsInvalidRange, + IsInvalidLower, + IsInvalidUpper, + IsCallSite, + LastEntry + }; + // Typed bitvector with properties for this location. + LVProperties<Property> Properties; + + // True if the location it is associated with a debug range. + bool hasAssociatedRange() const { + return !getIsClassOffset() && !getIsDiscardedRange(); + } + +protected: + // Line numbers associated with locations ranges. + LVLine *LowerLine = nullptr; + LVLine *UpperLine = nullptr; + + // Active range: + // LowPC: an offset from an applicable base address, not a PC value. + // HighPC: an offset from an applicable base address, or a length. + LVAddress LowPC = 0; + LVAddress HighPC = 0; + + void setKind(); + +public: + LVLocation() : LVObject() { setIsLocation(); } + LVLocation(const LVLocation &) = delete; + LVLocation &operator=(const LVLocation &) = delete; + virtual ~LVLocation() = default; + + PROPERTY(Property, IsAddressRange); + PROPERTY(Property, IsBaseClassOffset); + PROPERTY(Property, IsBaseClassStep); + PROPERTY_1(Property, IsClassOffset, IsLocationSimple); + PROPERTY_1(Property, IsFixedAddress, IsLocationSimple); + PROPERTY(Property, IsLocationSimple); + PROPERTY(Property, IsGapEntry); + PROPERTY(Property, IsOperationList); + PROPERTY(Property, IsOperation); + PROPERTY(Property, IsRegister); + PROPERTY_1(Property, IsStackOffset, IsLocationSimple); + PROPERTY(Property, IsDiscardedRange); + PROPERTY(Property, IsInvalidRange); + PROPERTY(Property, IsInvalidLower); + PROPERTY(Property, IsInvalidUpper); + PROPERTY(Property, IsCallSite); + + const char *kind() const override; + // Mark the locations that have only DW_OP_fbreg as stack offset based. + virtual void updateKind() {} + + // Line numbers for locations. + const LVLine *getLowerLine() const { return LowerLine; } + void setLowerLine(LVLine *Line) { LowerLine = Line; } + const LVLine *getUpperLine() const { return UpperLine; } + void setUpperLine(LVLine *Line) { UpperLine = Line; } + + // Addresses for locations. + LVAddress getLowerAddress() const override { return LowPC; } + void setLowerAddress(LVAddress Address) override { LowPC = Address; } + LVAddress getUpperAddress() const override { return HighPC; } + void setUpperAddress(LVAddress Address) override { HighPC = Address; } + + std::string getIntervalInfo() const; + + bool validateRanges(); + + // In order to calculate a symbol coverage (percentage), take the ranges + // and obtain the number of units (bytes) covered by those ranges. We can't + // use the line numbers, because they can be zero or invalid. + // We return: + // false: No locations or multiple locations. + // true: a single location. + static bool calculateCoverage(LVLocations *Locations, unsigned &Factor, + float &Percentage); + + virtual void addObject(LVAddress LowPC, LVAddress HighPC, + LVUnsigned SectionOffset, uint64_t LocDescOffset) {} + virtual void addObject(LVSmall Opcode, LVUnsigned Operand1, + LVUnsigned Operand2) {} + + static void print(LVLocations *Locations, raw_ostream &OS, bool Full = true); + void printInterval(raw_ostream &OS, bool Full = true) const; + void printRaw(raw_ostream &OS, bool Full = true) const; + virtual void printRawExtra(raw_ostream &OS, bool Full = true) const {} + + void print(raw_ostream &OS, bool Full = true) const override; + void printExtra(raw_ostream &OS, bool Full = true) const override; + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const override { print(dbgs()); } +#endif +}; + +class LVLocationSymbol final : public LVLocation { + // Location descriptors for the active range. + LVAutoOperations *Entries = nullptr; + + void updateKind() override; + +public: + LVLocationSymbol() : LVLocation() {} + LVLocationSymbol(const LVLocationSymbol &) = delete; + LVLocationSymbol &operator=(const LVLocationSymbol &) = delete; + ~LVLocationSymbol() { delete Entries; }; + + void addObject(LVAddress LowPC, LVAddress HighPC, LVUnsigned SectionOffset, + uint64_t LocDescOffset) override; + void addObject(LVSmall Opcode, LVUnsigned Operand1, + LVUnsigned Operand2) override; + + void printRawExtra(raw_ostream &OS, bool Full = true) const override; + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVLOCATION_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVObject.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVObject.h new file mode 100644 index 0000000000..8af2e4da50 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVObject.h @@ -0,0 +1,361 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVObject.h ----------------------------------------------*- C++ -*-===// +// +// 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 file defines the LVObject class, which is used to describe a debug +// information object. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVOBJECT_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVOBJECT_H + +#include "llvm/BinaryFormat/Dwarf.h" +#include "llvm/DebugInfo/CodeView/CodeView.h" +#include "llvm/DebugInfo/CodeView/TypeIndex.h" +#include "llvm/DebugInfo/LogicalView/Core/LVSupport.h" +#include <limits> +#include <list> +#include <map> +#include <string> + +namespace llvm { +namespace dwarf { +// Support for CodeView ModifierOptions::Unaligned. +constexpr Tag DW_TAG_unaligned = Tag(dwarf::DW_TAG_hi_user + 1); +} // namespace dwarf +} // namespace llvm + +namespace llvm { +namespace logicalview { + +using LVSectionIndex = uint64_t; +using LVAddress = uint64_t; +using LVHalf = uint16_t; +using LVLevel = uint32_t; +using LVOffset = uint64_t; +using LVSigned = int64_t; +using LVUnsigned = uint64_t; +using LVSmall = uint8_t; + +class LVElement; +class LVLine; +class LVLocation; +class LVLocationSymbol; +class LVObject; +class LVOperation; +class LVScope; +class LVSymbol; +class LVType; + +class LVOptions; +class LVPatterns; + +StringRef typeNone(); +StringRef typeVoid(); +StringRef typeInt(); +StringRef typeUnknown(); +StringRef emptyString(); + +using LVElementSetFunction = void (LVElement::*)(); +using LVElementGetFunction = bool (LVElement::*)() const; +using LVLineSetFunction = void (LVLine::*)(); +using LVLineGetFunction = bool (LVLine::*)() const; +using LVObjectSetFunction = void (LVObject::*)(); +using LVObjectGetFunction = bool (LVObject::*)() const; +using LVScopeSetFunction = void (LVScope::*)(); +using LVScopeGetFunction = bool (LVScope::*)() const; +using LVSymbolSetFunction = void (LVSymbol::*)(); +using LVSymbolGetFunction = bool (LVSymbol::*)() const; +using LVTypeSetFunction = void (LVType::*)(); +using LVTypeGetFunction = bool (LVType::*)() const; + +// The LVScope class represents a logical scope and uses vectors to store its +// children, which are pointers to other allocated logical elements (types, +// symbols, lines, scopes, ranges). On destruction, we have to traverse each +// vector and destroy its elements. The other case is LVSymbol. +// These definitions are intended to be used by the LVScope and LVSymbol +// to support automatic vector cleanup. +using LVAutoLines = LVAutoSmallVector<LVLine *>; +using LVAutoLocations = LVAutoSmallVector<LVLocation *>; +using LVAutoOperations = LVAutoSmallVector<LVOperation *, 8>; +using LVAutoScopes = LVAutoSmallVector<LVScope *>; +using LVAutoSymbols = LVAutoSmallVector<LVSymbol *>; +using LVAutoTypes = LVAutoSmallVector<LVType *>; + +// These definitions are intended to be used when the vector will be used +// just a container, with no automatic destruction. +using LVElements = SmallVector<LVElement *, 8>; +using LVLines = SmallVector<LVLine *, 8>; +using LVLocations = SmallVector<LVLocation *, 8>; +using LVOperations = SmallVector<LVOperation *, 8>; +using LVScopes = SmallVector<LVScope *, 8>; +using LVSymbols = SmallVector<LVSymbol *, 8>; +using LVTypes = SmallVector<LVType *, 8>; + +using LVOffsets = SmallVector<LVOffset, 8>; + +const LVAddress MaxAddress = std::numeric_limits<uint64_t>::max(); + +enum class LVBinaryType { NONE, ELF, COFF }; +enum class LVComparePass { Missing, Added }; + +// Validate functions. +using LVValidLocation = bool (LVLocation::*)(); + +// Keep counters of objects. +struct LVCounter { + unsigned Lines = 0; + unsigned Scopes = 0; + unsigned Symbols = 0; + unsigned Types = 0; + void reset() { + Lines = 0; + Scopes = 0; + Symbols = 0; + Types = 0; + } +}; + +class LVObject { + enum class Property { + IsLocation, // Location. + IsGlobalReference, // This object is being referenced from another CU. + IsGeneratedName, // The Object name was generated. + IsResolved, // Object has been resolved. + IsResolvedName, // Object name has been resolved. + IsDiscarded, // Object has been stripped by the linker. + IsOptimized, // Object has been optimized by the compiler. + IsAdded, // Object has been 'added'. + IsMatched, // Object has been matched to a given pattern. + IsMissing, // Object is 'missing'. + IsMissingLink, // Object is indirectly 'missing'. + IsInCompare, // In 'compare' mode. + IsFileFromReference, // File ID from specification. + IsLineFromReference, // Line No from specification. + HasMoved, // The object was moved from 'target' to 'reference'. + HasPattern, // The object has a pattern. + IsFinalized, // CodeView object is finalized. + IsReferenced, // CodeView object being referenced. + HasCodeViewLocation, // CodeView object with debug location. + LastEntry + }; + // Typed bitvector with properties for this object. + LVProperties<Property> Properties; + + LVOffset Offset = 0; + uint32_t LineNumber = 0; + LVLevel ScopeLevel = 0; + union { + dwarf::Tag Tag; + dwarf::Attribute Attr; + LVSmall Opcode; + } TagAttrOpcode = {dwarf::DW_TAG_null}; + + // The parent of this object (nullptr if the root scope). For locations, + // the parent is a symbol object; otherwise it is a scope object. + union { + LVElement *Element; + LVScope *Scope; + LVSymbol *Symbol; + } Parent = {nullptr}; + + // We do not support any object duplication, as they are created by parsing + // the debug information. There is only the case where we need a very basic + // object, to manipulate its offset, line number and scope level. Allow the + // copy constructor to create that object; it is used to print a reference + // to another object and in the case of templates, to print its encoded args. + LVObject(const LVObject &Object) { +#ifndef NDEBUG + incID(); +#endif + Properties = Object.Properties; + Offset = Object.Offset; + LineNumber = Object.LineNumber; + ScopeLevel = Object.ScopeLevel; + TagAttrOpcode = Object.TagAttrOpcode; + Parent = Object.Parent; + } + +#ifndef NDEBUG + // This is an internal ID used for debugging logical elements. It is used + // for cases where an unique offset within the binary input file is not + // available. + static uint64_t GID; + uint64_t ID = 0; + + void incID() { + ++GID; + ID = GID; + } +#endif + +protected: + // Get a string representation for the given number and discriminator. + std::string lineAsString(uint32_t LineNumber, LVHalf Discriminator, + bool ShowZero) const; + + // Get a string representation for the given number. + std::string referenceAsString(uint32_t LineNumber, bool Spaces) const; + + // Print the Filename or Pathname. + // Empty implementation for those objects that do not have any user + // source file references, such as debug locations. + virtual void printFileIndex(raw_ostream &OS, bool Full = true) const {} + +public: + LVObject() { +#ifndef NDEBUG + incID(); +#endif + }; + LVObject &operator=(const LVObject &) = delete; + virtual ~LVObject() = default; + + PROPERTY(Property, IsLocation); + PROPERTY(Property, IsGlobalReference); + PROPERTY(Property, IsGeneratedName); + PROPERTY(Property, IsResolved); + PROPERTY(Property, IsResolvedName); + PROPERTY(Property, IsDiscarded); + PROPERTY(Property, IsOptimized); + PROPERTY(Property, IsAdded); + PROPERTY(Property, IsMatched); + PROPERTY(Property, IsMissing); + PROPERTY(Property, IsMissingLink); + PROPERTY(Property, IsInCompare); + PROPERTY(Property, IsFileFromReference); + PROPERTY(Property, IsLineFromReference); + PROPERTY(Property, HasMoved); + PROPERTY(Property, HasPattern); + PROPERTY(Property, IsFinalized); + PROPERTY(Property, IsReferenced); + PROPERTY(Property, HasCodeViewLocation); + + // True if the scope has been named or typed or with line number. + virtual bool isNamed() const { return false; } + virtual bool isTyped() const { return false; } + virtual bool isFiled() const { return false; } + bool isLined() const { return LineNumber != 0; } + + // DWARF tag, attribute or expression opcode. + dwarf::Tag getTag() const { return TagAttrOpcode.Tag; } + void setTag(dwarf::Tag Tag) { TagAttrOpcode.Tag = Tag; } + dwarf::Attribute getAttr() const { return TagAttrOpcode.Attr; } + void setAttr(dwarf::Attribute Attr) { TagAttrOpcode.Attr = Attr; } + LVSmall getOpcode() const { return TagAttrOpcode.Opcode; } + void setOpcode(LVSmall Opcode) { TagAttrOpcode.Opcode = Opcode; } + + // DIE offset. + LVOffset getOffset() const { return Offset; } + void setOffset(LVOffset DieOffset) { Offset = DieOffset; } + + // Level where this object is located. + LVLevel getLevel() const { return ScopeLevel; } + void setLevel(LVLevel Level) { ScopeLevel = Level; } + + virtual StringRef getName() const { return StringRef(); } + virtual void setName(StringRef ObjectName) {} + + LVElement *getParent() const { + assert((!Parent.Element || + (Parent.Element && static_cast<LVElement *>(Parent.Element))) && + "Invalid element"); + return Parent.Element; + } + LVScope *getParentScope() const { + assert((!Parent.Scope || + (Parent.Scope && static_cast<LVScope *>(Parent.Scope))) && + "Invalid scope"); + return Parent.Scope; + } + LVSymbol *getParentSymbol() const { + assert((!Parent.Symbol || + (Parent.Symbol && static_cast<LVSymbol *>(Parent.Symbol))) && + "Invalid symbol"); + return Parent.Symbol; + } + void setParent(LVScope *Scope); + void setParent(LVSymbol *Symbol); + void resetParent() { Parent = {nullptr}; } + + virtual LVAddress getLowerAddress() const { return 0; } + virtual void setLowerAddress(LVAddress Address) {} + virtual LVAddress getUpperAddress() const { return 0; } + virtual void setUpperAddress(LVAddress Address) {} + + uint32_t getLineNumber() const { return LineNumber; } + void setLineNumber(uint32_t Number) { LineNumber = Number; } + + virtual const char *kind() const { return nullptr; } + + std::string indentAsString() const; + std::string indentAsString(LVLevel Level) const; + + // String used as padding for printing objects with no line number. + virtual std::string noLineAsString(bool ShowZero) const; + + // Line number for display; in the case of inlined functions, we use the + // DW_AT_call_line attribute; otherwise use DW_AT_decl_line attribute. + virtual std::string lineNumberAsString(bool ShowZero = false) const { + return lineAsString(getLineNumber(), 0, ShowZero); + } + std::string lineNumberAsStringStripped(bool ShowZero = false) const; + + // This function prints the logical view to an output stream. + // Split: Prints the compilation unit view to a file. + // Match: Prints the object only if it satisfies the patterns collected + // from the command line. See the '--select' option. + // Print: Print the object only if satisfies the conditions specified by + // the different '--print' options. + // Full: Prints full information for objects representing debug locations, + // aggregated scopes, compile unit, functions and namespaces. + virtual Error doPrint(bool Split, bool Match, bool Print, raw_ostream &OS, + bool Full = true) const; + void printAttributes(raw_ostream &OS, bool Full = true) const; + void printAttributes(raw_ostream &OS, bool Full, StringRef Name, + LVObject *Parent, StringRef Value, + bool UseQuotes = false, bool PrintRef = false) const; + + // Mark branch as missing (current element and parents). + void markBranchAsMissing(); + + // Prints the common information for an object (name, type, etc). + virtual void print(raw_ostream &OS, bool Full = true) const; + // Prints additional information for an object, depending on its kind + // (class attributes, debug ranges, files, directories, etc). + virtual void printExtra(raw_ostream &OS, bool Full = true) const {} + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + virtual void dump() const { print(dbgs()); } +#endif + + uint64_t getID() const { + return +#ifndef NDEBUG + ID; +#else + 0; +#endif + } +}; + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVOBJECT_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h new file mode 100644 index 0000000000..ad0e0592ac --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h @@ -0,0 +1,656 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVOptions.h ---------------------------------------------*- C++ -*-===// +// +// 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 file defines the LVOptions class, which is used to record the command +// line options. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVOPTIONS_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVOPTIONS_H + +#include "llvm/ADT/StringSet.h" +#include "llvm/DebugInfo/LogicalView/Core/LVLine.h" +#include "llvm/DebugInfo/LogicalView/Core/LVScope.h" +#include "llvm/DebugInfo/LogicalView/Core/LVSymbol.h" +#include "llvm/DebugInfo/LogicalView/Core/LVType.h" +#include "llvm/Support/Regex.h" +#include <set> +#include <string> + +namespace llvm { +namespace logicalview { + +// Generate get and set 'bool' functions. +#define BOOL_FUNCTION(FAMILY, FIELD) \ + bool get##FAMILY##FIELD() const { return FAMILY.FIELD; } \ + void set##FAMILY##FIELD() { FAMILY.FIELD = true; } \ + void reset##FAMILY##FIELD() { FAMILY.FIELD = false; } + +// Generate get and set 'unsigned' functions. +#define UNSIGNED_FUNCTION(FAMILY, FIELD) \ + unsigned get##FAMILY##FIELD() const { return FAMILY.FIELD; } \ + void set##FAMILY##FIELD(unsigned Value) { FAMILY.FIELD = Value; } \ + void reset##FAMILY##FIELD() { FAMILY.FIELD = -1U; } + +// Generate get and set 'std::string' functions. +#define STD_STRING_FUNCTION(FAMILY, FIELD) \ + std::string get##FAMILY##FIELD() const { return FAMILY.FIELD; } \ + void set##FAMILY##FIELD(std::string FIELD) { FAMILY.FIELD = FIELD; } \ + void reset##FAMILY##FIELD() { FAMILY.FIELD = ""; } + +// Generate get and set 'std::set' functions. +#define STDSET_FUNCTION_4(FAMILY, FIELD, TYPE, SET) \ + bool get##FAMILY##FIELD() const { \ + return FAMILY.SET.find(TYPE::FIELD) != FAMILY.SET.end(); \ + } \ + void set##FAMILY##FIELD() { FAMILY.SET.insert(TYPE::FIELD); } \ + void reset##FAMILY##FIELD() { \ + std::set<TYPE>::iterator Iter = FAMILY.SET.find(TYPE::FIELD); \ + if (Iter != FAMILY.SET.end()) \ + FAMILY.SET.erase(Iter); \ + } + +#define STDSET_FUNCTION_5(FAMILY, FIELD, ENTRY, TYPE, SET) \ + bool get##FAMILY##FIELD##ENTRY() const { \ + return FAMILY.SET.find(TYPE::ENTRY) != FAMILY.SET.end(); \ + } \ + void set##FAMILY##FIELD##ENTRY() { FAMILY.SET.insert(TYPE::ENTRY); } + +// Generate get and set functions for '--attribute' +#define ATTRIBUTE_OPTION(FIELD) \ + STDSET_FUNCTION_4(Attribute, FIELD, LVAttributeKind, Kinds) + +// Generate get and set functions for '--output' +#define OUTPUT_OPTION(FIELD) \ + STDSET_FUNCTION_4(Output, FIELD, LVOutputKind, Kinds) + +// Generate get and set functions for '--print' +#define PRINT_OPTION(FIELD) STDSET_FUNCTION_4(Print, FIELD, LVPrintKind, Kinds) + +// Generate get and set functions for '--warning' +#define WARNING_OPTION(FIELD) \ + STDSET_FUNCTION_4(Warning, FIELD, LVWarningKind, Kinds) + +// Generate get and set functions for '--compare' +#define COMPARE_OPTION(FIELD) \ + STDSET_FUNCTION_4(Compare, FIELD, LVCompareKind, Elements) + +// Generate get and set functions for '--report' +#define REPORT_OPTION(FIELD) \ + STDSET_FUNCTION_4(Report, FIELD, LVReportKind, Kinds) + +// Generate get and set functions for '--internal' +#define INTERNAL_OPTION(FIELD) \ + STDSET_FUNCTION_4(Internal, FIELD, LVInternalKind, Kinds) + +using LVOffsetSet = std::set<uint64_t>; + +enum class LVAttributeKind { + All, // --attribute=all + Argument, // --attribute=argument + Base, // --attribute=base + Coverage, // --attribute=coverage + Directories, // --attribute=directories + Discarded, // --attribute=discarded + Discriminator, // --attribute=discriminator + Encoded, // --attribute=encoded + Extended, // --attribute=extended + Filename, // --attribute=filename + Files, // --attribute=files + Format, // --attribute=format + Gaps, // --attribute=gaps + Generated, // --attribute=generated + Global, // --attribute=global + Inserted, // --attribute=inserted + Level, // --attribute=level + Linkage, // --attribute=linkage + Local, // --attribute=local + Location, // --attribute=location + Offset, // --attribute=offset + Pathname, // --attribute=pathname + Producer, // --attribute=producer + Publics, // --attribute=publics + Qualified, // --attribute=qualified + Qualifier, // --attribute=qualifier + Range, // --attribute=range + Reference, // --attribute=reference + Register, // --attribute=register + Standard, // --attribute=standard + Subrange, // --attribute=subrange + System, // --attribute=system + Typename, // --attribute=typename + Underlying, // --attribute=underlying + Zero // --attribute=zero +}; +using LVAttributeKindSet = std::set<LVAttributeKind>; + +enum class LVCompareKind { + All, // --compare=all + Lines, // --compare=lines + Scopes, // --compare=scopes + Symbols, // --compare=symbols + Types // --compare=types +}; +using LVCompareKindSet = std::set<LVCompareKind>; + +enum class LVOutputKind { + All, // --output=all + Split, // --output=split + Json, // --output=json + Text // --output=text +}; +using LVOutputKindSet = std::set<LVOutputKind>; + +enum class LVPrintKind { + All, // --print=all + Elements, // --print=elements + Instructions, // --print=instructions + Lines, // --print=lines + Scopes, // --print=scopes + Sizes, // --print=sizes + Symbols, // --print=symbols + Summary, // --print=summary + Types, // --print=types + Warnings // --print=warnings +}; +using LVPrintKindSet = std::set<LVPrintKind>; + +enum class LVReportKind { + All, // --report=all + Children, // --report=children + List, // --report=list + Parents, // --report=parents + View // --report=view +}; +using LVReportKindSet = std::set<LVReportKind>; + +enum class LVWarningKind { + All, // --warning=all + Coverages, // --warning=coverages + Lines, // --warning=lines + Locations, // --warning=locations + Ranges // --warning=ranges +}; +using LVWarningKindSet = std::set<LVWarningKind>; + +enum class LVInternalKind { + All, // --internal=all + Cmdline, // --internal=cmdline + ID, // --internal=id + Integrity, // --internal=integrity + None, // --internal=none + Tag // --internal=tag +}; +using LVInternalKindSet = std::set<LVInternalKind>; + +// The 'Kinds' members are a one-to-one mapping to the associated command +// options that supports comma separated values. There are other 'bool' +// members that in very few cases point to a command option (see associated +// comment). Other cases for 'bool' refers to internal values derivated from +// the command options. +class LVOptions { + class LVAttribute { + public: + LVAttributeKindSet Kinds; // --attribute=<Kind> + bool Added = false; // Added elements found during comparison. + bool AnyLocation = false; // Any kind of location information. + bool AnySource = false; // Any kind of source information. + bool Missing = false; // Missing elements found during comparison. + }; + + class LVCompare { + public: + LVCompareKindSet Elements; // --compare=<kind> + bool Context = false; // --compare-context + bool Execute = false; // Compare requested. + bool Print = false; // Enable any printing. + }; + + class LVPrint { + public: + LVPrintKindSet Kinds; // --print=<Kind> + bool AnyElement = false; // Request to print any element. + bool AnyLine = false; // Print 'lines' or 'instructions'. + bool Execute = false; // Print requested. + bool Formatting = true; // Disable formatting during printing. + bool Offset = false; // Print offsets while formatting is disabled. + bool SizesSummary = false; // Print 'sizes' or 'summary'. + }; + + class LVReport { + public: + LVReportKindSet Kinds; // --report=<kind> + bool AnyView = false; // View, Parents or Children. + bool Execute = false; // Report requested. + }; + + class LVSelect { + public: + bool IgnoreCase = false; // --select-ignore-case + bool UseRegex = false; // --select-use-regex + bool Execute = false; // Select requested. + bool GenericKind = false; // We have collected generic kinds. + bool GenericPattern = false; // We have collected generic patterns. + bool OffsetPattern = false; // We have collected offset patterns. + StringSet<> Generic; // --select=<Pattern> + LVOffsetSet Offsets; // --select-offset=<Offset> + LVElementKindSet Elements; // --select-elements=<Kind> + LVLineKindSet Lines; // --select-lines=<Kind> + LVScopeKindSet Scopes; // --select-scopes=<Kind> + LVSymbolKindSet Symbols; // --select-symbols=<Kind> + LVTypeKindSelection Types; // --select-types=<Kind> + }; + + class LVOutput { + public: + LVOutputKindSet Kinds; // --output=<kind> + LVSortMode SortMode = LVSortMode::None; // --output-sort=<SortMode> + std::string Folder; // --output-folder=<Folder> + unsigned Level = -1U; // --output-level=<level> + }; + + class LVWarning { + public: + LVWarningKindSet Kinds; // --warning=<Kind> + }; + + class LVInternal { + public: + LVInternalKindSet Kinds; // --internal=<Kind> + }; + + class LVGeneral { + public: + bool CollectRanges = false; // Collect ranges information. + }; + + // Filters the output of the filename associated with the element being + // printed in order to see clearly which logical elements belongs to + // a particular filename. It is value is reset after the element + // that represents the Compile Unit is printed. + size_t LastFilenameIndex = 0; + + // Controls the amount of additional spaces to insert when printing + // object attributes, in order to get a consistent printing layout. + size_t IndentationSize = 0; + + // Calculate the indentation size, so we can use that value when printing + // additional attributes to objects, such as location. + void calculateIndentationSize(); + +public: + void resetFilenameIndex() { LastFilenameIndex = 0; } + bool changeFilenameIndex(size_t Index) { + bool IndexChanged = (Index != LastFilenameIndex); + if (IndexChanged) + LastFilenameIndex = Index; + return IndexChanged; + } + + // Access to command line options, pattern and printing information. + static LVOptions *getOptions(); + static void setOptions(LVOptions *Options); + + LVOptions() = default; + LVOptions(const LVOptions &) = default; + LVOptions &operator=(const LVOptions &) = default; + ~LVOptions() = default; + + // Some command line options support shortcuts. For example: + // The command line option '--print=elements' is a shortcut for: + // '--print=instructions,lines,scopes,symbols,types'. + // In the case of logical view comparison, some options related to + // attributes must be set or reset for a proper comparison. + // Resolve any dependencies between command line options. + void resolveDependencies(); + size_t indentationSize() const { return IndentationSize; } + + LVAttribute Attribute; + LVCompare Compare; + LVOutput Output; + LVPrint Print; + LVReport Report; + LVSelect Select; + LVWarning Warning; + LVInternal Internal; + LVGeneral General; + + // --attribute. + ATTRIBUTE_OPTION(All); + ATTRIBUTE_OPTION(Argument); + ATTRIBUTE_OPTION(Base); + ATTRIBUTE_OPTION(Coverage); + ATTRIBUTE_OPTION(Directories); + ATTRIBUTE_OPTION(Discarded); + ATTRIBUTE_OPTION(Discriminator); + ATTRIBUTE_OPTION(Encoded); + ATTRIBUTE_OPTION(Extended); + ATTRIBUTE_OPTION(Filename); + ATTRIBUTE_OPTION(Files); + ATTRIBUTE_OPTION(Format); + ATTRIBUTE_OPTION(Gaps); + ATTRIBUTE_OPTION(Generated); + ATTRIBUTE_OPTION(Global); + ATTRIBUTE_OPTION(Inserted); + ATTRIBUTE_OPTION(Level); + ATTRIBUTE_OPTION(Linkage); + ATTRIBUTE_OPTION(Location); + ATTRIBUTE_OPTION(Local); + ATTRIBUTE_OPTION(Offset); + ATTRIBUTE_OPTION(Pathname); + ATTRIBUTE_OPTION(Producer); + ATTRIBUTE_OPTION(Publics); + ATTRIBUTE_OPTION(Qualified); + ATTRIBUTE_OPTION(Qualifier); + ATTRIBUTE_OPTION(Range); + ATTRIBUTE_OPTION(Reference); + ATTRIBUTE_OPTION(Register); + ATTRIBUTE_OPTION(Standard); + ATTRIBUTE_OPTION(Subrange); + ATTRIBUTE_OPTION(System); + ATTRIBUTE_OPTION(Typename); + ATTRIBUTE_OPTION(Underlying); + ATTRIBUTE_OPTION(Zero); + BOOL_FUNCTION(Attribute, Added); + BOOL_FUNCTION(Attribute, AnyLocation); + BOOL_FUNCTION(Attribute, AnySource); + BOOL_FUNCTION(Attribute, Missing); + + // --compare. + COMPARE_OPTION(All); + COMPARE_OPTION(Lines); + COMPARE_OPTION(Scopes); + COMPARE_OPTION(Symbols); + COMPARE_OPTION(Types); + BOOL_FUNCTION(Compare, Context); + BOOL_FUNCTION(Compare, Execute); + BOOL_FUNCTION(Compare, Print); + + // --output. + OUTPUT_OPTION(All); + OUTPUT_OPTION(Split); + OUTPUT_OPTION(Text); + OUTPUT_OPTION(Json); + STD_STRING_FUNCTION(Output, Folder); + UNSIGNED_FUNCTION(Output, Level); + LVSortMode getSortMode() const { return Output.SortMode; } + void setSortMode(LVSortMode SortMode) { Output.SortMode = SortMode; } + + // --print. + PRINT_OPTION(All); + PRINT_OPTION(Elements); + PRINT_OPTION(Instructions); + PRINT_OPTION(Lines); + PRINT_OPTION(Scopes); + PRINT_OPTION(Sizes); + PRINT_OPTION(Symbols); + PRINT_OPTION(Summary); + PRINT_OPTION(Types); + PRINT_OPTION(Warnings); + BOOL_FUNCTION(Print, AnyElement); + BOOL_FUNCTION(Print, AnyLine); + BOOL_FUNCTION(Print, Execute); + BOOL_FUNCTION(Print, Formatting); + BOOL_FUNCTION(Print, Offset); + BOOL_FUNCTION(Print, SizesSummary); + + // --report. + REPORT_OPTION(All); + REPORT_OPTION(Children); + REPORT_OPTION(List); + REPORT_OPTION(Parents); + REPORT_OPTION(View); + BOOL_FUNCTION(Report, AnyView); + BOOL_FUNCTION(Report, Execute); + + // --select. + BOOL_FUNCTION(Select, IgnoreCase); + BOOL_FUNCTION(Select, UseRegex); + BOOL_FUNCTION(Select, Execute); + BOOL_FUNCTION(Select, GenericKind); + BOOL_FUNCTION(Select, GenericPattern); + BOOL_FUNCTION(Select, OffsetPattern); + + // --warning. + WARNING_OPTION(All); + WARNING_OPTION(Coverages); + WARNING_OPTION(Lines); + WARNING_OPTION(Locations); + WARNING_OPTION(Ranges); + + // --internal. + INTERNAL_OPTION(All); + INTERNAL_OPTION(Cmdline); + INTERNAL_OPTION(ID); + INTERNAL_OPTION(Integrity); + INTERNAL_OPTION(None); + INTERNAL_OPTION(Tag); + + // General shortcuts to some combinations. + BOOL_FUNCTION(General, CollectRanges); + + void print(raw_ostream &OS) const; + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const { print(dbgs()); } +#endif +}; + +inline LVOptions &options() { return (*LVOptions::getOptions()); } +inline void setOptions(LVOptions *Options) { LVOptions::setOptions(Options); } + +class LVPatterns final { + // Pattern Mode. + enum class LVMatchMode { + None = 0, // No given pattern. + Match, // Perfect match. + NoCase, // Ignore case. + Regex // Regular expression. + }; + + // Keep the search pattern information. + struct LVMatch { + std::string Pattern; // Normal pattern. + std::shared_ptr<Regex> RE; // Regular Expression Pattern. + LVMatchMode Mode = LVMatchMode::None; // Match mode. + }; + + using LVMatchInfo = std::vector<LVMatch>; + LVMatchInfo GenericMatchInfo; + using LVMatchOffsets = std::vector<uint64_t>; + LVMatchOffsets OffsetMatchInfo; + + // Element selection. + LVElementDispatch ElementDispatch; + LVLineDispatch LineDispatch; + LVScopeDispatch ScopeDispatch; + LVSymbolDispatch SymbolDispatch; + LVTypeDispatch TypeDispatch; + + // Element selection request. + LVElementRequest ElementRequest; + LVLineRequest LineRequest; + LVScopeRequest ScopeRequest; + LVSymbolRequest SymbolRequest; + LVTypeRequest TypeRequest; + + // Check an element printing Request. + template <typename T, typename U> + bool checkElementRequest(const T *Element, const U &Requests) const { + assert(Element && "Element must not be nullptr"); + for (const auto &Request : Requests) + if ((Element->*Request)()) + return true; + // Check generic element requests. + for (const LVElementGetFunction &Request : ElementRequest) + if ((Element->*Request)()) + return true; + return false; + } + + // Add an element printing request based on its kind. + template <typename T, typename U, typename V> + void addRequest(const T &Selection, const U &Dispatch, V &Request) const { + for (const auto &Entry : Selection) { + // Find target function to fullfit request. + typename U::const_iterator Iter = Dispatch.find(Entry); + if (Iter != Dispatch.end()) + Request.push_back(Iter->second); + } + } + + void addElement(LVElement *Element); + + template <typename T, typename U> + void resolveGenericPatternMatch(T *Element, const U &Requests) { + assert(Element && "Element must not be nullptr"); + auto CheckPattern = [=]() -> bool { + return (Element->isNamed() && matchGenericPattern(Element->getName())) || + (Element->isTyped() && + matchGenericPattern(Element->getTypeName())); + }; + auto CheckOffset = [=]() -> bool { + return matchOffsetPattern(Element->getOffset()); + }; + if ((options().getSelectGenericPattern() && CheckPattern()) || + (options().getSelectOffsetPattern() && CheckOffset()) || + ((Requests.size() || ElementRequest.size()) && + checkElementRequest(Element, Requests))) + addElement(Element); + } + + template <typename U> + void resolveGenericPatternMatch(LVLine *Line, const U &Requests) { + assert(Line && "Line must not be nullptr"); + auto CheckPattern = [=]() -> bool { + return matchGenericPattern(Line->lineNumberAsStringStripped()) || + matchGenericPattern(Line->getName()) || + matchGenericPattern(Line->getPathname()); + }; + auto CheckOffset = [=]() -> bool { + return matchOffsetPattern(Line->getAddress()); + }; + if ((options().getSelectGenericPattern() && CheckPattern()) || + (options().getSelectOffsetPattern() && CheckOffset()) || + (Requests.size() && checkElementRequest(Line, Requests))) + addElement(Line); + } + + Error createMatchEntry(LVMatchInfo &Filters, StringRef Pattern, + bool IgnoreCase, bool UseRegex); + +public: + static LVPatterns *getPatterns(); + + LVPatterns() { + ElementDispatch = LVElement::getDispatch(); + LineDispatch = LVLine::getDispatch(); + ScopeDispatch = LVScope::getDispatch(); + SymbolDispatch = LVSymbol::getDispatch(); + TypeDispatch = LVType::getDispatch(); + } + LVPatterns(const LVPatterns &) = delete; + LVPatterns &operator=(const LVPatterns &) = delete; + ~LVPatterns() = default; + + // Clear any existing patterns. + void clear() { + GenericMatchInfo.clear(); + OffsetMatchInfo.clear(); + ElementRequest.clear(); + LineRequest.clear(); + ScopeRequest.clear(); + SymbolRequest.clear(); + TypeRequest.clear(); + + options().resetSelectGenericKind(); + options().resetSelectGenericPattern(); + options().resetSelectOffsetPattern(); + } + + void addRequest(LVElementKindSet &Selection) { + addRequest(Selection, ElementDispatch, ElementRequest); + } + void addRequest(LVLineKindSet &Selection) { + addRequest(Selection, LineDispatch, LineRequest); + } + void addRequest(LVScopeKindSet &Selection) { + addRequest(Selection, ScopeDispatch, ScopeRequest); + } + void addRequest(LVSymbolKindSet &Selection) { + addRequest(Selection, SymbolDispatch, SymbolRequest); + } + void addRequest(LVTypeKindSelection &Selection) { + addRequest(Selection, TypeDispatch, TypeRequest); + } + + void updateReportOptions(); + + bool matchPattern(StringRef Input, const LVMatchInfo &MatchInfo); + // Match a pattern (--select='pattern'). + bool matchGenericPattern(StringRef Input) { + return matchPattern(Input, GenericMatchInfo); + } + bool matchOffsetPattern(LVOffset Offset) { + return llvm::is_contained(OffsetMatchInfo, Offset); + } + + void resolvePatternMatch(LVLine *Line) { + resolveGenericPatternMatch(Line, LineRequest); + } + + void resolvePatternMatch(LVScope *Scope) { + resolveGenericPatternMatch(Scope, ScopeRequest); + } + + void resolvePatternMatch(LVSymbol *Symbol) { + resolveGenericPatternMatch(Symbol, SymbolRequest); + } + + void resolvePatternMatch(LVType *Type) { + resolveGenericPatternMatch(Type, TypeRequest); + } + + void addPatterns(StringSet<> &Patterns, LVMatchInfo &Filters); + + // Add generic and offset patterns info. + void addGenericPatterns(StringSet<> &Patterns); + void addOffsetPatterns(const LVOffsetSet &Patterns); + + // Conditions to print an object. + bool printElement(const LVLine *Line) const; + bool printObject(const LVLocation *Location) const; + bool printElement(const LVScope *Scope) const; + bool printElement(const LVSymbol *Symbol) const; + bool printElement(const LVType *Type) const; + + void print(raw_ostream &OS) const; + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const { print(dbgs()); } +#endif +}; + +inline LVPatterns &patterns() { return *LVPatterns::getPatterns(); } + +} // namespace logicalview +} // namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVOPTIONS_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVRange.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVRange.h new file mode 100644 index 0000000000..3183fd0da7 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVRange.h @@ -0,0 +1,109 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVRange.h -----------------------------------------------*- C++ -*-===// +// +// 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 file defines the LVRange class, which is used to describe a debug +// information range. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVRANGE_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVRANGE_H + +#include "llvm/ADT/IntervalTree.h" +#include "llvm/DebugInfo/LogicalView/Core/LVObject.h" + +namespace llvm { +namespace logicalview { + +using LVAddressRange = std::pair<LVAddress, LVAddress>; + +class LVRangeEntry final { + LVAddress Lower = 0; + LVAddress Upper = 0; + LVScope *Scope = nullptr; + +public: + using RangeType = LVAddress; + + LVRangeEntry() = delete; + LVRangeEntry(LVAddress LowerAddress, LVAddress UpperAddress, LVScope *Scope) + : Lower(LowerAddress), Upper(UpperAddress), Scope(Scope) {} + + RangeType lower() const { return Lower; } + RangeType upper() const { return Upper; } + LVAddressRange addressRange() const { + return LVAddressRange(lower(), upper()); + } + LVScope *scope() const { return Scope; } +}; + +// Class to represent a list of range addresses associated with a +// scope; the addresses are stored in ascending order and can overlap. +using LVRangeEntries = std::vector<LVRangeEntry>; + +class LVRange final : public LVObject { + /// Map of where a user value is live, and its location. + using LVRangesTree = IntervalTree<LVAddress, LVScope *>; + using LVAllocator = LVRangesTree::Allocator; + + LVAllocator Allocator; + LVRangesTree RangesTree; + LVRangeEntries RangeEntries; + LVAddress Lower = MaxAddress; + LVAddress Upper = 0; + +public: + LVRange() : LVObject(), RangesTree(Allocator) {} + LVRange(const LVRange &) = delete; + LVRange &operator=(const LVRange &) = delete; + ~LVRange() = default; + + void addEntry(LVScope *Scope, LVAddress LowerAddress, LVAddress UpperAddress); + void addEntry(LVScope *Scope); + LVScope *getEntry(LVAddress Address) const; + LVScope *getEntry(LVAddress LowerAddress, LVAddress UpperAddress) const; + bool hasEntry(LVAddress Low, LVAddress High) const; + LVAddress getLower() const { return Lower; } + LVAddress getUpper() const { return Upper; } + + const LVRangeEntries &getEntries() const { return RangeEntries; } + + void clear() { + RangeEntries.clear(); + Lower = MaxAddress; + Upper = 0; + } + bool empty() const { return RangeEntries.empty(); } + void sort(); + + void startSearch(); + void endSearch() {} + + void print(raw_ostream &OS, bool Full = true) const override; + void printExtra(raw_ostream &OS, bool Full = true) const override {} + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const override { print(dbgs()); } +#endif +}; + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVRANGE_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVReader.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVReader.h new file mode 100644 index 0000000000..5c537cc7fa --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVReader.h @@ -0,0 +1,250 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVReader.h ----------------------------------------------*- C++ -*-===// +// +// 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 file defines the LVReader class, which is used to describe a debug +// information reader. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVREADER_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVREADER_H + +#include "llvm/DebugInfo/LogicalView/Core/LVOptions.h" +#include "llvm/DebugInfo/LogicalView/Core/LVRange.h" +#include "llvm/Support/Errc.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/ScopedPrinter.h" +#include "llvm/Support/ToolOutputFile.h" +#include <map> + +namespace llvm { +namespace logicalview { + +constexpr LVSectionIndex UndefinedSectionIndex = 0; + +class LVScopeCompileUnit; +class LVObject; + +class LVSplitContext final { + std::unique_ptr<ToolOutputFile> OutputFile; + std::string Location; + +public: + LVSplitContext() = default; + LVSplitContext(const LVSplitContext &) = delete; + LVSplitContext &operator=(const LVSplitContext &) = delete; + ~LVSplitContext() = default; + + Error createSplitFolder(StringRef Where); + std::error_code open(std::string Name, std::string Extension, + raw_ostream &OS); + void close() { + if (OutputFile) { + OutputFile->os().close(); + OutputFile = nullptr; + } + } + + std::string getLocation() const { return Location; } + raw_fd_ostream &os() { return OutputFile->os(); } +}; + +class LVReader { + LVBinaryType BinaryType; + + // Context used by '--output=split' command line option. + LVSplitContext SplitContext; + + // Compile Units DIE Offset => Scope. + using LVCompileUnits = std::map<LVOffset, LVScopeCompileUnit *>; + LVCompileUnits CompileUnits; + + // Added elements to be used during elements comparison. + LVLines Lines; + LVScopes Scopes; + LVSymbols Symbols; + LVTypes Types; + + // Create split folder. + Error createSplitFolder(); + bool OutputSplit = false; + +protected: + LVScopeRoot *Root = nullptr; + std::string InputFilename; + std::string FileFormatName; + ScopedPrinter &W; + raw_ostream &OS; + LVScopeCompileUnit *CompileUnit = nullptr; + + // Only for ELF format. The CodeView is handled in a different way. + LVSectionIndex DotTextSectionIndex = UndefinedSectionIndex; + + // Record Compilation Unit entry. + void addCompileUnitOffset(LVOffset Offset, LVScopeCompileUnit *CompileUnit) { + CompileUnits.emplace(Offset, CompileUnit); + } + + // Create the Scope Root. + virtual Error createScopes() { + Root = new LVScopeRoot(); + Root->setName(getFilename()); + if (options().getAttributeFormat()) + Root->setFileFormatName(FileFormatName); + return Error::success(); + } + + // Return a pathname composed by: parent_path(InputFilename)/filename(From). + // This is useful when a type server (PDB file associated with an object + // file or a precompiled header file) or a DWARF split object have been + // moved from their original location. That is the case when running + // regression tests, where object files are created in one location and + // executed in a different location. + std::string createAlternativePath(StringRef From) { + // During the reader initialization, any backslashes in 'InputFilename' + // are converted to forward slashes. + SmallString<128> Path; + sys::path::append(Path, sys::path::Style::posix, + sys::path::parent_path(InputFilename), + sys::path::filename(sys::path::convert_to_slash( + From, sys::path::Style::windows))); + return std::string(Path); + } + + virtual Error printScopes(); + virtual Error printMatchedElements(bool UseMatchedElements); + virtual void sortScopes() {} + +public: + LVReader() = delete; + LVReader(StringRef InputFilename, StringRef FileFormatName, ScopedPrinter &W, + LVBinaryType BinaryType = LVBinaryType::NONE) + : BinaryType(BinaryType), OutputSplit(options().getOutputSplit()), + InputFilename(InputFilename), FileFormatName(FileFormatName), W(W), + OS(W.getOStream()) {} + LVReader(const LVReader &) = delete; + LVReader &operator=(const LVReader &) = delete; + virtual ~LVReader() { + if (Root) + delete Root; + } + + StringRef getFilename(LVObject *Object, size_t Index) const; + StringRef getFilename() const { return InputFilename; } + void setFilename(std::string Name) { InputFilename = std::move(Name); } + StringRef getFileFormatName() const { return FileFormatName; } + + raw_ostream &outputStream() { return OS; } + + bool isBinaryTypeNone() const { return BinaryType == LVBinaryType::NONE; } + bool isBinaryTypeELF() const { return BinaryType == LVBinaryType::ELF; } + bool isBinaryTypeCOFF() const { return BinaryType == LVBinaryType::COFF; } + + LVScopeCompileUnit *getCompileUnit() const { return CompileUnit; } + void setCompileUnit(LVScope *Scope) { + assert(Scope && Scope->isCompileUnit() && "Scope is not a compile unit"); + CompileUnit = static_cast<LVScopeCompileUnit *>(Scope); + } + + // Access to the scopes root. + LVScopeRoot *getScopesRoot() const { return Root; } + + Error doPrint(); + Error doLoad(); + + virtual std::string getRegisterName(LVSmall Opcode, uint64_t Operands[2]) { + llvm_unreachable("Invalid instance reader."); + return {}; + } + + LVSectionIndex getDotTextSectionIndex() const { return DotTextSectionIndex; } + virtual LVSectionIndex getSectionIndex(LVScope *Scope) { + return getDotTextSectionIndex(); + } + + virtual bool isSystemEntry(LVElement *Element, StringRef Name = {}) const { + return false; + }; + + // Access to split context. + LVSplitContext &getSplitContext() { return SplitContext; } + + // In the case of element comparison, register that added element. + void notifyAddedElement(LVLine *Line) { + if (!options().getCompareContext() && options().getCompareLines()) + Lines.push_back(Line); + } + void notifyAddedElement(LVScope *Scope) { + if (!options().getCompareContext() && options().getCompareScopes()) + Scopes.push_back(Scope); + } + void notifyAddedElement(LVSymbol *Symbol) { + if (!options().getCompareContext() && options().getCompareSymbols()) + Symbols.push_back(Symbol); + } + void notifyAddedElement(LVType *Type) { + if (!options().getCompareContext() && options().getCompareTypes()) + Types.push_back(Type); + } + + const LVLines &getLines() const { return Lines; } + const LVScopes &getScopes() const { return Scopes; } + const LVSymbols &getSymbols() const { return Symbols; } + const LVTypes &getTypes() const { return Types; } + + // Conditions to print an object. + bool doPrintLine(const LVLine *Line) const { + return patterns().printElement(Line); + } + bool doPrintLocation(const LVLocation *Location) const { + return patterns().printObject(Location); + } + bool doPrintScope(const LVScope *Scope) const { + return patterns().printElement(Scope); + } + bool doPrintSymbol(const LVSymbol *Symbol) const { + return patterns().printElement(Symbol); + } + bool doPrintType(const LVType *Type) const { + return patterns().printElement(Type); + } + + static LVReader &getInstance(); + static void setInstance(LVReader *Reader); + + void print(raw_ostream &OS) const; + virtual void printRecords(raw_ostream &OS) const {} + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const { print(dbgs()); } +#endif +}; + +inline LVReader &getReader() { return LVReader::getInstance(); } +inline LVSplitContext &getReaderSplitContext() { + return getReader().getSplitContext(); +} +inline LVScopeCompileUnit *getReaderCompileUnit() { + return getReader().getCompileUnit(); +} + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVREADER_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVScope.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVScope.h new file mode 100644 index 0000000000..8d2a4cdfec --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVScope.h @@ -0,0 +1,838 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVScope.h -----------------------------------------------*- C++ -*-===// +// +// 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 file defines the LVScope class, which is used to describe a debug +// information scope. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSCOPE_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSCOPE_H + +#include "llvm/DebugInfo/LogicalView/Core/LVElement.h" +#include "llvm/DebugInfo/LogicalView/Core/LVLocation.h" +#include "llvm/DebugInfo/LogicalView/Core/LVSort.h" +#include "llvm/Object/ObjectFile.h" +#include <list> +#include <map> +#include <set> + +namespace llvm { +namespace logicalview { + +// Name address, Code size. +using LVNameInfo = std::pair<LVAddress, uint64_t>; +using LVPublicNames = std::map<LVScope *, LVNameInfo>; +using LVPublicAddresses = std::map<LVAddress, LVNameInfo>; + +class LVRange; + +enum class LVScopeKind { + IsAggregate, + IsArray, + IsBlock, + IsCallSite, + IsCatchBlock, + IsClass, + IsCompileUnit, + IsEntryPoint, + IsEnumeration, + IsFunction, + IsFunctionType, + IsInlinedFunction, + IsLabel, + IsLexicalBlock, + IsMember, + IsNamespace, + IsRoot, + IsStructure, + IsSubprogram, + IsTemplate, + IsTemplateAlias, + IsTemplatePack, + IsTryBlock, + IsUnion, + LastEntry +}; +using LVScopeKindSet = std::set<LVScopeKind>; +using LVScopeDispatch = std::map<LVScopeKind, LVScopeGetFunction>; +using LVScopeRequest = std::vector<LVScopeGetFunction>; + +using LVOffsetList = std::list<LVOffset>; +using LVOffsetElementMap = std::map<LVOffset, LVElement *>; +using LVOffsetLinesMap = std::map<LVOffset, LVLines *>; +using LVOffsetLocationsMap = std::map<LVOffset, LVLocations *>; +using LVOffsetSymbolMap = std::map<LVOffset, LVSymbol *>; +using LVTagOffsetsMap = std::map<dwarf::Tag, LVOffsetList *>; + +// Class to represent a DWARF Scope. +class LVScope : public LVElement { + enum class Property { + HasDiscriminator, + CanHaveRanges, + CanHaveLines, + HasGlobals, + HasLocals, + HasLines, + HasScopes, + HasSymbols, + HasTypes, + IsComdat, + HasComdatScopes, // Compile Unit has comdat functions. + HasRanges, + AddedMissing, // Added missing referenced symbols. + LastEntry + }; + + // Typed bitvector with kinds and properties for this scope. + LVProperties<LVScopeKind> Kinds; + LVProperties<Property> Properties; + static LVScopeDispatch Dispatch; + + // Coverage factor in units (bytes). + unsigned CoverageFactor = 0; + + // Calculate coverage factor. + void calculateCoverage() { + float CoveragePercentage = 0; + LVLocation::calculateCoverage(Ranges, CoverageFactor, CoveragePercentage); + } + + // Decide if the scope will be printed, using some conditions given by: + // only-globals, only-locals, a-pattern. + bool resolvePrinting() const; + + // Find the current scope in the given 'Targets'. + LVScope *findIn(const LVScopes *Targets) const; + + // Traverse the scope parent tree, executing the given callback function + // on each scope. + void traverseParents(LVScopeGetFunction GetFunction, + LVScopeSetFunction SetFunction); + +protected: + // Types, Symbols, Scopes, Lines, Locations in this scope. + LVAutoTypes *Types = nullptr; + LVAutoSymbols *Symbols = nullptr; + LVAutoScopes *Scopes = nullptr; + LVAutoLines *Lines = nullptr; + LVAutoLocations *Ranges = nullptr; + + // Vector of elements (types, scopes and symbols). + // It is the union of (*Types, *Symbols and *Scopes) to be used for + // the following reasons: + // - Preserve the order the logical elements are read in. + // - To have a single container with all the logical elements, when + // the traversal does not require any specific element kind. + LVElements *Children = nullptr; + + // Resolve the template parameters/arguments relationship. + void resolveTemplate(); + void printEncodedArgs(raw_ostream &OS, bool Full) const; + + void printActiveRanges(raw_ostream &OS, bool Full = true) const; + virtual void printSizes(raw_ostream &OS) const {} + virtual void printSummary(raw_ostream &OS) const {} + + // Encoded template arguments. + virtual StringRef getEncodedArgs() const { return StringRef(); } + virtual void setEncodedArgs(StringRef EncodedArgs) {} + +public: + LVScope() : LVElement(LVSubclassID::LV_SCOPE) { + setIsScope(); + setIncludeInPrint(); + } + LVScope(const LVScope &) = delete; + LVScope &operator=(const LVScope &) = delete; + virtual ~LVScope(); + + static bool classof(const LVElement *Element) { + return Element->getSubclassID() == LVSubclassID::LV_SCOPE; + } + + KIND(LVScopeKind, IsAggregate); + KIND(LVScopeKind, IsArray); + KIND_2(LVScopeKind, IsBlock, CanHaveRanges, CanHaveLines); + KIND_1(LVScopeKind, IsCallSite, IsFunction); + KIND_1(LVScopeKind, IsCatchBlock, IsBlock); + KIND_1(LVScopeKind, IsClass, IsAggregate); + KIND_3(LVScopeKind, IsCompileUnit, CanHaveRanges, CanHaveLines, + TransformName); + KIND_1(LVScopeKind, IsEntryPoint, IsFunction); + KIND(LVScopeKind, IsEnumeration); + KIND_2(LVScopeKind, IsFunction, CanHaveRanges, CanHaveLines); + KIND_1(LVScopeKind, IsFunctionType, IsFunction); + KIND_2(LVScopeKind, IsInlinedFunction, IsFunction, IsInlined); + KIND_1(LVScopeKind, IsLabel, IsFunction); + KIND_1(LVScopeKind, IsLexicalBlock, IsBlock); + KIND(LVScopeKind, IsMember); + KIND(LVScopeKind, IsNamespace); + KIND_1(LVScopeKind, IsRoot, TransformName); + KIND_1(LVScopeKind, IsStructure, IsAggregate); + KIND_1(LVScopeKind, IsSubprogram, IsFunction); + KIND(LVScopeKind, IsTemplate); + KIND(LVScopeKind, IsTemplateAlias); + KIND(LVScopeKind, IsTemplatePack); + KIND_1(LVScopeKind, IsTryBlock, IsBlock); + KIND_1(LVScopeKind, IsUnion, IsAggregate); + + PROPERTY(Property, HasDiscriminator); + PROPERTY(Property, CanHaveRanges); + PROPERTY(Property, CanHaveLines); + PROPERTY(Property, HasGlobals); + PROPERTY(Property, HasLocals); + PROPERTY(Property, HasLines); + PROPERTY(Property, HasScopes); + PROPERTY(Property, HasSymbols); + PROPERTY(Property, HasTypes); + PROPERTY(Property, IsComdat); + PROPERTY(Property, HasComdatScopes); + PROPERTY(Property, HasRanges); + PROPERTY(Property, AddedMissing); + + bool isCompileUnit() const override { return getIsCompileUnit(); } + bool isRoot() const override { return getIsRoot(); } + + const char *kind() const override; + + // Get the specific children. + const LVLines *getLines() const { return Lines; } + const LVLocations *getRanges() const { return Ranges; } + const LVScopes *getScopes() const { return Scopes; } + const LVSymbols *getSymbols() const { return Symbols; } + const LVTypes *getTypes() const { return Types; } + const LVElements *getChildren() const { return Children; } + + void addElement(LVElement *Element); + void addElement(LVLine *Line); + void addElement(LVScope *Scope); + void addElement(LVSymbol *Symbol); + void addElement(LVType *Type); + void addObject(LVLocation *Location); + void addObject(LVAddress LowerAddress, LVAddress UpperAddress); + void addToChildren(LVElement *Element); + + // Add the missing elements from the given 'Reference', which is the + // scope associated with any DW_AT_specification, DW_AT_abstract_origin. + void addMissingElements(LVScope *Reference); + + // Traverse the scope parent tree and the children, executing the given + // callback function on each element. + void traverseParentsAndChildren(LVObjectGetFunction GetFunction, + LVObjectSetFunction SetFunction); + + // Get the size of specific children. + size_t lineCount() const { return Lines ? Lines->size() : 0; } + size_t rangeCount() const { return Ranges ? Ranges->size() : 0; } + size_t scopeCount() const { return Scopes ? Scopes->size() : 0; } + size_t symbolCount() const { return Symbols ? Symbols->size() : 0; } + size_t typeCount() const { return Types ? Types->size() : 0; } + + // Find containing parent for the given address. + LVScope *outermostParent(LVAddress Address); + + // Get all the locations associated with symbols. + void getLocations(LVLocations &LocationList, LVValidLocation ValidLocation, + bool RecordInvalid = false); + void getRanges(LVLocations &LocationList, LVValidLocation ValidLocation, + bool RecordInvalid = false); + void getRanges(LVRange &RangeList); + + unsigned getCoverageFactor() const { return CoverageFactor; } + + Error doPrint(bool Split, bool Match, bool Print, raw_ostream &OS, + bool Full = true) const override; + // Sort the logical elements using the criteria specified by the + // command line option '--output-sort'. + void sort(); + + // Get template parameter types. + bool getTemplateParameterTypes(LVTypes &Params); + + // DW_AT_specification, DW_AT_abstract_origin, DW_AT_extension. + virtual LVScope *getReference() const { return nullptr; } + + LVScope *getCompileUnitParent() const override { + return LVElement::getCompileUnitParent(); + } + + // Follow a chain of references given by DW_AT_abstract_origin and/or + // DW_AT_specification and update the scope name. + StringRef resolveReferencesChain(); + + bool removeElement(LVElement *Element) override; + void updateLevel(LVScope *Parent, bool Moved) override; + + void resolve() override; + void resolveName() override; + void resolveReferences() override; + + // Return the chain of parents as a string. + void getQualifiedName(std::string &QualifiedName) const; + // Encode the template arguments. + void encodeTemplateArguments(std::string &Name) const; + void encodeTemplateArguments(std::string &Name, const LVTypes *Types) const; + + void resolveElements(); + + // Iterate through the 'References' set and check that all its elements + // are present in the 'Targets' set. For a missing element, mark its + // parents as missing. + static void markMissingParents(const LVScopes *References, + const LVScopes *Targets, + bool TraverseChildren); + + // Checks if the current scope is contained within the target scope. + // Depending on the result, the callback may be performed. + virtual void markMissingParents(const LVScope *Target, bool TraverseChildren); + + // Returns true if the current scope and the given 'Scope' have the + // same number of children. + virtual bool equalNumberOfChildren(const LVScope *Scope) const; + + // Returns true if current scope is logically equal to the given 'Scope'. + virtual bool equals(const LVScope *Scope) const; + + // Returns true if the given 'References' are logically equal to the + // given 'Targets'. + static bool equals(const LVScopes *References, const LVScopes *Targets); + + // For the given 'Scopes' returns a scope that is logically equal + // to the current scope; otherwise 'nullptr'. + virtual LVScope *findEqualScope(const LVScopes *Scopes) const; + + // Report the current scope as missing or added during comparison. + void report(LVComparePass Pass) override; + + static LVScopeDispatch &getDispatch() { return Dispatch; } + + void print(raw_ostream &OS, bool Full = true) const override; + void printExtra(raw_ostream &OS, bool Full = true) const override; + virtual void printWarnings(raw_ostream &OS, bool Full = true) const {} + virtual void printMatchedElements(raw_ostream &OS, bool UseMatchedElements) {} + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const override { print(dbgs()); } +#endif +}; + +// Class to represent a DWARF Union/Structure/Class. +class LVScopeAggregate final : public LVScope { + LVScope *Reference = nullptr; // DW_AT_specification, DW_AT_abstract_origin. + size_t EncodedArgsIndex = 0; // Template encoded arguments. + +public: + LVScopeAggregate() : LVScope() {} + LVScopeAggregate(const LVScopeAggregate &) = delete; + LVScopeAggregate &operator=(const LVScopeAggregate &) = delete; + ~LVScopeAggregate() = default; + + // DW_AT_specification, DW_AT_abstract_origin. + LVScope *getReference() const override { return Reference; } + void setReference(LVScope *Scope) override { + Reference = Scope; + setHasReference(); + } + void setReference(LVElement *Element) override { + setReference(static_cast<LVScope *>(Element)); + } + + StringRef getEncodedArgs() const override { + return getStringPool().getString(EncodedArgsIndex); + } + void setEncodedArgs(StringRef EncodedArgs) override { + EncodedArgsIndex = getStringPool().getIndex(EncodedArgs); + } + + // Returns true if current scope is logically equal to the given 'Scope'. + bool equals(const LVScope *Scope) const override; + + // For the given 'Scopes' returns a scope that is logically equal + // to the current scope; otherwise 'nullptr'. + LVScope *findEqualScope(const LVScopes *Scopes) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +// Class to represent a DWARF Template alias. +class LVScopeAlias final : public LVScope { +public: + LVScopeAlias() : LVScope() { + setIsTemplateAlias(); + setIsTemplate(); + } + LVScopeAlias(const LVScopeAlias &) = delete; + LVScopeAlias &operator=(const LVScopeAlias &) = delete; + ~LVScopeAlias() = default; + + // Returns true if current scope is logically equal to the given 'Scope'. + bool equals(const LVScope *Scope) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +// Class to represent a DWARF array (DW_TAG_array_type). +class LVScopeArray final : public LVScope { +public: + LVScopeArray() : LVScope() { setIsArray(); } + LVScopeArray(const LVScopeArray &) = delete; + LVScopeArray &operator=(const LVScopeArray &) = delete; + ~LVScopeArray() = default; + + void resolveExtra() override; + + // Returns true if current scope is logically equal to the given 'Scope'. + bool equals(const LVScope *Scope) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +// Class to represent a DWARF Compilation Unit (CU). +class LVScopeCompileUnit final : public LVScope { + // Names (files and directories) used by the Compile Unit. + std::vector<size_t> Filenames; + + // As the .debug_pubnames section has been removed in DWARF5, we have a + // similar functionality, which is used by the decoded functions. We use + // the low-pc and high-pc for those scopes that are marked as public, in + // order to support DWARF and CodeView. + LVPublicNames PublicNames; + + // Toolchain producer. + size_t ProducerIndex = 0; + + // Compilation directory name. + size_t CompilationDirectoryIndex = 0; + + // Keep record of elements. They are needed at the compilation unit level + // to print the summary at the end of the printing. + LVCounter Allocated; + LVCounter Found; + LVCounter Printed; + + // Elements that match a given command line pattern. + LVElements MatchedElements; + LVScopes MatchedScopes; + + // It records the mapping between logical lines representing a debug line + // entry and its address in the text section. It is used to find a line + // giving its exact or closest address. To support comdat functions, all + // addresses for the same section are recorded in the same map. + using LVAddressToLine = std::map<LVAddress, LVLine *>; + LVDoubleMap<LVSectionIndex, LVAddress, LVLine *> SectionMappings; + + // DWARF Tags (Tag, Element list). + LVTagOffsetsMap DebugTags; + + // Offsets associated with objects being flagged as having invalid data + // (ranges, locations, lines zero or coverages). + LVOffsetElementMap WarningOffsets; + + // Symbols with invalid locations. (Symbol, Location List). + LVOffsetLocationsMap InvalidLocations; + + // Symbols with invalid coverage values. + LVOffsetSymbolMap InvalidCoverages; + + // Scopes with invalid ranges (Scope, Range list). + LVOffsetLocationsMap InvalidRanges; + + // Scopes with lines zero (Scope, Line list). + LVOffsetLinesMap LinesZero; + + // Record scopes contribution in bytes to the debug information. + using LVSizesMap = std::map<const LVScope *, LVOffset>; + LVSizesMap Sizes; + LVOffset CUContributionSize = 0; + + // Helper function to add an invalid location/range. + void addInvalidLocationOrRange(LVLocation *Location, LVElement *Element, + LVOffsetLocationsMap *Map) { + LVOffset Offset = Element->getOffset(); + addInvalidOffset(Offset, Element); + addItem<LVOffsetLocationsMap, LVLocations, LVOffset, LVLocation *>( + Map, Offset, Location); + } + + // Record scope sizes indexed by lexical level. + // Setting an initial size that will cover a very deep nested scopes. + const size_t TotalInitialSize = 8; + using LVTotalsEntry = std::pair<unsigned, float>; + SmallVector<LVTotalsEntry> Totals; + // Maximum seen lexical level. It is used to control how many entries + // in the 'Totals' vector are valid values. + LVLevel MaxSeenLevel = 0; + + // Get the line located at the given address. + LVLine *lineLowerBound(LVAddress Address, LVScope *Scope) const; + LVLine *lineUpperBound(LVAddress Address, LVScope *Scope) const; + + void printScopeSize(const LVScope *Scope, raw_ostream &OS); + void printScopeSize(const LVScope *Scope, raw_ostream &OS) const { + (const_cast<LVScopeCompileUnit *>(this))->printScopeSize(Scope, OS); + } + void printTotals(raw_ostream &OS) const; + +protected: + void printSizes(raw_ostream &OS) const override; + void printSummary(raw_ostream &OS) const override; + +public: + LVScopeCompileUnit() : LVScope(), Totals(TotalInitialSize, {0, 0.0}) { + setIsCompileUnit(); + } + LVScopeCompileUnit(const LVScopeCompileUnit &) = delete; + LVScopeCompileUnit &operator=(const LVScopeCompileUnit &) = delete; + ~LVScopeCompileUnit() { + deleteList<LVTagOffsetsMap>(DebugTags); + deleteList<LVOffsetLocationsMap>(InvalidLocations); + deleteList<LVOffsetLocationsMap>(InvalidRanges); + deleteList<LVOffsetLinesMap>(LinesZero); + } + + LVScope *getCompileUnitParent() const override { + return static_cast<LVScope *>(const_cast<LVScopeCompileUnit *>(this)); + } + + // Add line to address mapping. + void addMapping(LVLine *Line, LVSectionIndex SectionIndex); + LVLineRange lineRange(LVLocation *Location) const; + + LVNameInfo NameNone = {UINT64_MAX, 0}; + void addPublicName(LVScope *Scope, LVAddress LowPC, LVAddress HighPC) { + PublicNames.emplace(std::piecewise_construct, std::forward_as_tuple(Scope), + std::forward_as_tuple(LowPC, HighPC - LowPC)); + } + const LVNameInfo &findPublicName(LVScope *Scope) { + LVPublicNames::iterator Iter = PublicNames.find(Scope); + return (Iter != PublicNames.end()) ? Iter->second : NameNone; + } + const LVPublicNames &getPublicNames() const { return PublicNames; } + + // The base address of the scope for any of the debugging information + // entries listed, is given by either the DW_AT_low_pc attribute or the + // first address in the first range entry in the list of ranges given by + // the DW_AT_ranges attribute. + LVAddress getBaseAddress() const { + return Ranges ? Ranges->front()->getLowerAddress() : 0; + } + + StringRef getCompilationDirectory() const { + return getStringPool().getString(CompilationDirectoryIndex); + } + void setCompilationDirectory(StringRef CompilationDirectory) { + CompilationDirectoryIndex = getStringPool().getIndex(CompilationDirectory); + } + + StringRef getFilename(size_t Index) const; + void addFilename(StringRef Name) { + Filenames.push_back(getStringPool().getIndex(Name)); + } + + StringRef getProducer() const override { + return getStringPool().getString(ProducerIndex); + } + void setProducer(StringRef ProducerName) override { + ProducerIndex = getStringPool().getIndex(ProducerName); + } + + // Record DWARF tags. + void addDebugTag(dwarf::Tag Target, LVOffset Offset); + // Record elements with invalid offsets. + void addInvalidOffset(LVOffset Offset, LVElement *Element); + // Record symbols with invalid coverage values. + void addInvalidCoverage(LVSymbol *Symbol); + // Record symbols with invalid locations. + void addInvalidLocation(LVLocation *Location); + // Record scopes with invalid ranges. + void addInvalidRange(LVLocation *Location); + // Record line zero. + void addLineZero(LVLine *Line); + + const LVTagOffsetsMap &getDebugTags() const { return DebugTags; } + const LVOffsetElementMap &getWarningOffsets() const { return WarningOffsets; } + const LVOffsetLocationsMap &getInvalidLocations() const { + return InvalidLocations; + } + const LVOffsetSymbolMap &getInvalidCoverages() const { + return InvalidCoverages; + } + const LVOffsetLocationsMap &getInvalidRanges() const { return InvalidRanges; } + const LVOffsetLinesMap &getLinesZero() const { return LinesZero; } + + // Process ranges, locations and calculate coverage. + void processRangeLocationCoverage( + LVValidLocation ValidLocation = &LVLocation::validateRanges); + + // Add matched element. + void addMatched(LVElement *Element) { MatchedElements.push_back(Element); } + void addMatched(LVScope *Scope) { MatchedScopes.push_back(Scope); } + void propagatePatternMatch(); + + const LVElements &getMatchedElements() const { return MatchedElements; } + const LVScopes &getMatchedScopes() const { return MatchedScopes; } + + void printLocalNames(raw_ostream &OS, bool Full = true) const; + void printSummary(raw_ostream &OS, const LVCounter &Counter, + const char *Header) const; + + void incrementPrintedLines(); + void incrementPrintedScopes(); + void incrementPrintedSymbols(); + void incrementPrintedTypes(); + + // Values are used by '--summary' option (allocated). + void increment(LVLine *Line); + void increment(LVScope *Scope); + void increment(LVSymbol *Symbol); + void increment(LVType *Type); + + // A new element has been added to the scopes tree. Take the following steps: + // Increase the added element counters, for printing summary. + // During comparison notify the Reader of the new element. + void addedElement(LVLine *Line); + void addedElement(LVScope *Scope); + void addedElement(LVSymbol *Symbol); + void addedElement(LVType *Type); + + void addSize(LVScope *Scope, LVOffset Lower, LVOffset Upper); + + // Returns true if current scope is logically equal to the given 'Scope'. + bool equals(const LVScope *Scope) const override; + + void print(raw_ostream &OS, bool Full = true) const override; + void printExtra(raw_ostream &OS, bool Full = true) const override; + void printWarnings(raw_ostream &OS, bool Full = true) const override; + void printMatchedElements(raw_ostream &OS, bool UseMatchedElements) override; +}; + +// Class to represent a DWARF enumerator (DW_TAG_enumeration_type). +class LVScopeEnumeration final : public LVScope { +public: + LVScopeEnumeration() : LVScope() { setIsEnumeration(); } + LVScopeEnumeration(const LVScopeEnumeration &) = delete; + LVScopeEnumeration &operator=(const LVScopeEnumeration &) = delete; + ~LVScopeEnumeration() = default; + + // Returns true if current scope is logically equal to the given 'Scope'. + bool equals(const LVScope *Scope) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +// Class to represent a DWARF formal parameter pack +// (DW_TAG_GNU_formal_parameter_pack). +class LVScopeFormalPack final : public LVScope { +public: + LVScopeFormalPack() : LVScope() { setIsTemplatePack(); } + LVScopeFormalPack(const LVScopeFormalPack &) = delete; + LVScopeFormalPack &operator=(const LVScopeFormalPack &) = delete; + ~LVScopeFormalPack() = default; + + // Returns true if current scope is logically equal to the given 'Scope'. + bool equals(const LVScope *Scope) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +// Class to represent a DWARF Function. +class LVScopeFunction : public LVScope { + LVScope *Reference = nullptr; // DW_AT_specification, DW_AT_abstract_origin. + size_t LinkageNameIndex = 0; // Function DW_AT_linkage_name attribute. + size_t EncodedArgsIndex = 0; // Template encoded arguments. + +public: + LVScopeFunction() : LVScope() {} + LVScopeFunction(const LVScopeFunction &) = delete; + LVScopeFunction &operator=(const LVScopeFunction &) = delete; + virtual ~LVScopeFunction() = default; + + // DW_AT_specification, DW_AT_abstract_origin. + LVScope *getReference() const override { return Reference; } + void setReference(LVScope *Scope) override { + Reference = Scope; + setHasReference(); + } + void setReference(LVElement *Element) override { + setReference(static_cast<LVScope *>(Element)); + } + + StringRef getEncodedArgs() const override { + return getStringPool().getString(EncodedArgsIndex); + } + void setEncodedArgs(StringRef EncodedArgs) override { + EncodedArgsIndex = getStringPool().getIndex(EncodedArgs); + } + + void setLinkageName(StringRef LinkageName) override { + LinkageNameIndex = getStringPool().getIndex(LinkageName); + } + StringRef getLinkageName() const override { + return getStringPool().getString(LinkageNameIndex); + } + size_t getLinkageNameIndex() const override { return LinkageNameIndex; } + + void setName(StringRef ObjectName) override; + + void resolveExtra() override; + void resolveReferences() override; + + // Returns true if current scope is logically equal to the given 'Scope'. + bool equals(const LVScope *Scope) const override; + + // For the given 'Scopes' returns a scope that is logically equal + // to the current scope; otherwise 'nullptr'. + LVScope *findEqualScope(const LVScopes *Scopes) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +// Class to represent a DWARF inlined function. +class LVScopeFunctionInlined final : public LVScopeFunction { + size_t CallFilenameIndex = 0; + uint32_t CallLineNumber = 0; + uint32_t Discriminator = 0; + +public: + LVScopeFunctionInlined() : LVScopeFunction() { setIsInlinedFunction(); } + LVScopeFunctionInlined(const LVScopeFunctionInlined &) = delete; + LVScopeFunctionInlined &operator=(const LVScopeFunctionInlined &) = delete; + ~LVScopeFunctionInlined() = default; + + uint32_t getDiscriminator() const override { return Discriminator; } + void setDiscriminator(uint32_t Value) override { + Discriminator = Value; + setHasDiscriminator(); + } + + uint32_t getCallLineNumber() const override { return CallLineNumber; } + void setCallLineNumber(uint32_t Number) override { CallLineNumber = Number; } + size_t getCallFilenameIndex() const override { return CallFilenameIndex; } + void setCallFilenameIndex(size_t Index) override { + CallFilenameIndex = Index; + } + + // Line number for display; in the case of Inlined Functions, we use the + // DW_AT_call_line attribute; otherwise use DW_AT_decl_line attribute. + std::string lineNumberAsString(bool ShowZero = false) const override { + return lineAsString(getCallLineNumber(), getDiscriminator(), ShowZero); + } + + void resolveExtra() override; + + // Returns true if current scope is logically equal to the given 'Scope'. + bool equals(const LVScope *Scope) const override; + + // For the given 'Scopes' returns a scope that is logically equal + // to the current scope; otherwise 'nullptr'. + LVScope *findEqualScope(const LVScopes *Scopes) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +// Class to represent a DWARF subroutine type. +class LVScopeFunctionType final : public LVScopeFunction { +public: + LVScopeFunctionType() : LVScopeFunction() { setIsFunctionType(); } + LVScopeFunctionType(const LVScopeFunctionType &) = delete; + LVScopeFunctionType &operator=(const LVScopeFunctionType &) = delete; + ~LVScopeFunctionType() = default; + + void resolveExtra() override; +}; + +// Class to represent a DWARF Namespace. +class LVScopeNamespace final : public LVScope { + LVScope *Reference = nullptr; // Reference to DW_AT_extension attribute. + +public: + LVScopeNamespace() : LVScope() { setIsNamespace(); } + LVScopeNamespace(const LVScopeNamespace &) = delete; + LVScopeNamespace &operator=(const LVScopeNamespace &) = delete; + ~LVScopeNamespace() = default; + + // Access DW_AT_extension reference. + LVScope *getReference() const override { return Reference; } + void setReference(LVScope *Scope) override { + Reference = Scope; + setHasReference(); + } + void setReference(LVElement *Element) override { + setReference(static_cast<LVScope *>(Element)); + } + + // Returns true if current scope is logically equal to the given 'Scope'. + bool equals(const LVScope *Scope) const override; + + // For the given 'Scopes' returns a scope that is logically equal + // to the current scope; otherwise 'nullptr'. + LVScope *findEqualScope(const LVScopes *Scopes) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +// Class to represent the binary file being analyzed. +class LVScopeRoot final : public LVScope { + size_t FileFormatNameIndex = 0; + +public: + LVScopeRoot() : LVScope() { setIsRoot(); } + LVScopeRoot(const LVScopeRoot &) = delete; + LVScopeRoot &operator=(const LVScopeRoot &) = delete; + ~LVScopeRoot() = default; + + StringRef getFileFormatName() const { + return getStringPool().getString(FileFormatNameIndex); + } + void setFileFormatName(StringRef FileFormatName) { + FileFormatNameIndex = getStringPool().getIndex(FileFormatName); + } + + // Process the collected location, ranges and calculate coverage. + void processRangeInformation(); + + // Returns true if current scope is logically equal to the given 'Scope'. + bool equals(const LVScope *Scope) const override; + + void print(raw_ostream &OS, bool Full = true) const override; + void printExtra(raw_ostream &OS, bool Full = true) const override; + Error doPrintMatches(bool Split, raw_ostream &OS, + bool UseMatchedElements) const; +}; + +// Class to represent a DWARF template parameter pack +// (DW_TAG_GNU_template_parameter_pack). +class LVScopeTemplatePack final : public LVScope { +public: + LVScopeTemplatePack() : LVScope() { setIsTemplatePack(); } + LVScopeTemplatePack(const LVScopeTemplatePack &) = delete; + LVScopeTemplatePack &operator=(const LVScopeTemplatePack &) = delete; + ~LVScopeTemplatePack() = default; + + // Returns true if current scope is logically equal to the given 'Scope'. + bool equals(const LVScope *Scope) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSCOPE_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVSort.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVSort.h new file mode 100644 index 0000000000..143f817c1e --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVSort.h @@ -0,0 +1,62 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVSort.h ------------------------------------------------*- C++ -*-===// +// +// 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 file defines the sort algorithms. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSORT_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSORT_H + +namespace llvm { +namespace logicalview { + +class LVObject; + +// Object Sorting Mode. +enum class LVSortMode { + None = 0, // No given sort. + Kind, // Sort by kind. + Line, // Sort by line. + Name, // Sort by name. + Offset // Sort by offset. +}; + +// Type of function to be called when sorting an object. +using LVSortValue = int; +using LVSortFunction = LVSortValue (*)(const LVObject *LHS, + const LVObject *RHS); + +// Get the comparator function, based on the command line options. +LVSortFunction getSortFunction(); + +// Comparator functions that can be used for sorting. +LVSortValue compareKind(const LVObject *LHS, const LVObject *RHS); +LVSortValue compareLine(const LVObject *LHS, const LVObject *RHS); +LVSortValue compareName(const LVObject *LHS, const LVObject *RHS); +LVSortValue compareOffset(const LVObject *LHS, const LVObject *RHS); +LVSortValue compareRange(const LVObject *LHS, const LVObject *RHS); +LVSortValue sortByKind(const LVObject *LHS, const LVObject *RHS); +LVSortValue sortByLine(const LVObject *LHS, const LVObject *RHS); +LVSortValue sortByName(const LVObject *LHS, const LVObject *RHS); + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSORT_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVStringPool.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVStringPool.h new file mode 100644 index 0000000000..df1d8a53dd --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVStringPool.h @@ -0,0 +1,102 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVStringPool.h ------------------------------------------*- C++ -*-===// +// +// 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 file defines the LVStringPool class, which is used to implement a +// basic string pool table. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSTRINGPOOL_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSTRINGPOOL_H + +#include "llvm/ADT/StringMap.h" +#include "llvm/Support/Allocator.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/Format.h" +#include "llvm/Support/raw_ostream.h" +#include <iomanip> +#include <vector> + +namespace llvm { +namespace logicalview { + +class LVStringPool { + static constexpr size_t BadIndex = std::numeric_limits<size_t>::max(); + using TableType = StringMap<size_t, BumpPtrAllocator>; + using ValueType = TableType::value_type; + BumpPtrAllocator Allocator; + TableType StringTable; + std::vector<ValueType *> Entries; + +public: + LVStringPool() { getIndex(""); } + LVStringPool(LVStringPool const &other) = delete; + LVStringPool(LVStringPool &&other) = delete; + ~LVStringPool() = default; + + bool isValidIndex(size_t Index) const { return Index != BadIndex; } + + // Return number of strings in the pool. The empty string is allocated + // at the slot zero. We substract 1 to indicate the number of non empty + // strings. + size_t getSize() const { return Entries.size() - 1; } + + // Return the index for the specified key, otherwise 'BadIndex'. + size_t findIndex(StringRef Key) const { + TableType::const_iterator Iter = StringTable.find(Key); + if (Iter != StringTable.end()) + return Iter->second; + return BadIndex; + } + + // Return an index for the specified key. + size_t getIndex(StringRef Key) { + size_t Index = findIndex(Key); + if (isValidIndex(Index)) + return Index; + size_t Value = Entries.size(); + ValueType *Entry = ValueType::create(Key, Allocator, std::move(Value)); + StringTable.insert(Entry); + Entries.push_back(Entry); + return Value; + } + + // Given the index, return its corresponding string. + StringRef getString(size_t Index) const { + return (Index >= Entries.size()) ? StringRef() : Entries[Index]->getKey(); + } + + void print(raw_ostream &OS) const { + if (!Entries.empty()) { + OS << "\nString Pool:\n"; + for (const ValueType *Entry : Entries) + OS << "Index: " << Entry->getValue() << ", " + << "Key: '" << Entry->getKey() << "'\n"; + } + } + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const { print(dbgs()); } +#endif +}; + +} // namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSTRINGPOOL_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVSupport.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVSupport.h new file mode 100644 index 0000000000..e6912dddbb --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVSupport.h @@ -0,0 +1,295 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVSupport.h ---------------------------------------------*- C++ -*-===// +// +// 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 file defines support functions. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSUPPORT_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSUPPORT_H + +#include "llvm/ADT/SmallBitVector.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/Twine.h" +#include "llvm/DebugInfo/LogicalView/Core/LVStringPool.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/Format.h" +#include "llvm/Support/Path.h" +#include "llvm/Support/raw_ostream.h" +#include <cctype> +#include <map> +#include <sstream> + +namespace llvm { +namespace logicalview { + +// Returns the unique string pool instance. +LVStringPool &getStringPool(); + +template <typename T> +using TypeIsValid = std::bool_constant<std::is_pointer<T>::value>; + +// Utility class to help memory management and perform an automatic cleaning. +template <typename T, unsigned N = 8> +class LVAutoSmallVector : public SmallVector<T, N> { + static_assert(TypeIsValid<T>::value, "T must be a pointer type"); + +public: + using iterator = typename SmallVector<T, N>::iterator; + LVAutoSmallVector() : SmallVector<T, N>::SmallVector() {} + + ~LVAutoSmallVector() { + // Destroy the constructed elements in the vector. + for (auto *Item : *this) + delete Item; + } +}; + +// Used to record specific characteristics about the objects. +template <typename T> class LVProperties { + SmallBitVector Bits = SmallBitVector(static_cast<unsigned>(T::LastEntry) + 1); + +public: + LVProperties() = default; + + void set(T Idx) { Bits[static_cast<unsigned>(Idx)] = 1; } + void reset(T Idx) { Bits[static_cast<unsigned>(Idx)] = 0; } + bool get(T Idx) const { return Bits[static_cast<unsigned>(Idx)]; } +}; + +// Generate get, set and reset 'bool' functions for LVProperties instances. +// FAMILY: instance name. +// ENUM: enumeration instance. +// FIELD: enumerator instance. +// F1, F2, F3: optional 'set' functions to be called. +#define BOOL_BIT(FAMILY, ENUM, FIELD) \ + bool get##FIELD() const { return FAMILY.get(ENUM::FIELD); } \ + void set##FIELD() { FAMILY.set(ENUM::FIELD); } \ + void reset##FIELD() { FAMILY.reset(ENUM::FIELD); } + +#define BOOL_BIT_1(FAMILY, ENUM, FIELD, F1) \ + bool get##FIELD() const { return FAMILY.get(ENUM::FIELD); } \ + void set##FIELD() { \ + FAMILY.set(ENUM::FIELD); \ + set##F1(); \ + } \ + void reset##FIELD() { FAMILY.reset(ENUM::FIELD); } + +#define BOOL_BIT_2(FAMILY, ENUM, FIELD, F1, F2) \ + bool get##FIELD() const { return FAMILY.get(ENUM::FIELD); } \ + void set##FIELD() { \ + FAMILY.set(ENUM::FIELD); \ + set##F1(); \ + set##F2(); \ + } \ + void reset##FIELD() { FAMILY.reset(ENUM::FIELD); } + +#define BOOL_BIT_3(FAMILY, ENUM, FIELD, F1, F2, F3) \ + bool get##FIELD() const { return FAMILY.get(ENUM::FIELD); } \ + void set##FIELD() { \ + FAMILY.set(ENUM::FIELD); \ + set##F1(); \ + set##F2(); \ + set##F3(); \ + } \ + void reset##FIELD() { FAMILY.reset(ENUM::FIELD); } + +// Generate get, set and reset functions for 'properties'. +#define PROPERTY(ENUM, FIELD) BOOL_BIT(Properties, ENUM, FIELD) +#define PROPERTY_1(ENUM, FIELD, F1) BOOL_BIT_1(Properties, ENUM, FIELD, F1) +#define PROPERTY_2(ENUM, FIELD, F1, F2) \ + BOOL_BIT_2(Properties, ENUM, FIELD, F1, F2) +#define PROPERTY_3(ENUM, FIELD, F1, F2, F3) \ + BOOL_BIT_3(Properties, ENUM, FIELD, F1, F2, F3) + +// Generate get, set and reset functions for 'kinds'. +#define KIND(ENUM, FIELD) BOOL_BIT(Kinds, ENUM, FIELD) +#define KIND_1(ENUM, FIELD, F1) BOOL_BIT_1(Kinds, ENUM, FIELD, F1) +#define KIND_2(ENUM, FIELD, F1, F2) BOOL_BIT_2(Kinds, ENUM, FIELD, F1, F2) +#define KIND_3(ENUM, FIELD, F1, F2, F3) \ + BOOL_BIT_3(Kinds, ENUM, FIELD, F1, F2, F3) + +const int HEX_WIDTH = 12; +inline FormattedNumber hexValue(uint64_t N, unsigned Width = HEX_WIDTH, + bool Upper = false) { + return format_hex(N, Width, Upper); +} + +// Output the hexadecimal representation of 'Value' using '[0x%08x]' format. +inline std::string hexString(uint64_t Value, size_t Width = HEX_WIDTH) { + std::string String; + raw_string_ostream Stream(String); + Stream << hexValue(Value, Width, false); + return Stream.str(); +} + +// Get a hexadecimal string representation for the given value. +inline std::string hexSquareString(uint64_t Value) { + return (Twine("[") + Twine(hexString(Value)) + Twine("]")).str(); +} + +// Return a string with the First and Others separated by spaces. +template <typename... Args> +std::string formatAttributes(const StringRef First, Args... Others) { + const auto List = {First, Others...}; + std::stringstream Stream; + size_t Size = 0; + for (const StringRef &Item : List) { + Stream << (Size ? " " : "") << Item.str(); + Size = Item.size(); + } + Stream << (Size ? " " : ""); + return Stream.str(); +} + +// Add an item to a map with second being a list. +template <typename MapType, typename ListType, typename KeyType, + typename ValueType> +void addItem(MapType *Map, KeyType Key, ValueType Value) { + ListType *List = nullptr; + typename MapType::const_iterator Iter = Map->find(Key); + if (Iter != Map->end()) + List = Iter->second; + else { + List = new ListType(); + Map->emplace(Key, List); + } + List->push_back(Value); +} + +// Delete the map contained list. +template <typename MapType> void deleteList(MapType &Map) { + for (typename MapType::const_reference Entry : Map) + delete Entry.second; +} + +// Double map data structure. +template <typename FirstKeyType, typename SecondKeyType, typename ValueType> +class LVDoubleMap { + static_assert(std::is_pointer<ValueType>::value, + "ValueType must be a pointer."); + using LVSecondMapType = std::map<SecondKeyType, ValueType>; + using LVFirstMapType = std::map<FirstKeyType, LVSecondMapType *>; + using LVAuxMapType = std::map<SecondKeyType, FirstKeyType>; + using LVValueTypes = std::vector<ValueType>; + LVFirstMapType FirstMap; + LVAuxMapType AuxMap; + +public: + LVDoubleMap() = default; + ~LVDoubleMap() { + for (auto &Entry : FirstMap) + delete Entry.second; + } + + void add(FirstKeyType FirstKey, SecondKeyType SecondKey, ValueType Value) { + LVSecondMapType *SecondMap = nullptr; + typename LVFirstMapType::iterator FirstIter = FirstMap.find(FirstKey); + if (FirstIter == FirstMap.end()) { + SecondMap = new LVSecondMapType(); + FirstMap.emplace(FirstKey, SecondMap); + } else { + SecondMap = FirstIter->second; + } + + assert(SecondMap && "SecondMap is null."); + if (SecondMap && SecondMap->find(SecondKey) == SecondMap->end()) + SecondMap->emplace(SecondKey, Value); + + typename LVAuxMapType::iterator AuxIter = AuxMap.find(SecondKey); + if (AuxIter == AuxMap.end()) { + AuxMap.emplace(SecondKey, FirstKey); + } + } + + LVSecondMapType *findMap(FirstKeyType FirstKey) const { + typename LVFirstMapType::const_iterator FirstIter = FirstMap.find(FirstKey); + if (FirstIter == FirstMap.end()) + return nullptr; + + LVSecondMapType *SecondMap = FirstIter->second; + return SecondMap; + } + + ValueType find(FirstKeyType FirstKey, SecondKeyType SecondKey) const { + LVSecondMapType *SecondMap = findMap(FirstKey); + if (!SecondMap) + return nullptr; + + typename LVSecondMapType::const_iterator SecondIter = + SecondMap->find(SecondKey); + return (SecondIter != SecondMap->end()) ? SecondIter->second : nullptr; + } + + ValueType find(SecondKeyType SecondKey) const { + typename LVAuxMapType::const_iterator AuxIter = AuxMap.find(SecondKey); + if (AuxIter == AuxMap.end()) + return nullptr; + return find(AuxIter->second, SecondKey); + } + + // Return a vector with all the 'ValueType' values. + LVValueTypes find() const { + LVValueTypes Values; + if (FirstMap.empty()) + return Values; + for (typename LVFirstMapType::const_reference FirstEntry : FirstMap) { + LVSecondMapType *SecondMap = FirstEntry.second; + for (typename LVSecondMapType::const_reference SecondEntry : *SecondMap) + Values.push_back(SecondEntry.second); + } + return Values; + } +}; + +// Unified and flattened pathnames. +std::string transformPath(StringRef Path); +std::string flattenedFilePath(StringRef Path); + +inline std::string formattedKind(StringRef Kind) { + return (Twine("{") + Twine(Kind) + Twine("}")).str(); +} + +inline std::string formattedName(StringRef Name) { + return (Twine("'") + Twine(Name) + Twine("'")).str(); +} + +inline std::string formattedNames(StringRef Name1, StringRef Name2) { + return (Twine("'") + Twine(Name1) + Twine(Name2) + Twine("'")).str(); +} + +// These are the values assigned to the debug location record IDs. +// See DebugInfo/CodeView/CodeViewSymbols.def. +// S_DEFRANGE 0x113f +// S_DEFRANGE_SUBFIELD 0x1140 +// S_DEFRANGE_REGISTER 0x1141 +// S_DEFRANGE_FRAMEPOINTER_REL 0x1142 +// S_DEFRANGE_SUBFIELD_REGISTER 0x1143 +// S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE 0x1144 +// S_DEFRANGE_REGISTER_REL 0x1145 +// When recording CodeView debug location, the above values are truncated +// to a uint8_t value in order to fit the 'OpCode' used for the logical +// debug location operations. +// Return the original CodeView enum value. +inline uint16_t getCodeViewOperationCode(uint8_t Code) { return 0x1100 | Code; } + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSUPPORT_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h new file mode 100644 index 0000000000..79b467969c --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h @@ -0,0 +1,206 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVSymbol.h ----------------------------------------------*- C++ -*-===// +// +// 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 file defines the LVSymbol class, which is used to describe a debug +// information symbol. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSYMBOL_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSYMBOL_H + +#include "llvm/DebugInfo/LogicalView/Core/LVElement.h" + +namespace llvm { +namespace logicalview { + +enum class LVSymbolKind { + IsCallSiteParameter, + IsConstant, + IsInheritance, + IsMember, + IsParameter, + IsUnspecified, + IsVariable, + LastEntry +}; +using LVSymbolKindSet = std::set<LVSymbolKind>; +using LVSymbolDispatch = std::map<LVSymbolKind, LVSymbolGetFunction>; +using LVSymbolRequest = std::vector<LVSymbolGetFunction>; + +class LVSymbol final : public LVElement { + enum class Property { HasLocation, FillGaps, LastEntry }; + + // Typed bitvector with kinds and properties for this symbol. + LVProperties<LVSymbolKind> Kinds; + LVProperties<Property> Properties; + static LVSymbolDispatch Dispatch; + + // CodeView symbol Linkage name. + size_t LinkageNameIndex = 0; + + // Reference to DW_AT_specification, DW_AT_abstract_origin attribute. + LVSymbol *Reference = nullptr; + LVAutoLocations *Locations = nullptr; + LVLocation *CurrentLocation = nullptr; + + // Bitfields length. + uint32_t BitSize = 0; + + // Index in the String pool representing any initial value. + size_t ValueIndex = 0; + + // Coverage factor in units (bytes). + unsigned CoverageFactor = 0; + float CoveragePercentage = 0; + + // Add a location gap into the location list. + LVAutoLocations::iterator addLocationGap(LVAutoLocations::iterator Pos, + LVAddress LowPC, LVAddress HighPC); + + // Find the current symbol in the given 'Targets'. + LVSymbol *findIn(const LVSymbols *Targets) const; + +public: + LVSymbol() : LVElement(LVSubclassID::LV_SYMBOL) { + setIsSymbol(); + setIncludeInPrint(); + } + LVSymbol(const LVSymbol &) = delete; + LVSymbol &operator=(const LVSymbol &) = delete; + ~LVSymbol() { delete Locations; } + + static bool classof(const LVElement *Element) { + return Element->getSubclassID() == LVSubclassID::LV_SYMBOL; + } + + KIND(LVSymbolKind, IsCallSiteParameter); + KIND(LVSymbolKind, IsConstant); + KIND(LVSymbolKind, IsInheritance); + KIND(LVSymbolKind, IsMember); + KIND(LVSymbolKind, IsParameter); + KIND(LVSymbolKind, IsUnspecified); + KIND(LVSymbolKind, IsVariable); + + PROPERTY(Property, HasLocation); + PROPERTY(Property, FillGaps); + + const char *kind() const override; + + // Access DW_AT_specification, DW_AT_abstract_origin reference. + LVSymbol *getReference() const { return Reference; } + void setReference(LVSymbol *Symbol) override { + Reference = Symbol; + setHasReference(); + } + void setReference(LVElement *Element) override { + assert((!Element || isa<LVSymbol>(Element)) && "Invalid element"); + setReference(static_cast<LVSymbol *>(Element)); + } + + void setLinkageName(StringRef LinkageName) override { + LinkageNameIndex = getStringPool().getIndex(LinkageName); + } + StringRef getLinkageName() const override { + return getStringPool().getString(LinkageNameIndex); + } + size_t getLinkageNameIndex() const override { return LinkageNameIndex; } + + uint32_t getBitSize() const override { return BitSize; } + void setBitSize(uint32_t Size) override { BitSize = Size; } + + // Process the values for a DW_AT_const_value. + std::string getValue() const override { + return std::string(getStringPool().getString(ValueIndex)); + } + void setValue(StringRef Value) override { + ValueIndex = getStringPool().getIndex(Value); + } + size_t getValueIndex() const override { return ValueIndex; } + + // Add a Location Entry. + void addLocationConstant(dwarf::Attribute Attr, LVUnsigned Constant, + uint64_t LocDescOffset); + void addLocationOperands(LVSmall Opcode, uint64_t Operand1, + uint64_t Operand2); + void addLocation(dwarf::Attribute Attr, LVAddress LowPC, LVAddress HighPC, + LVUnsigned SectionOffset, uint64_t LocDescOffset, + bool CallSiteLocation = false); + + // Fill gaps in the location list. + void fillLocationGaps(); + + // Get all the locations associated with symbols. + void getLocations(LVLocations &LocationList, LVValidLocation ValidLocation, + bool RecordInvalid = false); + void getLocations(LVLocations &LocationList) const; + + // Calculate coverage factor. + void calculateCoverage(); + + unsigned getCoverageFactor() const { return CoverageFactor; } + void setCoverageFactor(unsigned Value) { CoverageFactor = Value; } + float getCoveragePercentage() const { return CoveragePercentage; } + void setCoveragePercentage(float Value) { CoveragePercentage = Value; } + + // Print location in raw format. + void printLocations(raw_ostream &OS, bool Full = true) const; + + // Follow a chain of references given by DW_AT_abstract_origin and/or + // DW_AT_specification and update the symbol name. + StringRef resolveReferencesChain(); + + void resolveName() override; + void resolveReferences() override; + + static LVSymbolDispatch &getDispatch() { return Dispatch; } + + static bool parametersMatch(const LVSymbols *References, + const LVSymbols *Targets); + + static void getParameters(const LVSymbols *Symbols, LVSymbols *Parameters); + + // Iterate through the 'References' set and check that all its elements + // are present in the 'Targets' set. For a missing element, mark its + // parents as missing. + static void markMissingParents(const LVSymbols *References, + const LVSymbols *Targets); + + // Returns true if current type is logically equal to the given 'Symbol'. + bool equals(const LVSymbol *Symbol) const; + + // Returns true if the given 'References' are logically equal to the + // given 'Targets'. + static bool equals(const LVSymbols *References, const LVSymbols *Targets); + + // Report the current symbol as missing or added during comparison. + void report(LVComparePass Pass) override; + + void print(raw_ostream &OS, bool Full = true) const override; + void printExtra(raw_ostream &OS, bool Full = true) const override; + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const override { print(dbgs()); } +#endif +}; + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSYMBOL_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVType.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVType.h new file mode 100644 index 0000000000..7beabb2fba --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Core/LVType.h @@ -0,0 +1,301 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVType.h ------------------------------------------------*- C++ -*-===// +// +// 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 file defines the LVType class, which is used to describe a debug +// information type. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVTYPE_H +#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVTYPE_H + +#include "llvm/DebugInfo/LogicalView/Core/LVElement.h" + +namespace llvm { +namespace logicalview { + +enum class LVTypeKind { + IsBase, + IsConst, + IsEnumerator, + IsImport, + IsImportDeclaration, + IsImportModule, + IsPointer, + IsPointerMember, + IsReference, + IsRestrict, + IsRvalueReference, + IsSubrange, + IsTemplateParam, + IsTemplateTemplateParam, + IsTemplateTypeParam, + IsTemplateValueParam, + IsTypedef, + IsUnaligned, + IsUnspecified, + IsVolatile, + IsModifier, // CodeView - LF_MODIFIER + LastEntry +}; +using LVTypeKindSelection = std::set<LVTypeKind>; +using LVTypeDispatch = std::map<LVTypeKind, LVTypeGetFunction>; +using LVTypeRequest = std::vector<LVTypeGetFunction>; + +// Class to represent a DWARF Type. +class LVType : public LVElement { + enum class Property { IsSubrangeCount, LastEntry }; + + // Typed bitvector with kinds and properties for this type. + LVProperties<LVTypeKind> Kinds; + LVProperties<Property> Properties; + static LVTypeDispatch Dispatch; + + // Find the current type in the given 'Targets'. + LVType *findIn(const LVTypes *Targets) const; + +public: + LVType() : LVElement(LVSubclassID::LV_TYPE) { setIsType(); } + LVType(const LVType &) = delete; + LVType &operator=(const LVType &) = delete; + virtual ~LVType() = default; + + static bool classof(const LVElement *Element) { + return Element->getSubclassID() == LVSubclassID::LV_TYPE; + } + + KIND(LVTypeKind, IsBase); + KIND(LVTypeKind, IsConst); + KIND(LVTypeKind, IsEnumerator); + KIND(LVTypeKind, IsImport); + KIND_1(LVTypeKind, IsImportDeclaration, IsImport); + KIND_1(LVTypeKind, IsImportModule, IsImport); + KIND(LVTypeKind, IsPointer); + KIND(LVTypeKind, IsPointerMember); + KIND(LVTypeKind, IsReference); + KIND(LVTypeKind, IsRestrict); + KIND(LVTypeKind, IsRvalueReference); + KIND(LVTypeKind, IsSubrange); + KIND(LVTypeKind, IsTemplateParam); + KIND_1(LVTypeKind, IsTemplateTemplateParam, IsTemplateParam); + KIND_1(LVTypeKind, IsTemplateTypeParam, IsTemplateParam); + KIND_1(LVTypeKind, IsTemplateValueParam, IsTemplateParam); + KIND(LVTypeKind, IsTypedef); + KIND(LVTypeKind, IsUnaligned); + KIND(LVTypeKind, IsUnspecified); + KIND(LVTypeKind, IsVolatile); + KIND(LVTypeKind, IsModifier); + + PROPERTY(Property, IsSubrangeCount); + + const char *kind() const override; + + // Follow a chain of references given by DW_AT_abstract_origin and/or + // DW_AT_specification and update the type name. + StringRef resolveReferencesChain(); + + bool isBase() const override { return getIsBase(); } + bool isTemplateParam() const override { return getIsTemplateParam(); } + + // Encode the specific template argument. + virtual void encodeTemplateArgument(std::string &Name) const {} + + // Return the underlying type for a type definition. + virtual LVElement *getUnderlyingType() { return nullptr; } + virtual void setUnderlyingType(LVElement *Element) {} + + void resolveName() override; + void resolveReferences() override; + + static LVTypeDispatch &getDispatch() { return Dispatch; } + + static bool parametersMatch(const LVTypes *References, + const LVTypes *Targets); + + static void getParameters(const LVTypes *Types, LVTypes *TypesParam, + LVScopes *ScopesParam); + + // Iterate through the 'References' set and check that all its elements + // are present in the 'Targets' set. For a missing element, mark its + // parents as missing. + static void markMissingParents(const LVTypes *References, + const LVTypes *Targets); + + // Returns true if current type is logically equal to the given 'Type'. + virtual bool equals(const LVType *Type) const; + + // Returns true if the given 'References' are logically equal to the + // given 'Targets'. + static bool equals(const LVTypes *References, const LVTypes *Targets); + + // Report the current type as missing or added during comparison. + void report(LVComparePass Pass) override; + + void print(raw_ostream &OS, bool Full = true) const override; + void printExtra(raw_ostream &OS, bool Full = true) const override; + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const override { print(dbgs()); } +#endif +}; + +// Class to represent DW_TAG_typedef_type. +class LVTypeDefinition final : public LVType { +public: + LVTypeDefinition() : LVType() { + setIsTypedef(); + setIncludeInPrint(); + } + LVTypeDefinition(const LVTypeDefinition &) = delete; + LVTypeDefinition &operator=(const LVTypeDefinition &) = delete; + ~LVTypeDefinition() = default; + + // Return the underlying type for a type definition. + LVElement *getUnderlyingType() override; + void setUnderlyingType(LVElement *Element) override { setType(Element); } + + void resolveExtra() override; + + // Returns true if current type is logically equal to the given 'Type'. + bool equals(const LVType *Type) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +// Class to represent a DW_TAG_enumerator. +class LVTypeEnumerator final : public LVType { + // Index in the String pool representing any initial value. + size_t ValueIndex = 0; + +public: + LVTypeEnumerator() : LVType() { + setIsEnumerator(); + setIncludeInPrint(); + } + LVTypeEnumerator(const LVTypeEnumerator &) = delete; + LVTypeEnumerator &operator=(const LVTypeEnumerator &) = delete; + ~LVTypeEnumerator() = default; + + // Process the values for a DW_TAG_enumerator. + std::string getValue() const override { + return std::string(getStringPool().getString(ValueIndex)); + } + void setValue(StringRef Value) override { + ValueIndex = getStringPool().getIndex(Value); + } + size_t getValueIndex() const override { return ValueIndex; } + + // Returns true if current type is logically equal to the given 'Type'. + bool equals(const LVType *Type) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +// Class to represent DW_TAG_imported_module / DW_TAG_imported_declaration. +class LVTypeImport final : public LVType { +public: + LVTypeImport() : LVType() { setIncludeInPrint(); } + LVTypeImport(const LVTypeImport &) = delete; + LVTypeImport &operator=(const LVTypeImport &) = delete; + ~LVTypeImport() = default; + + // Returns true if current type is logically equal to the given 'Type'. + bool equals(const LVType *Type) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +// Class to represent a DWARF Template parameter holder (type or param). +class LVTypeParam final : public LVType { + // Index in the String pool representing any initial value. + size_t ValueIndex = 0; + +public: + LVTypeParam(); + LVTypeParam(const LVTypeParam &) = delete; + LVTypeParam &operator=(const LVTypeParam &) = delete; + ~LVTypeParam() = default; + + // Template parameter value. + std::string getValue() const override { + return std::string(getStringPool().getString(ValueIndex)); + } + void setValue(StringRef Value) override { + ValueIndex = getStringPool().getIndex(Value); + } + size_t getValueIndex() const override { return ValueIndex; } + + // Encode the specific template argument. + void encodeTemplateArgument(std::string &Name) const override; + + // Returns true if current type is logically equal to the given 'Type'. + bool equals(const LVType *Type) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +// Class to represent a DW_TAG_subrange_type. +class LVTypeSubrange final : public LVType { + // Values describing the subrange bounds. + int64_t LowerBound = 0; // DW_AT_lower_bound or DW_AT_count value. + int64_t UpperBound = 0; // DW_AT_upper_bound value. + +public: + LVTypeSubrange() : LVType() { + setIsSubrange(); + setIncludeInPrint(); + } + LVTypeSubrange(const LVTypeSubrange &) = delete; + LVTypeSubrange &operator=(const LVTypeSubrange &) = delete; + ~LVTypeSubrange() = default; + + int64_t getCount() const override { + return getIsSubrangeCount() ? LowerBound : 0; + } + void setCount(int64_t Value) override { + LowerBound = Value; + setIsSubrangeCount(); + } + + int64_t getLowerBound() const override { return LowerBound; } + void setLowerBound(int64_t Value) override { LowerBound = Value; } + + int64_t getUpperBound() const override { return UpperBound; } + void setUpperBound(int64_t Value) override { UpperBound = Value; } + + std::pair<unsigned, unsigned> getBounds() const override { + return {LowerBound, UpperBound}; + } + void setBounds(unsigned Lower, unsigned Upper) override { + LowerBound = Lower; + UpperBound = Upper; + } + + void resolveExtra() override; + + // Returns true if current type is logically equal to the given 'Type'. + bool equals(const LVType *Type) const override; + + void printExtra(raw_ostream &OS, bool Full = true) const override; +}; + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVTYPE_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/LVReaderHandler.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/LVReaderHandler.h new file mode 100644 index 0000000000..2b3dea1370 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/LVReaderHandler.h @@ -0,0 +1,111 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVReaderHandler.h ---------------------------------------*- C++ -*-===// +// +// 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 class implements the Reader handler. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVREADERHANDLER_H +#define LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVREADERHANDLER_H + +#include "llvm/ADT/PointerUnion.h" +#include "llvm/DebugInfo/LogicalView/Core/LVReader.h" +#include "llvm/DebugInfo/PDB/Native/PDBFile.h" +#include "llvm/Object/Archive.h" +#include "llvm/Object/MachOUniversal.h" +#include "llvm/Object/ObjectFile.h" +#include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/ScopedPrinter.h" +#include <string> +#include <vector> + +namespace llvm { +namespace logicalview { + +using LVReaders = std::vector<LVReader *>; +using ArgVector = std::vector<std::string>; +using PdbOrObj = PointerUnion<object::ObjectFile *, pdb::PDBFile *>; + +// This class performs the following tasks: +// - Creates a logical reader for every binary file in the command line, +// that parses the debug information and creates a high level logical +// view representation containing scopes, symbols, types and lines. +// - Prints and compares the logical views. +// +// The supported binary formats are: ELF, Mach-O and CodeView. +class LVReaderHandler { + ArgVector &Objects; + ScopedPrinter &W; + raw_ostream &OS; + LVReaders TheReaders; + + Error createReaders(); + void destroyReaders(); + Error printReaders(); + Error compareReaders(); + + Error handleArchive(LVReaders &Readers, StringRef Filename, + object::Archive &Arch); + Error handleBuffer(LVReaders &Readers, StringRef Filename, + MemoryBufferRef Buffer, StringRef ExePath = {}); + Error handleFile(LVReaders &Readers, StringRef Filename, + StringRef ExePath = {}); + Error handleMach(LVReaders &Readers, StringRef Filename, + object::MachOUniversalBinary &Mach); + Error handleObject(LVReaders &Readers, StringRef Filename, + object::Binary &Binary); + + Error createReader(StringRef Filename, LVReaders &Readers, PdbOrObj &Input, + StringRef FileFormatName, StringRef ExePath = {}); + +public: + LVReaderHandler() = delete; + LVReaderHandler(ArgVector &Objects, ScopedPrinter &W, + LVOptions &ReaderOptions) + : Objects(Objects), W(W), OS(W.getOStream()) { + setOptions(&ReaderOptions); + } + LVReaderHandler(const LVReaderHandler &) = delete; + LVReaderHandler &operator=(const LVReaderHandler &) = delete; + ~LVReaderHandler() { destroyReaders(); } + + Error createReader(StringRef Filename, LVReaders &Readers) { + return handleFile(Readers, Filename); + } + Error process(); + + Expected<LVReader *> createReader(StringRef Pathname) { + LVReaders Readers; + if (Error Err = createReader(Pathname, Readers)) + return std::move(Err); + return Readers[0]; + } + void deleteReader(LVReader *Reader) { delete Reader; } + + void print(raw_ostream &OS) const; + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const { print(dbgs()); } +#endif +}; + +} // end namespace logicalview +} // namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVREADERHANDLER_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h new file mode 100644 index 0000000000..3063fb40ac --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h @@ -0,0 +1,191 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVBinaryReader.h ----------------------------------------*- C++ -*-===// +// +// 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 file defines the LVBinaryReader class, which is used to describe a +// binary reader. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVBINARYREADER_H +#define LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVBINARYREADER_H + +#include "llvm/DebugInfo/LogicalView/Core/LVReader.h" +#include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCContext.h" +#include "llvm/MC/MCDisassembler/MCDisassembler.h" +#include "llvm/MC/MCInstPrinter.h" +#include "llvm/MC/MCInstrInfo.h" +#include "llvm/MC/MCObjectFileInfo.h" +#include "llvm/MC/MCRegisterInfo.h" +#include "llvm/MC/MCSubtargetInfo.h" +#include "llvm/MC/TargetRegistry.h" +#include "llvm/Object/ObjectFile.h" + +namespace llvm { +namespace logicalview { + +constexpr bool UpdateHighAddress = false; + +// Logical scope, Section address, Section index, IsComdat. +struct LVSymbolTableEntry final { + LVScope *Scope = nullptr; + LVAddress Address = 0; + LVSectionIndex SectionIndex = 0; + bool IsComdat = false; + LVSymbolTableEntry() = default; + LVSymbolTableEntry(LVScope *Scope, LVAddress Address, + LVSectionIndex SectionIndex, bool IsComdat) + : Scope(Scope), Address(Address), SectionIndex(SectionIndex), + IsComdat(IsComdat) {} +}; + +// Function names extracted from the object symbol table. +class LVSymbolTable final { + using LVSymbolNames = std::map<std::string, LVSymbolTableEntry>; + LVSymbolNames SymbolNames; + +public: + LVSymbolTable() = default; + + void add(StringRef Name, LVScope *Function, LVSectionIndex SectionIndex = 0); + void add(StringRef Name, LVAddress Address, LVSectionIndex SectionIndex, + bool IsComdat); + LVSectionIndex update(LVScope *Function); + + const LVSymbolTableEntry &getEntry(StringRef Name); + LVAddress getAddress(StringRef Name); + LVSectionIndex getIndex(StringRef Name); + bool getIsComdat(StringRef Name); + + void print(raw_ostream &OS); +}; + +class LVBinaryReader : public LVReader { + // Function names extracted from the object symbol table. + LVSymbolTable SymbolTable; + + // Instruction lines for a logical scope. These instructions are fetched + // during its merge with the debug lines. + LVDoubleMap<LVSectionIndex, LVScope *, LVLines *> ScopeInstructions; + + // Links the scope with its first assembler address line. + LVDoubleMap<LVSectionIndex, LVAddress, LVScope *> AssemblerMappings; + + // Mapping from virtual address to section. + // The virtual address refers to the address where the section is loaded. + using LVSectionAddresses = std::map<LVSectionIndex, object::SectionRef>; + LVSectionAddresses SectionAddresses; + + void addSectionAddress(const object::SectionRef &Section) { + if (SectionAddresses.find(Section.getAddress()) == SectionAddresses.end()) + SectionAddresses.emplace(Section.getAddress(), Section); + } + + // Scopes with ranges for current compile unit. It is used to find a line + // giving its exact or closest address. To support comdat functions, all + // addresses for the same section are recorded in the same map. + using LVSectionRanges = std::map<LVSectionIndex, LVRange *>; + LVSectionRanges SectionRanges; + + // Image base and virtual address for Executable file. + uint64_t ImageBaseAddress = 0; + uint64_t VirtualAddress = 0; + + // Object sections with machine code. + using LVSections = std::map<LVSectionIndex, object::SectionRef>; + LVSections Sections; + +protected: + // It contains the LVLineDebug elements representing the logical lines for + // the current compile unit, created by parsing the debug line section. + LVLines CULines; + + std::unique_ptr<const MCRegisterInfo> MRI; + std::unique_ptr<const MCAsmInfo> MAI; + std::unique_ptr<const MCSubtargetInfo> STI; + std::unique_ptr<const MCInstrInfo> MII; + std::unique_ptr<const MCDisassembler> MD; + std::unique_ptr<MCContext> MC; + std::unique_ptr<MCInstPrinter> MIP; + + // Loads all info for the architecture of the provided object file. + Error loadGenericTargetInfo(StringRef TheTriple, StringRef TheFeatures); + + virtual void mapRangeAddress(const object::ObjectFile &Obj) {} + virtual void mapRangeAddress(const object::ObjectFile &Obj, + const object::SectionRef &Section, + bool IsComdat) {} + + // Create a mapping from virtual address to section. + void mapVirtualAddress(const object::ObjectFile &Obj); + void mapVirtualAddress(const object::COFFObjectFile &COFFObj); + + Expected<std::pair<LVSectionIndex, object::SectionRef>> + getSection(LVScope *Scope, LVAddress Address, LVSectionIndex SectionIndex); + + void addSectionRange(LVSectionIndex SectionIndex, LVScope *Scope); + void addSectionRange(LVSectionIndex SectionIndex, LVScope *Scope, + LVAddress LowerAddress, LVAddress UpperAddress); + LVRange *getSectionRanges(LVSectionIndex SectionIndex); + + Error createInstructions(); + Error createInstructions(LVScope *Function, LVSectionIndex SectionIndex); + Error createInstructions(LVScope *Function, LVSectionIndex SectionIndex, + const LVNameInfo &NameInfo); + + void processLines(LVLines *DebugLines, LVSectionIndex SectionIndex); + void processLines(LVLines *DebugLines, LVSectionIndex SectionIndex, + LVScope *Function); + +public: + LVBinaryReader() = delete; + LVBinaryReader(StringRef Filename, StringRef FileFormatName, ScopedPrinter &W, + LVBinaryType BinaryType) + : LVReader(Filename, FileFormatName, W, BinaryType) {} + LVBinaryReader(const LVBinaryReader &) = delete; + LVBinaryReader &operator=(const LVBinaryReader &) = delete; + virtual ~LVBinaryReader(); + + void addToSymbolTable(StringRef Name, LVScope *Function, + LVSectionIndex SectionIndex = 0); + void addToSymbolTable(StringRef Name, LVAddress Address, + LVSectionIndex SectionIndex, bool IsComdat); + LVSectionIndex updateSymbolTable(LVScope *Function); + + const LVSymbolTableEntry &getSymbolTableEntry(StringRef Name); + LVAddress getSymbolTableAddress(StringRef Name); + LVSectionIndex getSymbolTableIndex(StringRef Name); + bool getSymbolTableIsComdat(StringRef Name); + + LVSectionIndex getSectionIndex(LVScope *Scope) override { + return Scope ? getSymbolTableIndex(Scope->getLinkageName()) + : DotTextSectionIndex; + } + + void print(raw_ostream &OS) const; + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const { print(dbgs()); } +#endif +}; + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVBINARYREADER_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Readers/LVELFReader.h b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Readers/LVELFReader.h new file mode 100644 index 0000000000..8689d1535e --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/LogicalView/Readers/LVELFReader.h @@ -0,0 +1,165 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- LVELFReader.h -------------------------------------------*- C++ -*-===// +// +// 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 file defines the LVELFReader class, which is used to describe a +// debug information (DWARF) reader. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVELFREADER_H +#define LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVELFREADER_H + +#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h" +#include "llvm/DebugInfo/DWARF/DWARFContext.h" +#include "llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h" +#include <unordered_set> + +namespace llvm { +namespace logicalview { + +class LVElement; +class LVLine; +class LVScopeCompileUnit; +class LVSymbol; +class LVType; + +using AttributeSpec = DWARFAbbreviationDeclaration::AttributeSpec; + +class LVELFReader final : public LVBinaryReader { + object::ObjectFile &Obj; + + // Indicates if ranges data are available; in the case of split DWARF any + // reference to ranges is valid only if the skeleton DIE has been loaded. + bool RangesDataAvailable = false; + LVAddress CUBaseAddress = 0; + LVAddress CUHighAddress = 0; + + // Current elements during the processing of a DIE. + LVElement *CurrentElement = nullptr; + LVScope *CurrentScope = nullptr; + LVSymbol *CurrentSymbol = nullptr; + LVType *CurrentType = nullptr; + LVOffset CurrentOffset = 0; + LVOffset CurrentEndOffset = 0; + + // In DWARF v4, the files are 1-indexed. + // In DWARF v5, the files are 0-indexed. + // The ELF reader expects the indexes as 1-indexed. + bool IncrementFileIndex = false; + + // Address ranges collected for current DIE. + std::vector<LVAddressRange> CurrentRanges; + + // Symbols with locations for current compile unit. + LVSymbols SymbolsWithLocations; + + // Global Offsets (Offset, Element). + LVOffsetElementMap GlobalOffsets; + + // Low PC and High PC values for DIE being processed. + LVAddress CurrentLowPC = 0; + LVAddress CurrentHighPC = 0; + bool FoundLowPC = false; + bool FoundHighPC = false; + + // Cross references (Elements). + using LVElementSet = std::unordered_set<LVElement *>; + using LVElementEntry = std::pair<LVElement *, LVElementSet>; + using LVElementReference = std::unordered_map<LVOffset, LVElementEntry>; + LVElementReference ElementTable; + + Error loadTargetInfo(const object::ObjectFile &Obj); + + void mapRangeAddress(const object::ObjectFile &Obj) override; + + LVElement *createElement(dwarf::Tag Tag); + void traverseDieAndChildren(DWARFDie &DIE, LVScope *Parent, + DWARFDie &SkeletonDie); + // Process the attributes for the given DIE. + LVScope *processOneDie(const DWARFDie &InputDIE, LVScope *Parent, + DWARFDie &SkeletonDie); + void processOneAttribute(const DWARFDie &Die, LVOffset *OffsetPtr, + const AttributeSpec &AttrSpec); + void createLineAndFileRecords(const DWARFDebugLine::LineTable *Lines); + void processLocationGaps(); + + // Add offset to global map. + void addGlobalOffset(LVOffset Offset) { + if (GlobalOffsets.find(Offset) == GlobalOffsets.end()) + // Just associate the DIE offset with a null element, as we do not + // know if the referenced element has been created. + GlobalOffsets.emplace(Offset, nullptr); + } + + // Remove offset from global map. + void removeGlobalOffset(LVOffset Offset) { + LVOffsetElementMap::iterator Iter = GlobalOffsets.find(Offset); + if (Iter != GlobalOffsets.end()) + GlobalOffsets.erase(Iter); + } + + // Get the location information for DW_AT_data_member_location. + void processLocationMember(dwarf::Attribute Attr, + const DWARFFormValue &FormValue, + const DWARFDie &Die, uint64_t OffsetOnEntry); + void processLocationList(dwarf::Attribute Attr, + const DWARFFormValue &FormValue, const DWARFDie &Die, + uint64_t OffsetOnEntry, + bool CallSiteLocation = false); + void updateReference(dwarf::Attribute Attr, const DWARFFormValue &FormValue); + + // Get an element given the DIE offset. + LVElement *getElementForOffset(LVOffset offset, LVElement *Element); + +protected: + Error createScopes() override; + void sortScopes() override; + +public: + LVELFReader() = delete; + LVELFReader(StringRef Filename, StringRef FileFormatName, + object::ObjectFile &Obj, ScopedPrinter &W) + : LVBinaryReader(Filename, FileFormatName, W, LVBinaryType::ELF), + Obj(Obj) {} + LVELFReader(const LVELFReader &) = delete; + LVELFReader &operator=(const LVELFReader &) = delete; + ~LVELFReader() = default; + + LVAddress getCUBaseAddress() const { return CUBaseAddress; } + void setCUBaseAddress(LVAddress Address) { CUBaseAddress = Address; } + LVAddress getCUHighAddress() const { return CUHighAddress; } + void setCUHighAddress(LVAddress Address) { CUHighAddress = Address; } + + const LVSymbols &GetSymbolsWithLocations() const { + return SymbolsWithLocations; + } + + std::string getRegisterName(LVSmall Opcode, uint64_t Operands[2]) override; + + void print(raw_ostream &OS) const; + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void dump() const { print(dbgs()); } +#endif +}; + +} // end namespace logicalview +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVELFREADER_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIADataStream.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIADataStream.h new file mode 100644 index 0000000000..9bd4b7b477 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIADataStream.h @@ -0,0 +1,44 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DIADataStream.h - DIA implementation of IPDBDataStream ---*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIADATASTREAM_H +#define LLVM_DEBUGINFO_PDB_DIA_DIADATASTREAM_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBDataStream.h" + +namespace llvm { +namespace pdb { +class DIADataStream : public IPDBDataStream { +public: + explicit DIADataStream(CComPtr<IDiaEnumDebugStreamData> DiaStreamData); + + uint32_t getRecordCount() const override; + std::string getName() const override; + std::optional<RecordType> getItemAtIndex(uint32_t Index) const override; + bool getNext(RecordType &Record) override; + void reset() override; + +private: + CComPtr<IDiaEnumDebugStreamData> StreamData; +}; +} +} + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h new file mode 100644 index 0000000000..7b0bdd2384 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h @@ -0,0 +1,47 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//==- DIAEnumDebugStreams.h - DIA Debug Stream Enumerator impl ---*- C++ -*-==// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAENUMDEBUGSTREAMS_H +#define LLVM_DEBUGINFO_PDB_DIA_DIAENUMDEBUGSTREAMS_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBDataStream.h" +#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" + +namespace llvm { +namespace pdb { + +class IPDBDataStream; + +class DIAEnumDebugStreams : public IPDBEnumChildren<IPDBDataStream> { +public: + explicit DIAEnumDebugStreams(CComPtr<IDiaEnumDebugStreams> DiaEnumerator); + + uint32_t getChildCount() const override; + ChildTypePtr getChildAtIndex(uint32_t Index) const override; + ChildTypePtr getNext() override; + void reset() override; + +private: + CComPtr<IDiaEnumDebugStreams> Enumerator; +}; +} +} + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumFrameData.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumFrameData.h new file mode 100644 index 0000000000..ccaccaa887 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumFrameData.h @@ -0,0 +1,46 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//==- DIAEnumFrameData.h --------------------------------------- -*- C++ -*-==// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAENUMFRAMEDATA_H +#define LLVM_DEBUGINFO_PDB_DIA_DIAENUMFRAMEDATA_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" +#include "llvm/DebugInfo/PDB/IPDBFrameData.h" + +namespace llvm { +namespace pdb { + +class DIAEnumFrameData : public IPDBEnumChildren<IPDBFrameData> { +public: + explicit DIAEnumFrameData(CComPtr<IDiaEnumFrameData> DiaEnumerator); + + uint32_t getChildCount() const override; + ChildTypePtr getChildAtIndex(uint32_t Index) const override; + ChildTypePtr getNext() override; + void reset() override; + +private: + CComPtr<IDiaEnumFrameData> Enumerator; +}; + +} // namespace pdb +} // namespace llvm + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumInjectedSources.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumInjectedSources.h new file mode 100644 index 0000000000..4776d02f47 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumInjectedSources.h @@ -0,0 +1,46 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//==- DIAEnumInjectedSources.h - DIA Injected Sources Enumerator -*- C++ -*-==// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAENUMINJECTEDSOURCES_H +#define LLVM_DEBUGINFO_PDB_DIA_DIAENUMINJECTEDSOURCES_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" +#include "llvm/DebugInfo/PDB/IPDBInjectedSource.h" + +namespace llvm { +namespace pdb { + +class DIAEnumInjectedSources : public IPDBEnumChildren<IPDBInjectedSource> { +public: + explicit DIAEnumInjectedSources( + CComPtr<IDiaEnumInjectedSources> DiaEnumerator); + + uint32_t getChildCount() const override; + ChildTypePtr getChildAtIndex(uint32_t Index) const override; + ChildTypePtr getNext() override; + void reset() override; + +private: + CComPtr<IDiaEnumInjectedSources> Enumerator; +}; +} // namespace pdb +} // namespace llvm + +#endif // LLVM_DEBUGINFO_PDB_DIA_DIAENUMINJECTEDSOURCES_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumLineNumbers.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumLineNumbers.h new file mode 100644 index 0000000000..21dbc4b127 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumLineNumbers.h @@ -0,0 +1,46 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//==- DIAEnumLineNumbers.h - DIA Line Number Enumerator impl -----*- C++ -*-==// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAENUMLINENUMBERS_H +#define LLVM_DEBUGINFO_PDB_DIA_DIAENUMLINENUMBERS_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" +#include "llvm/DebugInfo/PDB/IPDBLineNumber.h" + +namespace llvm { +namespace pdb { +class IPDBLineNumber; + +class DIAEnumLineNumbers : public IPDBEnumChildren<IPDBLineNumber> { +public: + explicit DIAEnumLineNumbers(CComPtr<IDiaEnumLineNumbers> DiaEnumerator); + + uint32_t getChildCount() const override; + ChildTypePtr getChildAtIndex(uint32_t Index) const override; + ChildTypePtr getNext() override; + void reset() override; + +private: + CComPtr<IDiaEnumLineNumbers> Enumerator; +}; +} +} + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumSectionContribs.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumSectionContribs.h new file mode 100644 index 0000000000..2e44bb48ac --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumSectionContribs.h @@ -0,0 +1,49 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//==- DIAEnumSectionContribs.h --------------------------------- -*- C++ -*-==// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAENUMSECTIONCONTRIBS_H +#define LLVM_DEBUGINFO_PDB_DIA_DIAENUMSECTIONCONTRIBS_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" +#include "llvm/DebugInfo/PDB/IPDBSectionContrib.h" + +namespace llvm { +namespace pdb { +class DIASession; + +class DIAEnumSectionContribs : public IPDBEnumChildren<IPDBSectionContrib> { +public: + explicit DIAEnumSectionContribs( + const DIASession &PDBSession, + CComPtr<IDiaEnumSectionContribs> DiaEnumerator); + + uint32_t getChildCount() const override; + ChildTypePtr getChildAtIndex(uint32_t Index) const override; + ChildTypePtr getNext() override; + void reset() override; + +private: + const DIASession &Session; + CComPtr<IDiaEnumSectionContribs> Enumerator; +}; +} // namespace pdb +} // namespace llvm + +#endif // LLVM_DEBUGINFO_PDB_DIA_DIAENUMSECTIONCONTRIBS_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumSourceFiles.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumSourceFiles.h new file mode 100644 index 0000000000..43ea2df383 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumSourceFiles.h @@ -0,0 +1,48 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//==- DIAEnumSourceFiles.h - DIA Source File Enumerator impl -----*- C++ -*-==// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAENUMSOURCEFILES_H +#define LLVM_DEBUGINFO_PDB_DIA_DIAENUMSOURCEFILES_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" +#include "llvm/DebugInfo/PDB/IPDBSourceFile.h" + +namespace llvm { +namespace pdb { +class DIASession; + +class DIAEnumSourceFiles : public IPDBEnumChildren<IPDBSourceFile> { +public: + explicit DIAEnumSourceFiles(const DIASession &PDBSession, + CComPtr<IDiaEnumSourceFiles> DiaEnumerator); + + uint32_t getChildCount() const override; + ChildTypePtr getChildAtIndex(uint32_t Index) const override; + ChildTypePtr getNext() override; + void reset() override; + +private: + const DIASession &Session; + CComPtr<IDiaEnumSourceFiles> Enumerator; +}; +} +} + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h new file mode 100644 index 0000000000..d8df677665 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h @@ -0,0 +1,48 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//==- DIAEnumSymbols.h - DIA Symbol Enumerator impl --------------*- C++ -*-==// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAENUMSYMBOLS_H +#define LLVM_DEBUGINFO_PDB_DIA_DIAENUMSYMBOLS_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" +#include "llvm/DebugInfo/PDB/PDBSymbol.h" + +namespace llvm { +namespace pdb { +class DIASession; + +class DIAEnumSymbols : public IPDBEnumChildren<PDBSymbol> { +public: + explicit DIAEnumSymbols(const DIASession &Session, + CComPtr<IDiaEnumSymbols> DiaEnumerator); + + uint32_t getChildCount() const override; + std::unique_ptr<PDBSymbol> getChildAtIndex(uint32_t Index) const override; + std::unique_ptr<PDBSymbol> getNext() override; + void reset() override; + +private: + const DIASession &Session; + CComPtr<IDiaEnumSymbols> Enumerator; +}; +} +} + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumTables.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumTables.h new file mode 100644 index 0000000000..b4d41eb392 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAEnumTables.h @@ -0,0 +1,46 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DIAEnumTables.h - DIA Tables Enumerator Impl -------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAENUMTABLES_H +#define LLVM_DEBUGINFO_PDB_DIA_DIAENUMTABLES_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" +#include "llvm/DebugInfo/PDB/IPDBTable.h" + +namespace llvm { +namespace pdb { +class IPDBTable; + +class DIAEnumTables : public IPDBEnumChildren<IPDBTable> { +public: + explicit DIAEnumTables(CComPtr<IDiaEnumTables> DiaEnumerator); + + uint32_t getChildCount() const override; + std::unique_ptr<IPDBTable> getChildAtIndex(uint32_t Index) const override; + std::unique_ptr<IPDBTable> getNext() override; + void reset() override; + +private: + CComPtr<IDiaEnumTables> Enumerator; +}; +} +} + +#endif // LLVM_DEBUGINFO_PDB_DIA_DIAENUMTABLES_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAError.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAError.h new file mode 100644 index 0000000000..0c3342967e --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAError.h @@ -0,0 +1,61 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DIAError.h - Error extensions for PDB DIA implementation -*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAERROR_H +#define LLVM_DEBUGINFO_PDB_DIA_DIAERROR_H + +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/Error.h" + +namespace llvm { +namespace pdb { +enum class dia_error_code { + unspecified = 1, + could_not_create_impl, + invalid_file_format, + invalid_parameter, + already_loaded, + debug_info_mismatch, +}; +} // namespace pdb +} // namespace llvm + +namespace std { +template <> +struct is_error_code_enum<llvm::pdb::dia_error_code> : std::true_type {}; +} // namespace std + +namespace llvm { +namespace pdb { +const std::error_category &DIAErrCategory(); + +inline std::error_code make_error_code(dia_error_code E) { + return std::error_code(static_cast<int>(E), DIAErrCategory()); +} + +/// Base class for errors originating in DIA SDK, e.g. COM calls +class DIAError : public ErrorInfo<DIAError, StringError> { +public: + using ErrorInfo<DIAError, StringError>::ErrorInfo; + DIAError(const Twine &S) : ErrorInfo(S, dia_error_code::unspecified) {} + static char ID; +}; +} // namespace pdb +} // namespace llvm +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAFrameData.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAFrameData.h new file mode 100644 index 0000000000..104017577f --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAFrameData.h @@ -0,0 +1,49 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DIAFrameData.h - DIA Impl. of IPDBFrameData ---------------- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAFRAMEDATA_H +#define LLVM_DEBUGINFO_PDB_DIA_DIAFRAMEDATA_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBFrameData.h" + +namespace llvm { +namespace pdb { + +class DIASession; + +class DIAFrameData : public IPDBFrameData { +public: + explicit DIAFrameData(CComPtr<IDiaFrameData> DiaFrameData); + + uint32_t getAddressOffset() const override; + uint32_t getAddressSection() const override; + uint32_t getLengthBlock() const override; + std::string getProgram() const override; + uint32_t getRelativeVirtualAddress() const override; + uint64_t getVirtualAddress() const override; + +private: + CComPtr<IDiaFrameData> FrameData; +}; + +} // namespace pdb +} // namespace llvm + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAInjectedSource.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAInjectedSource.h new file mode 100644 index 0000000000..fd1732f811 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAInjectedSource.h @@ -0,0 +1,48 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DIAInjectedSource.h - DIA impl for IPDBInjectedSource ----*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAINJECTEDSOURCE_H +#define LLVM_DEBUGINFO_PDB_DIA_DIAINJECTEDSOURCE_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBInjectedSource.h" + +namespace llvm { +namespace pdb { +class DIASession; + +class DIAInjectedSource : public IPDBInjectedSource { +public: + explicit DIAInjectedSource(CComPtr<IDiaInjectedSource> DiaSourceFile); + + uint32_t getCrc32() const override; + uint64_t getCodeByteSize() const override; + std::string getFileName() const override; + std::string getObjectFileName() const override; + std::string getVirtualFileName() const override; + uint32_t getCompression() const override; + std::string getCode() const override; + +private: + CComPtr<IDiaInjectedSource> SourceFile; +}; +} // namespace pdb +} // namespace llvm + +#endif // LLVM_DEBUGINFO_PDB_DIA_DIAINJECTEDSOURCE_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIALineNumber.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIALineNumber.h new file mode 100644 index 0000000000..42db84a6ea --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIALineNumber.h @@ -0,0 +1,50 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DIALineNumber.h - DIA implementation of IPDBLineNumber ---*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIALINENUMBER_H +#define LLVM_DEBUGINFO_PDB_DIA_DIALINENUMBER_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBLineNumber.h" + +namespace llvm { +namespace pdb { +class DIALineNumber : public IPDBLineNumber { +public: + explicit DIALineNumber(CComPtr<IDiaLineNumber> DiaLineNumber); + + uint32_t getLineNumber() const override; + uint32_t getLineNumberEnd() const override; + uint32_t getColumnNumber() const override; + uint32_t getColumnNumberEnd() const override; + uint32_t getAddressSection() const override; + uint32_t getAddressOffset() const override; + uint32_t getRelativeVirtualAddress() const override; + uint64_t getVirtualAddress() const override; + uint32_t getLength() const override; + uint32_t getSourceFileId() const override; + uint32_t getCompilandId() const override; + bool isStatement() const override; + +private: + CComPtr<IDiaLineNumber> LineNumber; +}; +} +} +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h new file mode 100644 index 0000000000..0b3c91431b --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h @@ -0,0 +1,244 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DIARawSymbol.h - DIA implementation of IPDBRawSymbol ----*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIARAWSYMBOL_H +#define LLVM_DEBUGINFO_PDB_DIA_DIARAWSYMBOL_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h" + +namespace llvm { +namespace pdb { +class DIASession; +class DIARawSymbol : public IPDBRawSymbol { +public: + DIARawSymbol(const DIASession &PDBSession, CComPtr<IDiaSymbol> DiaSymbol); + + void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields, + PdbSymbolIdField RecurseIdFields) const override; + + CComPtr<IDiaSymbol> getDiaSymbol() const { return Symbol; } + + std::unique_ptr<IPDBEnumSymbols> + findChildren(PDB_SymType Type) const override; + std::unique_ptr<IPDBEnumSymbols> + findChildren(PDB_SymType Type, StringRef Name, + PDB_NameSearchFlags Flags) const override; + std::unique_ptr<IPDBEnumSymbols> + findChildrenByAddr(PDB_SymType Type, StringRef Name, + PDB_NameSearchFlags Flags, + uint32_t Section, uint32_t Offset) const override; + std::unique_ptr<IPDBEnumSymbols> + findChildrenByVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, + uint64_t VA) const override; + std::unique_ptr<IPDBEnumSymbols> + findChildrenByRVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, + uint32_t RVA) const override; + + std::unique_ptr<IPDBEnumSymbols> + findInlineFramesByAddr(uint32_t Section, uint32_t Offset) const override; + std::unique_ptr<IPDBEnumSymbols> + findInlineFramesByRVA(uint32_t RVA) const override; + std::unique_ptr<IPDBEnumSymbols> + findInlineFramesByVA(uint64_t VA) const override; + + std::unique_ptr<IPDBEnumLineNumbers> findInlineeLines() const override; + std::unique_ptr<IPDBEnumLineNumbers> + findInlineeLinesByAddr(uint32_t Section, uint32_t Offset, + uint32_t Length) const override; + std::unique_ptr<IPDBEnumLineNumbers> + findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const override; + std::unique_ptr<IPDBEnumLineNumbers> + findInlineeLinesByVA(uint64_t VA, uint32_t Length) const override; + + void getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes) const override; + void getFrontEndVersion(VersionInfo &Version) const override; + void getBackEndVersion(VersionInfo &Version) const override; + PDB_MemberAccess getAccess() const override; + uint32_t getAddressOffset() const override; + uint32_t getAddressSection() const override; + uint32_t getAge() const override; + SymIndexId getArrayIndexTypeId() const override; + uint32_t getBaseDataOffset() const override; + uint32_t getBaseDataSlot() const override; + SymIndexId getBaseSymbolId() const override; + PDB_BuiltinType getBuiltinType() const override; + uint32_t getBitPosition() const override; + PDB_CallingConv getCallingConvention() const override; + SymIndexId getClassParentId() const override; + std::string getCompilerName() const override; + uint32_t getCount() const override; + uint32_t getCountLiveRanges() const override; + PDB_Lang getLanguage() const override; + SymIndexId getLexicalParentId() const override; + std::string getLibraryName() const override; + uint32_t getLiveRangeStartAddressOffset() const override; + uint32_t getLiveRangeStartAddressSection() const override; + uint32_t getLiveRangeStartRelativeVirtualAddress() const override; + codeview::RegisterId getLocalBasePointerRegisterId() const override; + SymIndexId getLowerBoundId() const override; + uint32_t getMemorySpaceKind() const override; + std::string getName() const override; + uint32_t getNumberOfAcceleratorPointerTags() const override; + uint32_t getNumberOfColumns() const override; + uint32_t getNumberOfModifiers() const override; + uint32_t getNumberOfRegisterIndices() const override; + uint32_t getNumberOfRows() const override; + std::string getObjectFileName() const override; + uint32_t getOemId() const override; + SymIndexId getOemSymbolId() const override; + uint32_t getOffsetInUdt() const override; + PDB_Cpu getPlatform() const override; + uint32_t getRank() const override; + codeview::RegisterId getRegisterId() const override; + uint32_t getRegisterType() const override; + uint32_t getRelativeVirtualAddress() const override; + uint32_t getSamplerSlot() const override; + uint32_t getSignature() const override; + uint32_t getSizeInUdt() const override; + uint32_t getSlot() const override; + std::string getSourceFileName() const override; + std::unique_ptr<IPDBLineNumber> getSrcLineOnTypeDefn() const override; + uint32_t getStride() const override; + SymIndexId getSubTypeId() const override; + std::string getSymbolsFileName() const override; + SymIndexId getSymIndexId() const override; + uint32_t getTargetOffset() const override; + uint32_t getTargetRelativeVirtualAddress() const override; + uint64_t getTargetVirtualAddress() const override; + uint32_t getTargetSection() const override; + uint32_t getTextureSlot() const override; + uint32_t getTimeStamp() const override; + uint32_t getToken() const override; + SymIndexId getTypeId() const override; + uint32_t getUavSlot() const override; + std::string getUndecoratedName() const override; + std::string getUndecoratedNameEx(PDB_UndnameFlags Flags) const override; + SymIndexId getUnmodifiedTypeId() const override; + SymIndexId getUpperBoundId() const override; + Variant getValue() const override; + uint32_t getVirtualBaseDispIndex() const override; + uint32_t getVirtualBaseOffset() const override; + SymIndexId getVirtualTableShapeId() const override; + std::unique_ptr<PDBSymbolTypeBuiltin> + getVirtualBaseTableType() const override; + PDB_DataKind getDataKind() const override; + PDB_SymType getSymTag() const override; + codeview::GUID getGuid() const override; + int32_t getOffset() const override; + int32_t getThisAdjust() const override; + int32_t getVirtualBasePointerOffset() const override; + PDB_LocType getLocationType() const override; + PDB_Machine getMachineType() const override; + codeview::ThunkOrdinal getThunkOrdinal() const override; + uint64_t getLength() const override; + uint64_t getLiveRangeLength() const override; + uint64_t getVirtualAddress() const override; + PDB_UdtType getUdtKind() const override; + bool hasConstructor() const override; + bool hasCustomCallingConvention() const override; + bool hasFarReturn() const override; + bool isCode() const override; + bool isCompilerGenerated() const override; + bool isConstType() const override; + bool isEditAndContinueEnabled() const override; + bool isFunction() const override; + bool getAddressTaken() const override; + bool getNoStackOrdering() const override; + bool hasAlloca() const override; + bool hasAssignmentOperator() const override; + bool hasCTypes() const override; + bool hasCastOperator() const override; + bool hasDebugInfo() const override; + bool hasEH() const override; + bool hasEHa() const override; + bool hasInlAsm() const override; + bool hasInlineAttribute() const override; + bool hasInterruptReturn() const override; + bool hasFramePointer() const override; + bool hasLongJump() const override; + bool hasManagedCode() const override; + bool hasNestedTypes() const override; + bool hasNoInlineAttribute() const override; + bool hasNoReturnAttribute() const override; + bool hasOptimizedCodeDebugInfo() const override; + bool hasOverloadedOperator() const override; + bool hasSEH() const override; + bool hasSecurityChecks() const override; + bool hasSetJump() const override; + bool hasStrictGSCheck() const override; + bool isAcceleratorGroupSharedLocal() const override; + bool isAcceleratorPointerTagLiveRange() const override; + bool isAcceleratorStubFunction() const override; + bool isAggregated() const override; + bool isIntroVirtualFunction() const override; + bool isCVTCIL() const override; + bool isConstructorVirtualBase() const override; + bool isCxxReturnUdt() const override; + bool isDataAligned() const override; + bool isHLSLData() const override; + bool isHotpatchable() const override; + bool isIndirectVirtualBaseClass() const override; + bool isInterfaceUdt() const override; + bool isIntrinsic() const override; + bool isLTCG() const override; + bool isLocationControlFlowDependent() const override; + bool isMSILNetmodule() const override; + bool isMatrixRowMajor() const override; + bool isManagedCode() const override; + bool isMSILCode() const override; + bool isMultipleInheritance() const override; + bool isNaked() const override; + bool isNested() const override; + bool isOptimizedAway() const override; + bool isPacked() const override; + bool isPointerBasedOnSymbolValue() const override; + bool isPointerToDataMember() const override; + bool isPointerToMemberFunction() const override; + bool isPureVirtual() const override; + bool isRValueReference() const override; + bool isRefUdt() const override; + bool isReference() const override; + bool isRestrictedType() const override; + bool isReturnValue() const override; + bool isSafeBuffers() const override; + bool isScoped() const override; + bool isSdl() const override; + bool isSingleInheritance() const override; + bool isSplitted() const override; + bool isStatic() const override; + bool hasPrivateSymbols() const override; + bool isUnalignedType() const override; + bool isUnreached() const override; + bool isValueUdt() const override; + bool isVirtual() const override; + bool isVirtualBaseClass() const override; + bool isVirtualInheritance() const override; + bool isVolatileType() const override; + bool wasInlined() const override; + std::string getUnused() const override; + +private: + const DIASession &Session; + CComPtr<IDiaSymbol> Symbol; +}; +} +} + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIASectionContrib.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIASectionContrib.h new file mode 100644 index 0000000000..af2d7b788a --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIASectionContrib.h @@ -0,0 +1,65 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DIASectionContrib.h - DIA Impl. of IPDBSectionContrib ------ C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIASECTIONCONTRIB_H +#define LLVM_DEBUGINFO_PDB_DIA_DIASECTIONCONTRIB_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBSectionContrib.h" + +namespace llvm { +namespace pdb { +class DIASession; + +class DIASectionContrib : public IPDBSectionContrib { +public: + explicit DIASectionContrib(const DIASession &PDBSession, + CComPtr<IDiaSectionContrib> DiaSection); + + std::unique_ptr<PDBSymbolCompiland> getCompiland() const override; + uint32_t getAddressSection() const override; + uint32_t getAddressOffset() const override; + uint32_t getRelativeVirtualAddress() const override; + uint64_t getVirtualAddress() const override; + uint32_t getLength() const override; + bool isNotPaged() const override; + bool hasCode() const override; + bool hasCode16Bit() const override; + bool hasInitializedData() const override; + bool hasUninitializedData() const override; + bool isRemoved() const override; + bool hasComdat() const override; + bool isDiscardable() const override; + bool isNotCached() const override; + bool isShared() const override; + bool isExecutable() const override; + bool isReadable() const override; + bool isWritable() const override; + uint32_t getDataCrc32() const override; + uint32_t getRelocationsCrc32() const override; + uint32_t getCompilandId() const override; + +private: + const DIASession &Session; + CComPtr<IDiaSectionContrib> Section; +}; +} // namespace pdb +} // namespace llvm + +#endif // LLVM_DEBUGINFO_PDB_DIA_DIASECTIONCONTRIB_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIASession.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIASession.h new file mode 100644 index 0000000000..48b167843f --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIASession.h @@ -0,0 +1,104 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DIASession.h - DIA implementation of IPDBSession ---------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIASESSION_H +#define LLVM_DEBUGINFO_PDB_DIA_DIASESSION_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBSession.h" +#include "llvm/Support/Error.h" + +#include <system_error> + +namespace llvm { +class StringRef; + +namespace pdb { +class DIASession : public IPDBSession { +public: + explicit DIASession(CComPtr<IDiaSession> DiaSession); + + static Error createFromPdb(StringRef Path, + std::unique_ptr<IPDBSession> &Session); + static Error createFromExe(StringRef Path, + std::unique_ptr<IPDBSession> &Session); + + uint64_t getLoadAddress() const override; + bool setLoadAddress(uint64_t Address) override; + std::unique_ptr<PDBSymbolExe> getGlobalScope() override; + std::unique_ptr<PDBSymbol> getSymbolById(SymIndexId SymbolId) const override; + + bool addressForVA(uint64_t VA, uint32_t &Section, + uint32_t &Offset) const override; + bool addressForRVA(uint32_t RVA, uint32_t &Section, + uint32_t &Offset) const override; + + std::unique_ptr<PDBSymbol> findSymbolByAddress(uint64_t Address, + PDB_SymType Type) override; + std::unique_ptr<PDBSymbol> findSymbolByRVA(uint32_t RVA, + PDB_SymType Type) override; + std::unique_ptr<PDBSymbol> findSymbolBySectOffset(uint32_t Section, + uint32_t Offset, + PDB_SymType Type) override; + + std::unique_ptr<IPDBEnumLineNumbers> + findLineNumbers(const PDBSymbolCompiland &Compiland, + const IPDBSourceFile &File) const override; + std::unique_ptr<IPDBEnumLineNumbers> + findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override; + std::unique_ptr<IPDBEnumLineNumbers> + findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const override; + std::unique_ptr<IPDBEnumLineNumbers> + findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, + uint32_t Length) const override; + + std::unique_ptr<IPDBEnumSourceFiles> + findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, + PDB_NameSearchFlags Flags) const override; + std::unique_ptr<IPDBSourceFile> + findOneSourceFile(const PDBSymbolCompiland *Compiland, + llvm::StringRef Pattern, + PDB_NameSearchFlags Flags) const override; + std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>> + findCompilandsForSourceFile(llvm::StringRef Pattern, + PDB_NameSearchFlags Flags) const override; + std::unique_ptr<PDBSymbolCompiland> + findOneCompilandForSourceFile(llvm::StringRef Pattern, + PDB_NameSearchFlags Flags) const override; + std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const override; + std::unique_ptr<IPDBEnumSourceFiles> getSourceFilesForCompiland( + const PDBSymbolCompiland &Compiland) const override; + std::unique_ptr<IPDBSourceFile> + getSourceFileById(uint32_t FileId) const override; + + std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const override; + + std::unique_ptr<IPDBEnumTables> getEnumTables() const override; + + std::unique_ptr<IPDBEnumInjectedSources> getInjectedSources() const override; + + std::unique_ptr<IPDBEnumSectionContribs> getSectionContribs() const override; + + std::unique_ptr<IPDBEnumFrameData> getFrameData() const override; +private: + CComPtr<IDiaSession> Session; +}; +} // namespace pdb +} // namespace llvm +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIASourceFile.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIASourceFile.h new file mode 100644 index 0000000000..46e1a2b96c --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIASourceFile.h @@ -0,0 +1,51 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DIASourceFile.h - DIA implementation of IPDBSourceFile ---*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIASOURCEFILE_H +#define LLVM_DEBUGINFO_PDB_DIA_DIASOURCEFILE_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBSourceFile.h" + +namespace llvm { +namespace pdb { +class DIASession; + +class DIASourceFile : public IPDBSourceFile { +public: + explicit DIASourceFile(const DIASession &Session, + CComPtr<IDiaSourceFile> DiaSourceFile); + + std::string getFileName() const override; + uint32_t getUniqueId() const override; + std::string getChecksum() const override; + PDB_Checksum getChecksumType() const override; + std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>> + getCompilands() const override; + + CComPtr<IDiaSourceFile> getDiaFile() const { return SourceFile; } + +private: + const DIASession &Session; + CComPtr<IDiaSourceFile> SourceFile; +}; +} +} + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIASupport.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIASupport.h new file mode 100644 index 0000000000..3e01baaf9c --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIASupport.h @@ -0,0 +1,51 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DIASupport.h - Common header includes for DIA ------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// Common defines and header includes for all LLVMDebugInfoPDBDIA. The +// definitions here configure the necessary #defines and include system headers +// in the proper order for using DIA. +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIASUPPORT_H +#define LLVM_DEBUGINFO_PDB_DIA_DIASUPPORT_H + +// Require at least Vista +#define NTDDI_VERSION NTDDI_VISTA +#define _WIN32_WINNT _WIN32_WINNT_VISTA +#define WINVER _WIN32_WINNT_VISTA +#ifndef NOMINMAX +#define NOMINMAX +#endif + +// atlbase.h has to come before windows.h +#include <atlbase.h> +#include <windows.h> + +// DIA headers must come after windows headers. +#include <cvconst.h> +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif +#include <dia2.h> +#ifdef __clang__ +#pragma clang diagnostic pop +#endif +#include <diacreate.h> + +#endif // LLVM_DEBUGINFO_PDB_DIA_DIASUPPORT_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIATable.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIATable.h new file mode 100644 index 0000000000..97085ae5c9 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIATable.h @@ -0,0 +1,42 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DIATable.h - DIA implementation of IPDBTable -------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIATABLE_H +#define LLVM_DEBUGINFO_PDB_DIA_DIATABLE_H + +#include "DIASupport.h" +#include "llvm/DebugInfo/PDB/IPDBTable.h" + +namespace llvm { +namespace pdb { +class DIATable : public IPDBTable { +public: + explicit DIATable(CComPtr<IDiaTable> DiaTable); + + uint32_t getItemCount() const override; + std::string getName() const override; + PDB_TableType getTableType() const override; + +private: + CComPtr<IDiaTable> Table; +}; +} +} + +#endif // LLVM_DEBUGINFO_PDB_DIA_DIATABLE_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAUtils.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAUtils.h new file mode 100644 index 0000000000..fe0bd1b612 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/DIA/DIAUtils.h @@ -0,0 +1,41 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- DIAUtils.h - Utility functions for working with DIA ------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAUTILS_H +#define LLVM_DEBUGINFO_PDB_DIA_DIAUTILS_H + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/ConvertUTF.h" + +template <typename Obj> +std::string invokeBstrMethod(Obj &Object, + HRESULT (__stdcall Obj::*Func)(BSTR *)) { + CComBSTR Str16; + HRESULT Result = (Object.*Func)(&Str16); + if (S_OK != Result) + return std::string(); + + std::string Str8; + llvm::ArrayRef<char> StrBytes(reinterpret_cast<char *>(Str16.m_str), + Str16.ByteLength()); + llvm::convertUTF16ToUTF8String(StrBytes, Str8); + return Str8; +} + +#endif // LLVM_DEBUGINFO_PDB_DIA_DIAUTILS_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/Native/Formatters.h b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/Native/Formatters.h new file mode 100644 index 0000000000..d5fd6a83d0 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/DebugInfo/PDB/Native/Formatters.h @@ -0,0 +1,55 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- Formatters.h ---------------------------------------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_NATIVE_FORMATTERS_H +#define LLVM_DEBUGINFO_PDB_NATIVE_FORMATTERS_H + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/DebugInfo/CodeView/Formatters.h" +#include "llvm/DebugInfo/PDB/Native/RawConstants.h" +#include "llvm/DebugInfo/PDB/Native/RawTypes.h" +#include "llvm/Support/FormatProviders.h" + +#define FORMAT_CASE(Value, Name) \ + case Value: \ + Stream << Name; \ + break; + +namespace llvm { +template <> struct format_provider<pdb::PdbRaw_ImplVer> { + static void format(const pdb::PdbRaw_ImplVer &V, llvm::raw_ostream &Stream, + StringRef Style) { + switch (V) { + FORMAT_CASE(pdb::PdbRaw_ImplVer::PdbImplVC110, "VC110") + FORMAT_CASE(pdb::PdbRaw_ImplVer::PdbImplVC140, "VC140") + FORMAT_CASE(pdb::PdbRaw_ImplVer::PdbImplVC2, "VC2") + FORMAT_CASE(pdb::PdbRaw_ImplVer::PdbImplVC4, "VC4") + FORMAT_CASE(pdb::PdbRaw_ImplVer::PdbImplVC41, "VC41") + FORMAT_CASE(pdb::PdbRaw_ImplVer::PdbImplVC50, "VC50") + FORMAT_CASE(pdb::PdbRaw_ImplVer::PdbImplVC70, "VC70") + FORMAT_CASE(pdb::PdbRaw_ImplVer::PdbImplVC70Dep, "VC70Dep") + FORMAT_CASE(pdb::PdbRaw_ImplVer::PdbImplVC80, "VC80") + FORMAT_CASE(pdb::PdbRaw_ImplVer::PdbImplVC98, "VC98") + } + } +}; +} + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/ExecutionEngine/OProfileWrapper.h b/contrib/libs/llvm16/include/llvm/ExecutionEngine/OProfileWrapper.h new file mode 100644 index 0000000000..8993cf64a6 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/ExecutionEngine/OProfileWrapper.h @@ -0,0 +1,134 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- OProfileWrapper.h - OProfile JIT API Wrapper ------------*- C++ -*-===// +// +// 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 file defines a OProfileWrapper object that detects if the oprofile +// daemon is running, and provides wrappers for opagent functions used to +// communicate with the oprofile JIT interface. The dynamic library libopagent +// does not need to be linked directly as this object lazily loads the library +// when the first op_ function is called. +// +// See http://oprofile.sourceforge.net/doc/devel/jit-interface.html for the +// definition of the interface. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_EXECUTIONENGINE_OPROFILEWRAPPER_H +#define LLVM_EXECUTIONENGINE_OPROFILEWRAPPER_H + +#include "llvm/Support/DataTypes.h" +#include <opagent.h> + +namespace llvm { + + +class OProfileWrapper { + typedef op_agent_t (*op_open_agent_ptr_t)(); + typedef int (*op_close_agent_ptr_t)(op_agent_t); + typedef int (*op_write_native_code_ptr_t)(op_agent_t, + const char*, + uint64_t, + void const*, + const unsigned int); + typedef int (*op_write_debug_line_info_ptr_t)(op_agent_t, + void const*, + size_t, + struct debug_line_info const*); + typedef int (*op_unload_native_code_ptr_t)(op_agent_t, uint64_t); + + // Also used for op_minor_version function which has the same signature + typedef int (*op_major_version_ptr_t)(); + + // This is not a part of the opagent API, but is useful nonetheless + typedef bool (*IsOProfileRunningPtrT)(); + + + op_agent_t Agent; + op_open_agent_ptr_t OpenAgentFunc; + op_close_agent_ptr_t CloseAgentFunc; + op_write_native_code_ptr_t WriteNativeCodeFunc; + op_write_debug_line_info_ptr_t WriteDebugLineInfoFunc; + op_unload_native_code_ptr_t UnloadNativeCodeFunc; + op_major_version_ptr_t MajorVersionFunc; + op_major_version_ptr_t MinorVersionFunc; + IsOProfileRunningPtrT IsOProfileRunningFunc; + + bool Initialized; + +public: + OProfileWrapper(); + + // For testing with a mock opagent implementation, skips the dynamic load and + // the function resolution. + OProfileWrapper(op_open_agent_ptr_t OpenAgentImpl, + op_close_agent_ptr_t CloseAgentImpl, + op_write_native_code_ptr_t WriteNativeCodeImpl, + op_write_debug_line_info_ptr_t WriteDebugLineInfoImpl, + op_unload_native_code_ptr_t UnloadNativeCodeImpl, + op_major_version_ptr_t MajorVersionImpl, + op_major_version_ptr_t MinorVersionImpl, + IsOProfileRunningPtrT MockIsOProfileRunningImpl = 0) + : OpenAgentFunc(OpenAgentImpl), + CloseAgentFunc(CloseAgentImpl), + WriteNativeCodeFunc(WriteNativeCodeImpl), + WriteDebugLineInfoFunc(WriteDebugLineInfoImpl), + UnloadNativeCodeFunc(UnloadNativeCodeImpl), + MajorVersionFunc(MajorVersionImpl), + MinorVersionFunc(MinorVersionImpl), + IsOProfileRunningFunc(MockIsOProfileRunningImpl), + Initialized(true) + { + } + + // Calls op_open_agent in the oprofile JIT library and saves the returned + // op_agent_t handle internally so it can be used when calling all the other + // op_* functions. Callers of this class do not need to keep track of + // op_agent_t objects. + bool op_open_agent(); + + int op_close_agent(); + int op_write_native_code(const char* name, + uint64_t addr, + void const* code, + const unsigned int size); + int op_write_debug_line_info(void const* code, + size_t num_entries, + struct debug_line_info const* info); + int op_unload_native_code(uint64_t addr); + int op_major_version(); + int op_minor_version(); + + // Returns true if the oprofiled process is running, the opagent library is + // loaded and a connection to the agent has been established, and false + // otherwise. + bool isAgentAvailable(); + +private: + // Loads the libopagent library and initializes this wrapper if the oprofile + // daemon is running + bool initialize(); + + // Searches /proc for the oprofile daemon and returns true if the process if + // found, or false otherwise. + bool checkForOProfileProcEntry(); + + bool isOProfileRunning(); +}; + +} // namespace llvm + +#endif // LLVM_EXECUTIONENGINE_OPROFILEWRAPPER_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/Frontend/OpenMP/OMP.inc b/contrib/libs/llvm16/include/llvm/Frontend/OpenMP/OMP.inc new file mode 100644 index 0000000000..09ca8e6666 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Frontend/OpenMP/OMP.inc @@ -0,0 +1,8441 @@ +#ifdef GEN_FLANG_DIRECTIVE_CLAUSE_SETS +#undef GEN_FLANG_DIRECTIVE_CLAUSE_SETS + +namespace llvm { +namespace omp { + + // Sets for allocate + + static OmpClauseSet allowedClauses_OMPD_allocate { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_allocate { + llvm::omp::Clause::OMPC_allocator, + llvm::omp::Clause::OMPC_align, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_allocate { + }; + + static OmpClauseSet requiredClauses_OMPD_allocate { + }; + + // Sets for assumes + + static OmpClauseSet allowedClauses_OMPD_assumes { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_assumes { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_assumes { + }; + + static OmpClauseSet requiredClauses_OMPD_assumes { + }; + + // Sets for atomic + + static OmpClauseSet allowedClauses_OMPD_atomic { + llvm::omp::Clause::OMPC_read, + llvm::omp::Clause::OMPC_write, + llvm::omp::Clause::OMPC_update, + llvm::omp::Clause::OMPC_capture, + llvm::omp::Clause::OMPC_compare, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_atomic { + llvm::omp::Clause::OMPC_seq_cst, + llvm::omp::Clause::OMPC_acq_rel, + llvm::omp::Clause::OMPC_acquire, + llvm::omp::Clause::OMPC_release, + llvm::omp::Clause::OMPC_relaxed, + llvm::omp::Clause::OMPC_hint, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_atomic { + }; + + static OmpClauseSet requiredClauses_OMPD_atomic { + }; + + // Sets for barrier + + static OmpClauseSet allowedClauses_OMPD_barrier { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_barrier { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_barrier { + }; + + static OmpClauseSet requiredClauses_OMPD_barrier { + }; + + // Sets for begin assumes + + static OmpClauseSet allowedClauses_OMPD_begin_assumes { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_begin_assumes { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_begin_assumes { + }; + + static OmpClauseSet requiredClauses_OMPD_begin_assumes { + }; + + // Sets for begin declare target + + static OmpClauseSet allowedClauses_OMPD_begin_declare_target { + llvm::omp::Clause::OMPC_to, + llvm::omp::Clause::OMPC_link, + llvm::omp::Clause::OMPC_device_type, + llvm::omp::Clause::OMPC_indirect, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_begin_declare_target { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_begin_declare_target { + }; + + static OmpClauseSet requiredClauses_OMPD_begin_declare_target { + }; + + // Sets for begin declare variant + + static OmpClauseSet allowedClauses_OMPD_begin_declare_variant { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_begin_declare_variant { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_begin_declare_variant { + }; + + static OmpClauseSet requiredClauses_OMPD_begin_declare_variant { + }; + + // Sets for cancel + + static OmpClauseSet allowedClauses_OMPD_cancel { + llvm::omp::Clause::OMPC_if, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_cancel { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_cancel { + }; + + static OmpClauseSet requiredClauses_OMPD_cancel { + }; + + // Sets for cancellation point + + static OmpClauseSet allowedClauses_OMPD_cancellation_point { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_cancellation_point { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_cancellation_point { + }; + + static OmpClauseSet requiredClauses_OMPD_cancellation_point { + }; + + // Sets for critical + + static OmpClauseSet allowedClauses_OMPD_critical { + llvm::omp::Clause::OMPC_hint, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_critical { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_critical { + }; + + static OmpClauseSet requiredClauses_OMPD_critical { + }; + + // Sets for declare mapper + + static OmpClauseSet allowedClauses_OMPD_declare_mapper { + llvm::omp::Clause::OMPC_map, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_declare_mapper { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_declare_mapper { + }; + + static OmpClauseSet requiredClauses_OMPD_declare_mapper { + }; + + // Sets for declare reduction + + static OmpClauseSet allowedClauses_OMPD_declare_reduction { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_declare_reduction { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_declare_reduction { + }; + + static OmpClauseSet requiredClauses_OMPD_declare_reduction { + }; + + // Sets for declare simd + + static OmpClauseSet allowedClauses_OMPD_declare_simd { + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_uniform, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_declare_simd { + llvm::omp::Clause::OMPC_simdlen, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_declare_simd { + llvm::omp::Clause::OMPC_inbranch, + llvm::omp::Clause::OMPC_notinbranch, + }; + + static OmpClauseSet requiredClauses_OMPD_declare_simd { + }; + + // Sets for declare target + + static OmpClauseSet allowedClauses_OMPD_declare_target { + llvm::omp::Clause::OMPC_to, + llvm::omp::Clause::OMPC_link, + llvm::omp::Clause::OMPC_indirect, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_declare_target { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_declare_target { + }; + + static OmpClauseSet requiredClauses_OMPD_declare_target { + }; + + // Sets for declare variant + + static OmpClauseSet allowedClauses_OMPD_declare_variant { + llvm::omp::Clause::OMPC_match, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_declare_variant { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_declare_variant { + llvm::omp::Clause::OMPC_adjust_args, + llvm::omp::Clause::OMPC_append_args, + }; + + static OmpClauseSet requiredClauses_OMPD_declare_variant { + }; + + // Sets for depobj + + static OmpClauseSet allowedClauses_OMPD_depobj { + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_destroy, + llvm::omp::Clause::OMPC_update, + llvm::omp::Clause::OMPC_depobj, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_depobj { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_depobj { + }; + + static OmpClauseSet requiredClauses_OMPD_depobj { + }; + + // Sets for distribute + + static OmpClauseSet allowedClauses_OMPD_distribute { + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_allocate, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_distribute { + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_distribute { + }; + + static OmpClauseSet requiredClauses_OMPD_distribute { + }; + + // Sets for distribute parallel do + + static OmpClauseSet allowedClauses_OMPD_distribute_parallel_do { + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_linear, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_distribute_parallel_do { + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_ordered, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_distribute_parallel_do { + }; + + static OmpClauseSet requiredClauses_OMPD_distribute_parallel_do { + }; + + // Sets for distribute parallel do simd + + static OmpClauseSet allowedClauses_OMPD_distribute_parallel_do_simd { + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_distribute_parallel_do_simd { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_distribute_parallel_do_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_distribute_parallel_do_simd { + }; + + // Sets for distribute parallel for + + static OmpClauseSet allowedClauses_OMPD_distribute_parallel_for { + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_distribute_parallel_for { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_distribute_parallel_for { + }; + + static OmpClauseSet requiredClauses_OMPD_distribute_parallel_for { + }; + + // Sets for distribute parallel for simd + + static OmpClauseSet allowedClauses_OMPD_distribute_parallel_for_simd { + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_distribute_parallel_for_simd { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_distribute_parallel_for_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_distribute_parallel_for_simd { + }; + + // Sets for distribute simd + + static OmpClauseSet allowedClauses_OMPD_distribute_simd { + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_reduction, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_distribute_simd { + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_distribute_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_distribute_simd { + }; + + // Sets for do + + static OmpClauseSet allowedClauses_OMPD_do { + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_reduction, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_do { + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_nowait, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_do { + }; + + static OmpClauseSet requiredClauses_OMPD_do { + }; + + // Sets for do simd + + static OmpClauseSet allowedClauses_OMPD_do_simd { + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_reduction, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_do_simd { + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_nowait, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_do_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_do_simd { + }; + + // Sets for end assumes + + static OmpClauseSet allowedClauses_OMPD_end_assumes { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_end_assumes { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_end_assumes { + }; + + static OmpClauseSet requiredClauses_OMPD_end_assumes { + }; + + // Sets for end declare target + + static OmpClauseSet allowedClauses_OMPD_end_declare_target { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_end_declare_target { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_end_declare_target { + }; + + static OmpClauseSet requiredClauses_OMPD_end_declare_target { + }; + + // Sets for end declare variant + + static OmpClauseSet allowedClauses_OMPD_end_declare_variant { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_end_declare_variant { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_end_declare_variant { + }; + + static OmpClauseSet requiredClauses_OMPD_end_declare_variant { + }; + + // Sets for end do + + static OmpClauseSet allowedClauses_OMPD_end_do { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_end_do { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_end_do { + }; + + static OmpClauseSet requiredClauses_OMPD_end_do { + }; + + // Sets for end do simd + + static OmpClauseSet allowedClauses_OMPD_end_do_simd { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_end_do_simd { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_end_do_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_end_do_simd { + }; + + // Sets for end sections + + static OmpClauseSet allowedClauses_OMPD_end_sections { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_end_sections { + llvm::omp::Clause::OMPC_nowait, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_end_sections { + }; + + static OmpClauseSet requiredClauses_OMPD_end_sections { + }; + + // Sets for end single + + static OmpClauseSet allowedClauses_OMPD_end_single { + llvm::omp::Clause::OMPC_copyprivate, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_end_single { + llvm::omp::Clause::OMPC_nowait, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_end_single { + }; + + static OmpClauseSet requiredClauses_OMPD_end_single { + }; + + // Sets for end workshare + + static OmpClauseSet allowedClauses_OMPD_end_workshare { + llvm::omp::Clause::OMPC_nowait, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_end_workshare { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_end_workshare { + }; + + static OmpClauseSet requiredClauses_OMPD_end_workshare { + }; + + // Sets for error + + static OmpClauseSet allowedClauses_OMPD_error { + llvm::omp::Clause::OMPC_at, + llvm::omp::Clause::OMPC_severity, + llvm::omp::Clause::OMPC_message, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_error { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_error { + }; + + static OmpClauseSet requiredClauses_OMPD_error { + }; + + // Sets for flush + + static OmpClauseSet allowedClauses_OMPD_flush { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_flush { + llvm::omp::Clause::OMPC_acq_rel, + llvm::omp::Clause::OMPC_acquire, + llvm::omp::Clause::OMPC_release, + llvm::omp::Clause::OMPC_flush, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_flush { + }; + + static OmpClauseSet requiredClauses_OMPD_flush { + }; + + // Sets for for + + static OmpClauseSet allowedClauses_OMPD_for { + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_for { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_for { + }; + + static OmpClauseSet requiredClauses_OMPD_for { + }; + + // Sets for for simd + + static OmpClauseSet allowedClauses_OMPD_for_simd { + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_for_simd { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_for_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_for_simd { + }; + + // Sets for masked taskloop + + static OmpClauseSet allowedClauses_OMPD_masked_taskloop { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_final, + llvm::omp::Clause::OMPC_untied, + llvm::omp::Clause::OMPC_mergeable, + llvm::omp::Clause::OMPC_priority, + llvm::omp::Clause::OMPC_grainsize, + llvm::omp::Clause::OMPC_nogroup, + llvm::omp::Clause::OMPC_num_tasks, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_in_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_filter, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_masked_taskloop { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_masked_taskloop { + }; + + static OmpClauseSet requiredClauses_OMPD_masked_taskloop { + }; + + // Sets for masked taskloop simd + + static OmpClauseSet allowedClauses_OMPD_masked_taskloop_simd { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_final, + llvm::omp::Clause::OMPC_untied, + llvm::omp::Clause::OMPC_mergeable, + llvm::omp::Clause::OMPC_priority, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_grainsize, + llvm::omp::Clause::OMPC_nogroup, + llvm::omp::Clause::OMPC_num_tasks, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_in_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_filter, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_masked_taskloop_simd { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_masked_taskloop_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_masked_taskloop_simd { + }; + + // Sets for master + + static OmpClauseSet allowedClauses_OMPD_master { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_master { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_master { + }; + + static OmpClauseSet requiredClauses_OMPD_master { + }; + + // Sets for master taskloop + + static OmpClauseSet allowedClauses_OMPD_master_taskloop { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_final, + llvm::omp::Clause::OMPC_untied, + llvm::omp::Clause::OMPC_mergeable, + llvm::omp::Clause::OMPC_priority, + llvm::omp::Clause::OMPC_grainsize, + llvm::omp::Clause::OMPC_nogroup, + llvm::omp::Clause::OMPC_num_tasks, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_in_reduction, + llvm::omp::Clause::OMPC_allocate, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_master_taskloop { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_master_taskloop { + }; + + static OmpClauseSet requiredClauses_OMPD_master_taskloop { + }; + + // Sets for master taskloop simd + + static OmpClauseSet allowedClauses_OMPD_master_taskloop_simd { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_final, + llvm::omp::Clause::OMPC_untied, + llvm::omp::Clause::OMPC_mergeable, + llvm::omp::Clause::OMPC_priority, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_grainsize, + llvm::omp::Clause::OMPC_nogroup, + llvm::omp::Clause::OMPC_num_tasks, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_in_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_master_taskloop_simd { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_master_taskloop_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_master_taskloop_simd { + }; + + // Sets for metadirective + + static OmpClauseSet allowedClauses_OMPD_metadirective { + llvm::omp::Clause::OMPC_when, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_metadirective { + llvm::omp::Clause::OMPC_default, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_metadirective { + }; + + static OmpClauseSet requiredClauses_OMPD_metadirective { + }; + + // Sets for nothing + + static OmpClauseSet allowedClauses_OMPD_nothing { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_nothing { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_nothing { + }; + + static OmpClauseSet requiredClauses_OMPD_nothing { + }; + + // Sets for ordered + + static OmpClauseSet allowedClauses_OMPD_ordered { + llvm::omp::Clause::OMPC_depend, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_ordered { + llvm::omp::Clause::OMPC_threads, + llvm::omp::Clause::OMPC_simd, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_ordered { + }; + + static OmpClauseSet requiredClauses_OMPD_ordered { + }; + + // Sets for parallel + + static OmpClauseSet allowedClauses_OMPD_parallel { + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_allocate, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel { + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel { + }; + + // Sets for parallel do + + static OmpClauseSet allowedClauses_OMPD_parallel_do { + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_linear, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel_do { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_collapse, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel_do { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel_do { + }; + + // Sets for parallel do simd + + static OmpClauseSet allowedClauses_OMPD_parallel_do_simd { + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel_do_simd { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel_do_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel_do_simd { + }; + + // Sets for parallel for + + static OmpClauseSet allowedClauses_OMPD_parallel_for { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel_for { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel_for { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel_for { + }; + + // Sets for parallel for simd + + static OmpClauseSet allowedClauses_OMPD_parallel_for_simd { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel_for_simd { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel_for_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel_for_simd { + }; + + // Sets for parallel masked + + static OmpClauseSet allowedClauses_OMPD_parallel_masked { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_filter, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel_masked { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel_masked { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel_masked { + }; + + // Sets for parallel masked taskloop + + static OmpClauseSet allowedClauses_OMPD_parallel_masked_taskloop { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_final, + llvm::omp::Clause::OMPC_untied, + llvm::omp::Clause::OMPC_mergeable, + llvm::omp::Clause::OMPC_priority, + llvm::omp::Clause::OMPC_grainsize, + llvm::omp::Clause::OMPC_nogroup, + llvm::omp::Clause::OMPC_num_tasks, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_filter, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel_masked_taskloop { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel_masked_taskloop { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel_masked_taskloop { + }; + + // Sets for parallel masked taskloop simd + + static OmpClauseSet allowedClauses_OMPD_parallel_masked_taskloop_simd { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_final, + llvm::omp::Clause::OMPC_untied, + llvm::omp::Clause::OMPC_mergeable, + llvm::omp::Clause::OMPC_priority, + llvm::omp::Clause::OMPC_grainsize, + llvm::omp::Clause::OMPC_nogroup, + llvm::omp::Clause::OMPC_num_tasks, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_filter, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel_masked_taskloop_simd { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel_masked_taskloop_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel_masked_taskloop_simd { + }; + + // Sets for parallel master + + static OmpClauseSet allowedClauses_OMPD_parallel_master { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_allocate, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel_master { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel_master { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel_master { + }; + + // Sets for parallel master taskloop + + static OmpClauseSet allowedClauses_OMPD_parallel_master_taskloop { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_final, + llvm::omp::Clause::OMPC_untied, + llvm::omp::Clause::OMPC_mergeable, + llvm::omp::Clause::OMPC_priority, + llvm::omp::Clause::OMPC_grainsize, + llvm::omp::Clause::OMPC_nogroup, + llvm::omp::Clause::OMPC_num_tasks, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_copyin, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel_master_taskloop { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel_master_taskloop { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel_master_taskloop { + }; + + // Sets for parallel master taskloop simd + + static OmpClauseSet allowedClauses_OMPD_parallel_master_taskloop_simd { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_final, + llvm::omp::Clause::OMPC_untied, + llvm::omp::Clause::OMPC_mergeable, + llvm::omp::Clause::OMPC_priority, + llvm::omp::Clause::OMPC_grainsize, + llvm::omp::Clause::OMPC_nogroup, + llvm::omp::Clause::OMPC_num_tasks, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel_master_taskloop_simd { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel_master_taskloop_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel_master_taskloop_simd { + }; + + // Sets for parallel sections + + static OmpClauseSet allowedClauses_OMPD_parallel_sections { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_allocate, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel_sections { + llvm::omp::Clause::OMPC_num_threads, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel_sections { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel_sections { + }; + + // Sets for parallel workshare + + static OmpClauseSet allowedClauses_OMPD_parallel_workshare { + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_shared, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel_workshare { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel_workshare { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel_workshare { + }; + + // Sets for requires + + static OmpClauseSet allowedClauses_OMPD_requires { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_requires { + llvm::omp::Clause::OMPC_unified_address, + llvm::omp::Clause::OMPC_unified_shared_memory, + llvm::omp::Clause::OMPC_reverse_offload, + llvm::omp::Clause::OMPC_dynamic_allocators, + llvm::omp::Clause::OMPC_atomic_default_mem_order, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_requires { + }; + + static OmpClauseSet requiredClauses_OMPD_requires { + }; + + // Sets for scan + + static OmpClauseSet allowedClauses_OMPD_scan { + llvm::omp::Clause::OMPC_inclusive, + llvm::omp::Clause::OMPC_exclusive, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_scan { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_scan { + }; + + static OmpClauseSet requiredClauses_OMPD_scan { + }; + + // Sets for section + + static OmpClauseSet allowedClauses_OMPD_section { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_section { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_section { + }; + + static OmpClauseSet requiredClauses_OMPD_section { + }; + + // Sets for sections + + static OmpClauseSet allowedClauses_OMPD_sections { + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_allocate, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_sections { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_sections { + }; + + static OmpClauseSet requiredClauses_OMPD_sections { + }; + + // Sets for simd + + static OmpClauseSet allowedClauses_OMPD_simd { + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_simd { + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_if, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_simd { + }; + + // Sets for single + + static OmpClauseSet allowedClauses_OMPD_single { + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_copyprivate, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_allocate, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_single { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_single { + }; + + static OmpClauseSet requiredClauses_OMPD_single { + }; + + // Sets for target + + static OmpClauseSet allowedClauses_OMPD_target { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_in_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_uses_allocators, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target { + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_ompx_dyn_cgroup_mem, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target { + }; + + static OmpClauseSet requiredClauses_OMPD_target { + }; + + // Sets for target data + + static OmpClauseSet allowedClauses_OMPD_target_data { + llvm::omp::Clause::OMPC_use_device_ptr, + llvm::omp::Clause::OMPC_use_device_addr, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_data { + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_if, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_data { + }; + + static OmpClauseSet requiredClauses_OMPD_target_data { + llvm::omp::Clause::OMPC_map, + }; + + // Sets for target enter data + + static OmpClauseSet allowedClauses_OMPD_target_enter_data { + llvm::omp::Clause::OMPC_depend, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_enter_data { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_nowait, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_enter_data { + }; + + static OmpClauseSet requiredClauses_OMPD_target_enter_data { + llvm::omp::Clause::OMPC_map, + }; + + // Sets for target exit data + + static OmpClauseSet allowedClauses_OMPD_target_exit_data { + llvm::omp::Clause::OMPC_depend, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_exit_data { + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_nowait, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_exit_data { + }; + + static OmpClauseSet requiredClauses_OMPD_target_exit_data { + llvm::omp::Clause::OMPC_map, + }; + + // Sets for target parallel + + static OmpClauseSet allowedClauses_OMPD_target_parallel { + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_uses_allocators, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_parallel { + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_ompx_dyn_cgroup_mem, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_parallel { + }; + + static OmpClauseSet requiredClauses_OMPD_target_parallel { + }; + + // Sets for target parallel do + + static OmpClauseSet allowedClauses_OMPD_target_parallel_do { + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_allocator, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_uses_allocators, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_copyin, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_parallel_do { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_nowait, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_parallel_do { + }; + + static OmpClauseSet requiredClauses_OMPD_target_parallel_do { + }; + + // Sets for target parallel do simd + + static OmpClauseSet allowedClauses_OMPD_target_parallel_do_simd { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_uses_allocators, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_parallel_do_simd { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_parallel_do_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_target_parallel_do_simd { + }; + + // Sets for target parallel for + + static OmpClauseSet allowedClauses_OMPD_target_parallel_for { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_uses_allocators, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_parallel_for { + llvm::omp::Clause::OMPC_ompx_dyn_cgroup_mem, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_parallel_for { + }; + + static OmpClauseSet requiredClauses_OMPD_target_parallel_for { + }; + + // Sets for target parallel for simd + + static OmpClauseSet allowedClauses_OMPD_target_parallel_for_simd { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_uses_allocators, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_parallel_for_simd { + llvm::omp::Clause::OMPC_ompx_dyn_cgroup_mem, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_parallel_for_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_target_parallel_for_simd { + }; + + // Sets for target simd + + static OmpClauseSet allowedClauses_OMPD_target_simd { + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_uses_allocators, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_simd { + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_ompx_dyn_cgroup_mem, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_target_simd { + }; + + // Sets for target teams + + static OmpClauseSet allowedClauses_OMPD_target_teams { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_uses_allocators, + llvm::omp::Clause::OMPC_shared, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_teams { + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_ompx_dyn_cgroup_mem, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_teams { + }; + + static OmpClauseSet requiredClauses_OMPD_target_teams { + }; + + // Sets for target teams distribute + + static OmpClauseSet allowedClauses_OMPD_target_teams_distribute { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_uses_allocators, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_lastprivate, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_teams_distribute { + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_ompx_dyn_cgroup_mem, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_teams_distribute { + }; + + static OmpClauseSet requiredClauses_OMPD_target_teams_distribute { + }; + + // Sets for target teams distribute parallel do + + static OmpClauseSet allowedClauses_OMPD_target_teams_distribute_parallel_do { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_uses_allocators, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_teams_distribute_parallel_do { + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_schedule, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_teams_distribute_parallel_do { + }; + + static OmpClauseSet requiredClauses_OMPD_target_teams_distribute_parallel_do { + }; + + // Sets for target teams distribute parallel do simd + + static OmpClauseSet allowedClauses_OMPD_target_teams_distribute_parallel_do_simd { + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_uses_allocators, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_nontemporal, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_teams_distribute_parallel_do_simd { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_teams_distribute_parallel_do_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_target_teams_distribute_parallel_do_simd { + }; + + // Sets for target teams distribute parallel for + + static OmpClauseSet allowedClauses_OMPD_target_teams_distribute_parallel_for { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_uses_allocators, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_teams_distribute_parallel_for { + llvm::omp::Clause::OMPC_ompx_dyn_cgroup_mem, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_teams_distribute_parallel_for { + }; + + static OmpClauseSet requiredClauses_OMPD_target_teams_distribute_parallel_for { + }; + + // Sets for target teams distribute parallel for simd + + static OmpClauseSet allowedClauses_OMPD_target_teams_distribute_parallel_for_simd { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_uses_allocators, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_teams_distribute_parallel_for_simd { + llvm::omp::Clause::OMPC_ompx_dyn_cgroup_mem, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_teams_distribute_parallel_for_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_target_teams_distribute_parallel_for_simd { + }; + + // Sets for target teams distribute simd + + static OmpClauseSet allowedClauses_OMPD_target_teams_distribute_simd { + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_uses_allocators, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_teams_distribute_simd { + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_ompx_dyn_cgroup_mem, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_teams_distribute_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_target_teams_distribute_simd { + }; + + // Sets for target update + + static OmpClauseSet allowedClauses_OMPD_target_update { + llvm::omp::Clause::OMPC_to, + llvm::omp::Clause::OMPC_from, + llvm::omp::Clause::OMPC_depend, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_update { + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_nowait, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_update { + }; + + static OmpClauseSet requiredClauses_OMPD_target_update { + }; + + // Sets for task + + static OmpClauseSet allowedClauses_OMPD_task { + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_untied, + llvm::omp::Clause::OMPC_mergeable, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_in_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_detach, + llvm::omp::Clause::OMPC_affinity, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_task { + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_final, + llvm::omp::Clause::OMPC_priority, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_task { + }; + + static OmpClauseSet requiredClauses_OMPD_task { + }; + + // Sets for taskgroup + + static OmpClauseSet allowedClauses_OMPD_taskgroup { + llvm::omp::Clause::OMPC_task_reduction, + llvm::omp::Clause::OMPC_allocate, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_taskgroup { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_taskgroup { + }; + + static OmpClauseSet requiredClauses_OMPD_taskgroup { + }; + + // Sets for taskloop + + static OmpClauseSet allowedClauses_OMPD_taskloop { + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_untied, + llvm::omp::Clause::OMPC_mergeable, + llvm::omp::Clause::OMPC_nogroup, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_in_reduction, + llvm::omp::Clause::OMPC_allocate, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_taskloop { + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_final, + llvm::omp::Clause::OMPC_priority, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_taskloop { + llvm::omp::Clause::OMPC_grainsize, + llvm::omp::Clause::OMPC_num_tasks, + }; + + static OmpClauseSet requiredClauses_OMPD_taskloop { + }; + + // Sets for taskloop simd + + static OmpClauseSet allowedClauses_OMPD_taskloop_simd { + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_in_reduction, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_mergeable, + llvm::omp::Clause::OMPC_nogroup, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_untied, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_taskloop_simd { + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_final, + llvm::omp::Clause::OMPC_priority, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_taskloop_simd { + llvm::omp::Clause::OMPC_grainsize, + llvm::omp::Clause::OMPC_num_tasks, + }; + + static OmpClauseSet requiredClauses_OMPD_taskloop_simd { + }; + + // Sets for taskwait + + static OmpClauseSet allowedClauses_OMPD_taskwait { + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_nowait, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_taskwait { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_taskwait { + }; + + static OmpClauseSet requiredClauses_OMPD_taskwait { + }; + + // Sets for taskyield + + static OmpClauseSet allowedClauses_OMPD_taskyield { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_taskyield { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_taskyield { + }; + + static OmpClauseSet requiredClauses_OMPD_taskyield { + }; + + // Sets for teams + + static OmpClauseSet allowedClauses_OMPD_teams { + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_allocate, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_teams { + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_thread_limit, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_teams { + }; + + static OmpClauseSet requiredClauses_OMPD_teams { + }; + + // Sets for teams distribute + + static OmpClauseSet allowedClauses_OMPD_teams_distribute { + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_allocate, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_teams_distribute { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_teams_distribute { + }; + + static OmpClauseSet requiredClauses_OMPD_teams_distribute { + }; + + // Sets for teams distribute parallel do + + static OmpClauseSet allowedClauses_OMPD_teams_distribute_parallel_do { + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_linear, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_teams_distribute_parallel_do { + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_ordered, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_schedule, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_teams_distribute_parallel_do { + }; + + static OmpClauseSet requiredClauses_OMPD_teams_distribute_parallel_do { + }; + + // Sets for teams distribute parallel do simd + + static OmpClauseSet allowedClauses_OMPD_teams_distribute_parallel_do_simd { + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_nontemporal, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_teams_distribute_parallel_do_simd { + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_if, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_teams_distribute_parallel_do_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_teams_distribute_parallel_do_simd { + }; + + // Sets for teams distribute parallel for + + static OmpClauseSet allowedClauses_OMPD_teams_distribute_parallel_for { + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_teams_distribute_parallel_for { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_teams_distribute_parallel_for { + }; + + static OmpClauseSet requiredClauses_OMPD_teams_distribute_parallel_for { + }; + + // Sets for teams distribute parallel for simd + + static OmpClauseSet allowedClauses_OMPD_teams_distribute_parallel_for_simd { + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_schedule, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_teams_distribute_parallel_for_simd { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_teams_distribute_parallel_for_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_teams_distribute_parallel_for_simd { + }; + + // Sets for teams distribute simd + + static OmpClauseSet allowedClauses_OMPD_teams_distribute_simd { + llvm::omp::Clause::OMPC_aligned, + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_linear, + llvm::omp::Clause::OMPC_nontemporal, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_shared, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_teams_distribute_simd { + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_dist_schedule, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_safelen, + llvm::omp::Clause::OMPC_simdlen, + llvm::omp::Clause::OMPC_thread_limit, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_teams_distribute_simd { + }; + + static OmpClauseSet requiredClauses_OMPD_teams_distribute_simd { + }; + + // Sets for threadprivate + + static OmpClauseSet allowedClauses_OMPD_threadprivate { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_threadprivate { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_threadprivate { + }; + + static OmpClauseSet requiredClauses_OMPD_threadprivate { + }; + + // Sets for tile + + static OmpClauseSet allowedClauses_OMPD_tile { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_tile { + llvm::omp::Clause::OMPC_sizes, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_tile { + }; + + static OmpClauseSet requiredClauses_OMPD_tile { + }; + + // Sets for unknown + + static OmpClauseSet allowedClauses_OMPD_unknown { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_unknown { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_unknown { + }; + + static OmpClauseSet requiredClauses_OMPD_unknown { + }; + + // Sets for unroll + + static OmpClauseSet allowedClauses_OMPD_unroll { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_unroll { + llvm::omp::Clause::OMPC_full, + llvm::omp::Clause::OMPC_partial, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_unroll { + }; + + static OmpClauseSet requiredClauses_OMPD_unroll { + }; + + // Sets for workshare + + static OmpClauseSet allowedClauses_OMPD_workshare { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_workshare { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_workshare { + }; + + static OmpClauseSet requiredClauses_OMPD_workshare { + }; + + // Sets for dispatch + + static OmpClauseSet allowedClauses_OMPD_dispatch { + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_novariants, + llvm::omp::Clause::OMPC_nocontext, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_dispatch { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_dispatch { + }; + + static OmpClauseSet requiredClauses_OMPD_dispatch { + }; + + // Sets for interop + + static OmpClauseSet allowedClauses_OMPD_interop { + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_destroy, + llvm::omp::Clause::OMPC_init, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_use, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_interop { + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_interop { + }; + + static OmpClauseSet requiredClauses_OMPD_interop { + }; + + // Sets for loop + + static OmpClauseSet allowedClauses_OMPD_loop { + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_reduction, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_loop { + llvm::omp::Clause::OMPC_bind, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_order, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_loop { + }; + + static OmpClauseSet requiredClauses_OMPD_loop { + }; + + // Sets for masked + + static OmpClauseSet allowedClauses_OMPD_masked { + }; + + static OmpClauseSet allowedOnceClauses_OMPD_masked { + llvm::omp::Clause::OMPC_filter, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_masked { + }; + + static OmpClauseSet requiredClauses_OMPD_masked { + }; + + // Sets for parallel loop + + static OmpClauseSet allowedClauses_OMPD_parallel_loop { + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_shared, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_parallel_loop { + llvm::omp::Clause::OMPC_bind, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_proc_bind, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_parallel_loop { + }; + + static OmpClauseSet requiredClauses_OMPD_parallel_loop { + }; + + // Sets for target parallel loop + + static OmpClauseSet allowedClauses_OMPD_target_parallel_loop { + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_copyin, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_uses_allocators, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_parallel_loop { + llvm::omp::Clause::OMPC_bind, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_num_threads, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_proc_bind, + llvm::omp::Clause::OMPC_ompx_dyn_cgroup_mem, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_parallel_loop { + }; + + static OmpClauseSet requiredClauses_OMPD_target_parallel_loop { + }; + + // Sets for target teams loop + + static OmpClauseSet allowedClauses_OMPD_target_teams_loop { + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_depend, + llvm::omp::Clause::OMPC_defaultmap, + llvm::omp::Clause::OMPC_device, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_is_device_ptr, + llvm::omp::Clause::OMPC_has_device_addr, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_map, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_shared, + llvm::omp::Clause::OMPC_uses_allocators, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_target_teams_loop { + llvm::omp::Clause::OMPC_bind, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_if, + llvm::omp::Clause::OMPC_nowait, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_thread_limit, + llvm::omp::Clause::OMPC_ompx_dyn_cgroup_mem, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_target_teams_loop { + }; + + static OmpClauseSet requiredClauses_OMPD_target_teams_loop { + }; + + // Sets for teams loop + + static OmpClauseSet allowedClauses_OMPD_teams_loop { + llvm::omp::Clause::OMPC_allocate, + llvm::omp::Clause::OMPC_firstprivate, + llvm::omp::Clause::OMPC_lastprivate, + llvm::omp::Clause::OMPC_private, + llvm::omp::Clause::OMPC_reduction, + llvm::omp::Clause::OMPC_shared, + }; + + static OmpClauseSet allowedOnceClauses_OMPD_teams_loop { + llvm::omp::Clause::OMPC_bind, + llvm::omp::Clause::OMPC_collapse, + llvm::omp::Clause::OMPC_default, + llvm::omp::Clause::OMPC_num_teams, + llvm::omp::Clause::OMPC_order, + llvm::omp::Clause::OMPC_thread_limit, + }; + + static OmpClauseSet allowedExclusiveClauses_OMPD_teams_loop { + }; + + static OmpClauseSet requiredClauses_OMPD_teams_loop { + }; +} // namespace omp +} // namespace llvm + +#endif // GEN_FLANG_DIRECTIVE_CLAUSE_SETS + +#ifdef GEN_FLANG_DIRECTIVE_CLAUSE_MAP +#undef GEN_FLANG_DIRECTIVE_CLAUSE_MAP + +{ + {llvm::omp::Directive::OMPD_allocate, + { + llvm::omp::allowedClauses_OMPD_allocate, + llvm::omp::allowedOnceClauses_OMPD_allocate, + llvm::omp::allowedExclusiveClauses_OMPD_allocate, + llvm::omp::requiredClauses_OMPD_allocate, + } + }, + {llvm::omp::Directive::OMPD_assumes, + { + llvm::omp::allowedClauses_OMPD_assumes, + llvm::omp::allowedOnceClauses_OMPD_assumes, + llvm::omp::allowedExclusiveClauses_OMPD_assumes, + llvm::omp::requiredClauses_OMPD_assumes, + } + }, + {llvm::omp::Directive::OMPD_atomic, + { + llvm::omp::allowedClauses_OMPD_atomic, + llvm::omp::allowedOnceClauses_OMPD_atomic, + llvm::omp::allowedExclusiveClauses_OMPD_atomic, + llvm::omp::requiredClauses_OMPD_atomic, + } + }, + {llvm::omp::Directive::OMPD_barrier, + { + llvm::omp::allowedClauses_OMPD_barrier, + llvm::omp::allowedOnceClauses_OMPD_barrier, + llvm::omp::allowedExclusiveClauses_OMPD_barrier, + llvm::omp::requiredClauses_OMPD_barrier, + } + }, + {llvm::omp::Directive::OMPD_begin_assumes, + { + llvm::omp::allowedClauses_OMPD_begin_assumes, + llvm::omp::allowedOnceClauses_OMPD_begin_assumes, + llvm::omp::allowedExclusiveClauses_OMPD_begin_assumes, + llvm::omp::requiredClauses_OMPD_begin_assumes, + } + }, + {llvm::omp::Directive::OMPD_begin_declare_target, + { + llvm::omp::allowedClauses_OMPD_begin_declare_target, + llvm::omp::allowedOnceClauses_OMPD_begin_declare_target, + llvm::omp::allowedExclusiveClauses_OMPD_begin_declare_target, + llvm::omp::requiredClauses_OMPD_begin_declare_target, + } + }, + {llvm::omp::Directive::OMPD_begin_declare_variant, + { + llvm::omp::allowedClauses_OMPD_begin_declare_variant, + llvm::omp::allowedOnceClauses_OMPD_begin_declare_variant, + llvm::omp::allowedExclusiveClauses_OMPD_begin_declare_variant, + llvm::omp::requiredClauses_OMPD_begin_declare_variant, + } + }, + {llvm::omp::Directive::OMPD_cancel, + { + llvm::omp::allowedClauses_OMPD_cancel, + llvm::omp::allowedOnceClauses_OMPD_cancel, + llvm::omp::allowedExclusiveClauses_OMPD_cancel, + llvm::omp::requiredClauses_OMPD_cancel, + } + }, + {llvm::omp::Directive::OMPD_cancellation_point, + { + llvm::omp::allowedClauses_OMPD_cancellation_point, + llvm::omp::allowedOnceClauses_OMPD_cancellation_point, + llvm::omp::allowedExclusiveClauses_OMPD_cancellation_point, + llvm::omp::requiredClauses_OMPD_cancellation_point, + } + }, + {llvm::omp::Directive::OMPD_critical, + { + llvm::omp::allowedClauses_OMPD_critical, + llvm::omp::allowedOnceClauses_OMPD_critical, + llvm::omp::allowedExclusiveClauses_OMPD_critical, + llvm::omp::requiredClauses_OMPD_critical, + } + }, + {llvm::omp::Directive::OMPD_declare_mapper, + { + llvm::omp::allowedClauses_OMPD_declare_mapper, + llvm::omp::allowedOnceClauses_OMPD_declare_mapper, + llvm::omp::allowedExclusiveClauses_OMPD_declare_mapper, + llvm::omp::requiredClauses_OMPD_declare_mapper, + } + }, + {llvm::omp::Directive::OMPD_declare_reduction, + { + llvm::omp::allowedClauses_OMPD_declare_reduction, + llvm::omp::allowedOnceClauses_OMPD_declare_reduction, + llvm::omp::allowedExclusiveClauses_OMPD_declare_reduction, + llvm::omp::requiredClauses_OMPD_declare_reduction, + } + }, + {llvm::omp::Directive::OMPD_declare_simd, + { + llvm::omp::allowedClauses_OMPD_declare_simd, + llvm::omp::allowedOnceClauses_OMPD_declare_simd, + llvm::omp::allowedExclusiveClauses_OMPD_declare_simd, + llvm::omp::requiredClauses_OMPD_declare_simd, + } + }, + {llvm::omp::Directive::OMPD_declare_target, + { + llvm::omp::allowedClauses_OMPD_declare_target, + llvm::omp::allowedOnceClauses_OMPD_declare_target, + llvm::omp::allowedExclusiveClauses_OMPD_declare_target, + llvm::omp::requiredClauses_OMPD_declare_target, + } + }, + {llvm::omp::Directive::OMPD_declare_variant, + { + llvm::omp::allowedClauses_OMPD_declare_variant, + llvm::omp::allowedOnceClauses_OMPD_declare_variant, + llvm::omp::allowedExclusiveClauses_OMPD_declare_variant, + llvm::omp::requiredClauses_OMPD_declare_variant, + } + }, + {llvm::omp::Directive::OMPD_depobj, + { + llvm::omp::allowedClauses_OMPD_depobj, + llvm::omp::allowedOnceClauses_OMPD_depobj, + llvm::omp::allowedExclusiveClauses_OMPD_depobj, + llvm::omp::requiredClauses_OMPD_depobj, + } + }, + {llvm::omp::Directive::OMPD_distribute, + { + llvm::omp::allowedClauses_OMPD_distribute, + llvm::omp::allowedOnceClauses_OMPD_distribute, + llvm::omp::allowedExclusiveClauses_OMPD_distribute, + llvm::omp::requiredClauses_OMPD_distribute, + } + }, + {llvm::omp::Directive::OMPD_distribute_parallel_do, + { + llvm::omp::allowedClauses_OMPD_distribute_parallel_do, + llvm::omp::allowedOnceClauses_OMPD_distribute_parallel_do, + llvm::omp::allowedExclusiveClauses_OMPD_distribute_parallel_do, + llvm::omp::requiredClauses_OMPD_distribute_parallel_do, + } + }, + {llvm::omp::Directive::OMPD_distribute_parallel_do_simd, + { + llvm::omp::allowedClauses_OMPD_distribute_parallel_do_simd, + llvm::omp::allowedOnceClauses_OMPD_distribute_parallel_do_simd, + llvm::omp::allowedExclusiveClauses_OMPD_distribute_parallel_do_simd, + llvm::omp::requiredClauses_OMPD_distribute_parallel_do_simd, + } + }, + {llvm::omp::Directive::OMPD_distribute_parallel_for, + { + llvm::omp::allowedClauses_OMPD_distribute_parallel_for, + llvm::omp::allowedOnceClauses_OMPD_distribute_parallel_for, + llvm::omp::allowedExclusiveClauses_OMPD_distribute_parallel_for, + llvm::omp::requiredClauses_OMPD_distribute_parallel_for, + } + }, + {llvm::omp::Directive::OMPD_distribute_parallel_for_simd, + { + llvm::omp::allowedClauses_OMPD_distribute_parallel_for_simd, + llvm::omp::allowedOnceClauses_OMPD_distribute_parallel_for_simd, + llvm::omp::allowedExclusiveClauses_OMPD_distribute_parallel_for_simd, + llvm::omp::requiredClauses_OMPD_distribute_parallel_for_simd, + } + }, + {llvm::omp::Directive::OMPD_distribute_simd, + { + llvm::omp::allowedClauses_OMPD_distribute_simd, + llvm::omp::allowedOnceClauses_OMPD_distribute_simd, + llvm::omp::allowedExclusiveClauses_OMPD_distribute_simd, + llvm::omp::requiredClauses_OMPD_distribute_simd, + } + }, + {llvm::omp::Directive::OMPD_do, + { + llvm::omp::allowedClauses_OMPD_do, + llvm::omp::allowedOnceClauses_OMPD_do, + llvm::omp::allowedExclusiveClauses_OMPD_do, + llvm::omp::requiredClauses_OMPD_do, + } + }, + {llvm::omp::Directive::OMPD_do_simd, + { + llvm::omp::allowedClauses_OMPD_do_simd, + llvm::omp::allowedOnceClauses_OMPD_do_simd, + llvm::omp::allowedExclusiveClauses_OMPD_do_simd, + llvm::omp::requiredClauses_OMPD_do_simd, + } + }, + {llvm::omp::Directive::OMPD_end_assumes, + { + llvm::omp::allowedClauses_OMPD_end_assumes, + llvm::omp::allowedOnceClauses_OMPD_end_assumes, + llvm::omp::allowedExclusiveClauses_OMPD_end_assumes, + llvm::omp::requiredClauses_OMPD_end_assumes, + } + }, + {llvm::omp::Directive::OMPD_end_declare_target, + { + llvm::omp::allowedClauses_OMPD_end_declare_target, + llvm::omp::allowedOnceClauses_OMPD_end_declare_target, + llvm::omp::allowedExclusiveClauses_OMPD_end_declare_target, + llvm::omp::requiredClauses_OMPD_end_declare_target, + } + }, + {llvm::omp::Directive::OMPD_end_declare_variant, + { + llvm::omp::allowedClauses_OMPD_end_declare_variant, + llvm::omp::allowedOnceClauses_OMPD_end_declare_variant, + llvm::omp::allowedExclusiveClauses_OMPD_end_declare_variant, + llvm::omp::requiredClauses_OMPD_end_declare_variant, + } + }, + {llvm::omp::Directive::OMPD_end_do, + { + llvm::omp::allowedClauses_OMPD_end_do, + llvm::omp::allowedOnceClauses_OMPD_end_do, + llvm::omp::allowedExclusiveClauses_OMPD_end_do, + llvm::omp::requiredClauses_OMPD_end_do, + } + }, + {llvm::omp::Directive::OMPD_end_do_simd, + { + llvm::omp::allowedClauses_OMPD_end_do_simd, + llvm::omp::allowedOnceClauses_OMPD_end_do_simd, + llvm::omp::allowedExclusiveClauses_OMPD_end_do_simd, + llvm::omp::requiredClauses_OMPD_end_do_simd, + } + }, + {llvm::omp::Directive::OMPD_end_sections, + { + llvm::omp::allowedClauses_OMPD_end_sections, + llvm::omp::allowedOnceClauses_OMPD_end_sections, + llvm::omp::allowedExclusiveClauses_OMPD_end_sections, + llvm::omp::requiredClauses_OMPD_end_sections, + } + }, + {llvm::omp::Directive::OMPD_end_single, + { + llvm::omp::allowedClauses_OMPD_end_single, + llvm::omp::allowedOnceClauses_OMPD_end_single, + llvm::omp::allowedExclusiveClauses_OMPD_end_single, + llvm::omp::requiredClauses_OMPD_end_single, + } + }, + {llvm::omp::Directive::OMPD_end_workshare, + { + llvm::omp::allowedClauses_OMPD_end_workshare, + llvm::omp::allowedOnceClauses_OMPD_end_workshare, + llvm::omp::allowedExclusiveClauses_OMPD_end_workshare, + llvm::omp::requiredClauses_OMPD_end_workshare, + } + }, + {llvm::omp::Directive::OMPD_error, + { + llvm::omp::allowedClauses_OMPD_error, + llvm::omp::allowedOnceClauses_OMPD_error, + llvm::omp::allowedExclusiveClauses_OMPD_error, + llvm::omp::requiredClauses_OMPD_error, + } + }, + {llvm::omp::Directive::OMPD_flush, + { + llvm::omp::allowedClauses_OMPD_flush, + llvm::omp::allowedOnceClauses_OMPD_flush, + llvm::omp::allowedExclusiveClauses_OMPD_flush, + llvm::omp::requiredClauses_OMPD_flush, + } + }, + {llvm::omp::Directive::OMPD_for, + { + llvm::omp::allowedClauses_OMPD_for, + llvm::omp::allowedOnceClauses_OMPD_for, + llvm::omp::allowedExclusiveClauses_OMPD_for, + llvm::omp::requiredClauses_OMPD_for, + } + }, + {llvm::omp::Directive::OMPD_for_simd, + { + llvm::omp::allowedClauses_OMPD_for_simd, + llvm::omp::allowedOnceClauses_OMPD_for_simd, + llvm::omp::allowedExclusiveClauses_OMPD_for_simd, + llvm::omp::requiredClauses_OMPD_for_simd, + } + }, + {llvm::omp::Directive::OMPD_masked_taskloop, + { + llvm::omp::allowedClauses_OMPD_masked_taskloop, + llvm::omp::allowedOnceClauses_OMPD_masked_taskloop, + llvm::omp::allowedExclusiveClauses_OMPD_masked_taskloop, + llvm::omp::requiredClauses_OMPD_masked_taskloop, + } + }, + {llvm::omp::Directive::OMPD_masked_taskloop_simd, + { + llvm::omp::allowedClauses_OMPD_masked_taskloop_simd, + llvm::omp::allowedOnceClauses_OMPD_masked_taskloop_simd, + llvm::omp::allowedExclusiveClauses_OMPD_masked_taskloop_simd, + llvm::omp::requiredClauses_OMPD_masked_taskloop_simd, + } + }, + {llvm::omp::Directive::OMPD_master, + { + llvm::omp::allowedClauses_OMPD_master, + llvm::omp::allowedOnceClauses_OMPD_master, + llvm::omp::allowedExclusiveClauses_OMPD_master, + llvm::omp::requiredClauses_OMPD_master, + } + }, + {llvm::omp::Directive::OMPD_master_taskloop, + { + llvm::omp::allowedClauses_OMPD_master_taskloop, + llvm::omp::allowedOnceClauses_OMPD_master_taskloop, + llvm::omp::allowedExclusiveClauses_OMPD_master_taskloop, + llvm::omp::requiredClauses_OMPD_master_taskloop, + } + }, + {llvm::omp::Directive::OMPD_master_taskloop_simd, + { + llvm::omp::allowedClauses_OMPD_master_taskloop_simd, + llvm::omp::allowedOnceClauses_OMPD_master_taskloop_simd, + llvm::omp::allowedExclusiveClauses_OMPD_master_taskloop_simd, + llvm::omp::requiredClauses_OMPD_master_taskloop_simd, + } + }, + {llvm::omp::Directive::OMPD_metadirective, + { + llvm::omp::allowedClauses_OMPD_metadirective, + llvm::omp::allowedOnceClauses_OMPD_metadirective, + llvm::omp::allowedExclusiveClauses_OMPD_metadirective, + llvm::omp::requiredClauses_OMPD_metadirective, + } + }, + {llvm::omp::Directive::OMPD_nothing, + { + llvm::omp::allowedClauses_OMPD_nothing, + llvm::omp::allowedOnceClauses_OMPD_nothing, + llvm::omp::allowedExclusiveClauses_OMPD_nothing, + llvm::omp::requiredClauses_OMPD_nothing, + } + }, + {llvm::omp::Directive::OMPD_ordered, + { + llvm::omp::allowedClauses_OMPD_ordered, + llvm::omp::allowedOnceClauses_OMPD_ordered, + llvm::omp::allowedExclusiveClauses_OMPD_ordered, + llvm::omp::requiredClauses_OMPD_ordered, + } + }, + {llvm::omp::Directive::OMPD_parallel, + { + llvm::omp::allowedClauses_OMPD_parallel, + llvm::omp::allowedOnceClauses_OMPD_parallel, + llvm::omp::allowedExclusiveClauses_OMPD_parallel, + llvm::omp::requiredClauses_OMPD_parallel, + } + }, + {llvm::omp::Directive::OMPD_parallel_do, + { + llvm::omp::allowedClauses_OMPD_parallel_do, + llvm::omp::allowedOnceClauses_OMPD_parallel_do, + llvm::omp::allowedExclusiveClauses_OMPD_parallel_do, + llvm::omp::requiredClauses_OMPD_parallel_do, + } + }, + {llvm::omp::Directive::OMPD_parallel_do_simd, + { + llvm::omp::allowedClauses_OMPD_parallel_do_simd, + llvm::omp::allowedOnceClauses_OMPD_parallel_do_simd, + llvm::omp::allowedExclusiveClauses_OMPD_parallel_do_simd, + llvm::omp::requiredClauses_OMPD_parallel_do_simd, + } + }, + {llvm::omp::Directive::OMPD_parallel_for, + { + llvm::omp::allowedClauses_OMPD_parallel_for, + llvm::omp::allowedOnceClauses_OMPD_parallel_for, + llvm::omp::allowedExclusiveClauses_OMPD_parallel_for, + llvm::omp::requiredClauses_OMPD_parallel_for, + } + }, + {llvm::omp::Directive::OMPD_parallel_for_simd, + { + llvm::omp::allowedClauses_OMPD_parallel_for_simd, + llvm::omp::allowedOnceClauses_OMPD_parallel_for_simd, + llvm::omp::allowedExclusiveClauses_OMPD_parallel_for_simd, + llvm::omp::requiredClauses_OMPD_parallel_for_simd, + } + }, + {llvm::omp::Directive::OMPD_parallel_masked, + { + llvm::omp::allowedClauses_OMPD_parallel_masked, + llvm::omp::allowedOnceClauses_OMPD_parallel_masked, + llvm::omp::allowedExclusiveClauses_OMPD_parallel_masked, + llvm::omp::requiredClauses_OMPD_parallel_masked, + } + }, + {llvm::omp::Directive::OMPD_parallel_masked_taskloop, + { + llvm::omp::allowedClauses_OMPD_parallel_masked_taskloop, + llvm::omp::allowedOnceClauses_OMPD_parallel_masked_taskloop, + llvm::omp::allowedExclusiveClauses_OMPD_parallel_masked_taskloop, + llvm::omp::requiredClauses_OMPD_parallel_masked_taskloop, + } + }, + {llvm::omp::Directive::OMPD_parallel_masked_taskloop_simd, + { + llvm::omp::allowedClauses_OMPD_parallel_masked_taskloop_simd, + llvm::omp::allowedOnceClauses_OMPD_parallel_masked_taskloop_simd, + llvm::omp::allowedExclusiveClauses_OMPD_parallel_masked_taskloop_simd, + llvm::omp::requiredClauses_OMPD_parallel_masked_taskloop_simd, + } + }, + {llvm::omp::Directive::OMPD_parallel_master, + { + llvm::omp::allowedClauses_OMPD_parallel_master, + llvm::omp::allowedOnceClauses_OMPD_parallel_master, + llvm::omp::allowedExclusiveClauses_OMPD_parallel_master, + llvm::omp::requiredClauses_OMPD_parallel_master, + } + }, + {llvm::omp::Directive::OMPD_parallel_master_taskloop, + { + llvm::omp::allowedClauses_OMPD_parallel_master_taskloop, + llvm::omp::allowedOnceClauses_OMPD_parallel_master_taskloop, + llvm::omp::allowedExclusiveClauses_OMPD_parallel_master_taskloop, + llvm::omp::requiredClauses_OMPD_parallel_master_taskloop, + } + }, + {llvm::omp::Directive::OMPD_parallel_master_taskloop_simd, + { + llvm::omp::allowedClauses_OMPD_parallel_master_taskloop_simd, + llvm::omp::allowedOnceClauses_OMPD_parallel_master_taskloop_simd, + llvm::omp::allowedExclusiveClauses_OMPD_parallel_master_taskloop_simd, + llvm::omp::requiredClauses_OMPD_parallel_master_taskloop_simd, + } + }, + {llvm::omp::Directive::OMPD_parallel_sections, + { + llvm::omp::allowedClauses_OMPD_parallel_sections, + llvm::omp::allowedOnceClauses_OMPD_parallel_sections, + llvm::omp::allowedExclusiveClauses_OMPD_parallel_sections, + llvm::omp::requiredClauses_OMPD_parallel_sections, + } + }, + {llvm::omp::Directive::OMPD_parallel_workshare, + { + llvm::omp::allowedClauses_OMPD_parallel_workshare, + llvm::omp::allowedOnceClauses_OMPD_parallel_workshare, + llvm::omp::allowedExclusiveClauses_OMPD_parallel_workshare, + llvm::omp::requiredClauses_OMPD_parallel_workshare, + } + }, + {llvm::omp::Directive::OMPD_requires, + { + llvm::omp::allowedClauses_OMPD_requires, + llvm::omp::allowedOnceClauses_OMPD_requires, + llvm::omp::allowedExclusiveClauses_OMPD_requires, + llvm::omp::requiredClauses_OMPD_requires, + } + }, + {llvm::omp::Directive::OMPD_scan, + { + llvm::omp::allowedClauses_OMPD_scan, + llvm::omp::allowedOnceClauses_OMPD_scan, + llvm::omp::allowedExclusiveClauses_OMPD_scan, + llvm::omp::requiredClauses_OMPD_scan, + } + }, + {llvm::omp::Directive::OMPD_section, + { + llvm::omp::allowedClauses_OMPD_section, + llvm::omp::allowedOnceClauses_OMPD_section, + llvm::omp::allowedExclusiveClauses_OMPD_section, + llvm::omp::requiredClauses_OMPD_section, + } + }, + {llvm::omp::Directive::OMPD_sections, + { + llvm::omp::allowedClauses_OMPD_sections, + llvm::omp::allowedOnceClauses_OMPD_sections, + llvm::omp::allowedExclusiveClauses_OMPD_sections, + llvm::omp::requiredClauses_OMPD_sections, + } + }, + {llvm::omp::Directive::OMPD_simd, + { + llvm::omp::allowedClauses_OMPD_simd, + llvm::omp::allowedOnceClauses_OMPD_simd, + llvm::omp::allowedExclusiveClauses_OMPD_simd, + llvm::omp::requiredClauses_OMPD_simd, + } + }, + {llvm::omp::Directive::OMPD_single, + { + llvm::omp::allowedClauses_OMPD_single, + llvm::omp::allowedOnceClauses_OMPD_single, + llvm::omp::allowedExclusiveClauses_OMPD_single, + llvm::omp::requiredClauses_OMPD_single, + } + }, + {llvm::omp::Directive::OMPD_target, + { + llvm::omp::allowedClauses_OMPD_target, + llvm::omp::allowedOnceClauses_OMPD_target, + llvm::omp::allowedExclusiveClauses_OMPD_target, + llvm::omp::requiredClauses_OMPD_target, + } + }, + {llvm::omp::Directive::OMPD_target_data, + { + llvm::omp::allowedClauses_OMPD_target_data, + llvm::omp::allowedOnceClauses_OMPD_target_data, + llvm::omp::allowedExclusiveClauses_OMPD_target_data, + llvm::omp::requiredClauses_OMPD_target_data, + } + }, + {llvm::omp::Directive::OMPD_target_enter_data, + { + llvm::omp::allowedClauses_OMPD_target_enter_data, + llvm::omp::allowedOnceClauses_OMPD_target_enter_data, + llvm::omp::allowedExclusiveClauses_OMPD_target_enter_data, + llvm::omp::requiredClauses_OMPD_target_enter_data, + } + }, + {llvm::omp::Directive::OMPD_target_exit_data, + { + llvm::omp::allowedClauses_OMPD_target_exit_data, + llvm::omp::allowedOnceClauses_OMPD_target_exit_data, + llvm::omp::allowedExclusiveClauses_OMPD_target_exit_data, + llvm::omp::requiredClauses_OMPD_target_exit_data, + } + }, + {llvm::omp::Directive::OMPD_target_parallel, + { + llvm::omp::allowedClauses_OMPD_target_parallel, + llvm::omp::allowedOnceClauses_OMPD_target_parallel, + llvm::omp::allowedExclusiveClauses_OMPD_target_parallel, + llvm::omp::requiredClauses_OMPD_target_parallel, + } + }, + {llvm::omp::Directive::OMPD_target_parallel_do, + { + llvm::omp::allowedClauses_OMPD_target_parallel_do, + llvm::omp::allowedOnceClauses_OMPD_target_parallel_do, + llvm::omp::allowedExclusiveClauses_OMPD_target_parallel_do, + llvm::omp::requiredClauses_OMPD_target_parallel_do, + } + }, + {llvm::omp::Directive::OMPD_target_parallel_do_simd, + { + llvm::omp::allowedClauses_OMPD_target_parallel_do_simd, + llvm::omp::allowedOnceClauses_OMPD_target_parallel_do_simd, + llvm::omp::allowedExclusiveClauses_OMPD_target_parallel_do_simd, + llvm::omp::requiredClauses_OMPD_target_parallel_do_simd, + } + }, + {llvm::omp::Directive::OMPD_target_parallel_for, + { + llvm::omp::allowedClauses_OMPD_target_parallel_for, + llvm::omp::allowedOnceClauses_OMPD_target_parallel_for, + llvm::omp::allowedExclusiveClauses_OMPD_target_parallel_for, + llvm::omp::requiredClauses_OMPD_target_parallel_for, + } + }, + {llvm::omp::Directive::OMPD_target_parallel_for_simd, + { + llvm::omp::allowedClauses_OMPD_target_parallel_for_simd, + llvm::omp::allowedOnceClauses_OMPD_target_parallel_for_simd, + llvm::omp::allowedExclusiveClauses_OMPD_target_parallel_for_simd, + llvm::omp::requiredClauses_OMPD_target_parallel_for_simd, + } + }, + {llvm::omp::Directive::OMPD_target_simd, + { + llvm::omp::allowedClauses_OMPD_target_simd, + llvm::omp::allowedOnceClauses_OMPD_target_simd, + llvm::omp::allowedExclusiveClauses_OMPD_target_simd, + llvm::omp::requiredClauses_OMPD_target_simd, + } + }, + {llvm::omp::Directive::OMPD_target_teams, + { + llvm::omp::allowedClauses_OMPD_target_teams, + llvm::omp::allowedOnceClauses_OMPD_target_teams, + llvm::omp::allowedExclusiveClauses_OMPD_target_teams, + llvm::omp::requiredClauses_OMPD_target_teams, + } + }, + {llvm::omp::Directive::OMPD_target_teams_distribute, + { + llvm::omp::allowedClauses_OMPD_target_teams_distribute, + llvm::omp::allowedOnceClauses_OMPD_target_teams_distribute, + llvm::omp::allowedExclusiveClauses_OMPD_target_teams_distribute, + llvm::omp::requiredClauses_OMPD_target_teams_distribute, + } + }, + {llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do, + { + llvm::omp::allowedClauses_OMPD_target_teams_distribute_parallel_do, + llvm::omp::allowedOnceClauses_OMPD_target_teams_distribute_parallel_do, + llvm::omp::allowedExclusiveClauses_OMPD_target_teams_distribute_parallel_do, + llvm::omp::requiredClauses_OMPD_target_teams_distribute_parallel_do, + } + }, + {llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do_simd, + { + llvm::omp::allowedClauses_OMPD_target_teams_distribute_parallel_do_simd, + llvm::omp::allowedOnceClauses_OMPD_target_teams_distribute_parallel_do_simd, + llvm::omp::allowedExclusiveClauses_OMPD_target_teams_distribute_parallel_do_simd, + llvm::omp::requiredClauses_OMPD_target_teams_distribute_parallel_do_simd, + } + }, + {llvm::omp::Directive::OMPD_target_teams_distribute_parallel_for, + { + llvm::omp::allowedClauses_OMPD_target_teams_distribute_parallel_for, + llvm::omp::allowedOnceClauses_OMPD_target_teams_distribute_parallel_for, + llvm::omp::allowedExclusiveClauses_OMPD_target_teams_distribute_parallel_for, + llvm::omp::requiredClauses_OMPD_target_teams_distribute_parallel_for, + } + }, + {llvm::omp::Directive::OMPD_target_teams_distribute_parallel_for_simd, + { + llvm::omp::allowedClauses_OMPD_target_teams_distribute_parallel_for_simd, + llvm::omp::allowedOnceClauses_OMPD_target_teams_distribute_parallel_for_simd, + llvm::omp::allowedExclusiveClauses_OMPD_target_teams_distribute_parallel_for_simd, + llvm::omp::requiredClauses_OMPD_target_teams_distribute_parallel_for_simd, + } + }, + {llvm::omp::Directive::OMPD_target_teams_distribute_simd, + { + llvm::omp::allowedClauses_OMPD_target_teams_distribute_simd, + llvm::omp::allowedOnceClauses_OMPD_target_teams_distribute_simd, + llvm::omp::allowedExclusiveClauses_OMPD_target_teams_distribute_simd, + llvm::omp::requiredClauses_OMPD_target_teams_distribute_simd, + } + }, + {llvm::omp::Directive::OMPD_target_update, + { + llvm::omp::allowedClauses_OMPD_target_update, + llvm::omp::allowedOnceClauses_OMPD_target_update, + llvm::omp::allowedExclusiveClauses_OMPD_target_update, + llvm::omp::requiredClauses_OMPD_target_update, + } + }, + {llvm::omp::Directive::OMPD_task, + { + llvm::omp::allowedClauses_OMPD_task, + llvm::omp::allowedOnceClauses_OMPD_task, + llvm::omp::allowedExclusiveClauses_OMPD_task, + llvm::omp::requiredClauses_OMPD_task, + } + }, + {llvm::omp::Directive::OMPD_taskgroup, + { + llvm::omp::allowedClauses_OMPD_taskgroup, + llvm::omp::allowedOnceClauses_OMPD_taskgroup, + llvm::omp::allowedExclusiveClauses_OMPD_taskgroup, + llvm::omp::requiredClauses_OMPD_taskgroup, + } + }, + {llvm::omp::Directive::OMPD_taskloop, + { + llvm::omp::allowedClauses_OMPD_taskloop, + llvm::omp::allowedOnceClauses_OMPD_taskloop, + llvm::omp::allowedExclusiveClauses_OMPD_taskloop, + llvm::omp::requiredClauses_OMPD_taskloop, + } + }, + {llvm::omp::Directive::OMPD_taskloop_simd, + { + llvm::omp::allowedClauses_OMPD_taskloop_simd, + llvm::omp::allowedOnceClauses_OMPD_taskloop_simd, + llvm::omp::allowedExclusiveClauses_OMPD_taskloop_simd, + llvm::omp::requiredClauses_OMPD_taskloop_simd, + } + }, + {llvm::omp::Directive::OMPD_taskwait, + { + llvm::omp::allowedClauses_OMPD_taskwait, + llvm::omp::allowedOnceClauses_OMPD_taskwait, + llvm::omp::allowedExclusiveClauses_OMPD_taskwait, + llvm::omp::requiredClauses_OMPD_taskwait, + } + }, + {llvm::omp::Directive::OMPD_taskyield, + { + llvm::omp::allowedClauses_OMPD_taskyield, + llvm::omp::allowedOnceClauses_OMPD_taskyield, + llvm::omp::allowedExclusiveClauses_OMPD_taskyield, + llvm::omp::requiredClauses_OMPD_taskyield, + } + }, + {llvm::omp::Directive::OMPD_teams, + { + llvm::omp::allowedClauses_OMPD_teams, + llvm::omp::allowedOnceClauses_OMPD_teams, + llvm::omp::allowedExclusiveClauses_OMPD_teams, + llvm::omp::requiredClauses_OMPD_teams, + } + }, + {llvm::omp::Directive::OMPD_teams_distribute, + { + llvm::omp::allowedClauses_OMPD_teams_distribute, + llvm::omp::allowedOnceClauses_OMPD_teams_distribute, + llvm::omp::allowedExclusiveClauses_OMPD_teams_distribute, + llvm::omp::requiredClauses_OMPD_teams_distribute, + } + }, + {llvm::omp::Directive::OMPD_teams_distribute_parallel_do, + { + llvm::omp::allowedClauses_OMPD_teams_distribute_parallel_do, + llvm::omp::allowedOnceClauses_OMPD_teams_distribute_parallel_do, + llvm::omp::allowedExclusiveClauses_OMPD_teams_distribute_parallel_do, + llvm::omp::requiredClauses_OMPD_teams_distribute_parallel_do, + } + }, + {llvm::omp::Directive::OMPD_teams_distribute_parallel_do_simd, + { + llvm::omp::allowedClauses_OMPD_teams_distribute_parallel_do_simd, + llvm::omp::allowedOnceClauses_OMPD_teams_distribute_parallel_do_simd, + llvm::omp::allowedExclusiveClauses_OMPD_teams_distribute_parallel_do_simd, + llvm::omp::requiredClauses_OMPD_teams_distribute_parallel_do_simd, + } + }, + {llvm::omp::Directive::OMPD_teams_distribute_parallel_for, + { + llvm::omp::allowedClauses_OMPD_teams_distribute_parallel_for, + llvm::omp::allowedOnceClauses_OMPD_teams_distribute_parallel_for, + llvm::omp::allowedExclusiveClauses_OMPD_teams_distribute_parallel_for, + llvm::omp::requiredClauses_OMPD_teams_distribute_parallel_for, + } + }, + {llvm::omp::Directive::OMPD_teams_distribute_parallel_for_simd, + { + llvm::omp::allowedClauses_OMPD_teams_distribute_parallel_for_simd, + llvm::omp::allowedOnceClauses_OMPD_teams_distribute_parallel_for_simd, + llvm::omp::allowedExclusiveClauses_OMPD_teams_distribute_parallel_for_simd, + llvm::omp::requiredClauses_OMPD_teams_distribute_parallel_for_simd, + } + }, + {llvm::omp::Directive::OMPD_teams_distribute_simd, + { + llvm::omp::allowedClauses_OMPD_teams_distribute_simd, + llvm::omp::allowedOnceClauses_OMPD_teams_distribute_simd, + llvm::omp::allowedExclusiveClauses_OMPD_teams_distribute_simd, + llvm::omp::requiredClauses_OMPD_teams_distribute_simd, + } + }, + {llvm::omp::Directive::OMPD_threadprivate, + { + llvm::omp::allowedClauses_OMPD_threadprivate, + llvm::omp::allowedOnceClauses_OMPD_threadprivate, + llvm::omp::allowedExclusiveClauses_OMPD_threadprivate, + llvm::omp::requiredClauses_OMPD_threadprivate, + } + }, + {llvm::omp::Directive::OMPD_tile, + { + llvm::omp::allowedClauses_OMPD_tile, + llvm::omp::allowedOnceClauses_OMPD_tile, + llvm::omp::allowedExclusiveClauses_OMPD_tile, + llvm::omp::requiredClauses_OMPD_tile, + } + }, + {llvm::omp::Directive::OMPD_unknown, + { + llvm::omp::allowedClauses_OMPD_unknown, + llvm::omp::allowedOnceClauses_OMPD_unknown, + llvm::omp::allowedExclusiveClauses_OMPD_unknown, + llvm::omp::requiredClauses_OMPD_unknown, + } + }, + {llvm::omp::Directive::OMPD_unroll, + { + llvm::omp::allowedClauses_OMPD_unroll, + llvm::omp::allowedOnceClauses_OMPD_unroll, + llvm::omp::allowedExclusiveClauses_OMPD_unroll, + llvm::omp::requiredClauses_OMPD_unroll, + } + }, + {llvm::omp::Directive::OMPD_workshare, + { + llvm::omp::allowedClauses_OMPD_workshare, + llvm::omp::allowedOnceClauses_OMPD_workshare, + llvm::omp::allowedExclusiveClauses_OMPD_workshare, + llvm::omp::requiredClauses_OMPD_workshare, + } + }, + {llvm::omp::Directive::OMPD_dispatch, + { + llvm::omp::allowedClauses_OMPD_dispatch, + llvm::omp::allowedOnceClauses_OMPD_dispatch, + llvm::omp::allowedExclusiveClauses_OMPD_dispatch, + llvm::omp::requiredClauses_OMPD_dispatch, + } + }, + {llvm::omp::Directive::OMPD_interop, + { + llvm::omp::allowedClauses_OMPD_interop, + llvm::omp::allowedOnceClauses_OMPD_interop, + llvm::omp::allowedExclusiveClauses_OMPD_interop, + llvm::omp::requiredClauses_OMPD_interop, + } + }, + {llvm::omp::Directive::OMPD_loop, + { + llvm::omp::allowedClauses_OMPD_loop, + llvm::omp::allowedOnceClauses_OMPD_loop, + llvm::omp::allowedExclusiveClauses_OMPD_loop, + llvm::omp::requiredClauses_OMPD_loop, + } + }, + {llvm::omp::Directive::OMPD_masked, + { + llvm::omp::allowedClauses_OMPD_masked, + llvm::omp::allowedOnceClauses_OMPD_masked, + llvm::omp::allowedExclusiveClauses_OMPD_masked, + llvm::omp::requiredClauses_OMPD_masked, + } + }, + {llvm::omp::Directive::OMPD_parallel_loop, + { + llvm::omp::allowedClauses_OMPD_parallel_loop, + llvm::omp::allowedOnceClauses_OMPD_parallel_loop, + llvm::omp::allowedExclusiveClauses_OMPD_parallel_loop, + llvm::omp::requiredClauses_OMPD_parallel_loop, + } + }, + {llvm::omp::Directive::OMPD_target_parallel_loop, + { + llvm::omp::allowedClauses_OMPD_target_parallel_loop, + llvm::omp::allowedOnceClauses_OMPD_target_parallel_loop, + llvm::omp::allowedExclusiveClauses_OMPD_target_parallel_loop, + llvm::omp::requiredClauses_OMPD_target_parallel_loop, + } + }, + {llvm::omp::Directive::OMPD_target_teams_loop, + { + llvm::omp::allowedClauses_OMPD_target_teams_loop, + llvm::omp::allowedOnceClauses_OMPD_target_teams_loop, + llvm::omp::allowedExclusiveClauses_OMPD_target_teams_loop, + llvm::omp::requiredClauses_OMPD_target_teams_loop, + } + }, + {llvm::omp::Directive::OMPD_teams_loop, + { + llvm::omp::allowedClauses_OMPD_teams_loop, + llvm::omp::allowedOnceClauses_OMPD_teams_loop, + llvm::omp::allowedExclusiveClauses_OMPD_teams_loop, + llvm::omp::requiredClauses_OMPD_teams_loop, + } + }, +} + +#endif // GEN_FLANG_DIRECTIVE_CLAUSE_MAP + +#ifdef GEN_FLANG_CLAUSE_PARSER_CLASSES +#undef GEN_FLANG_CLAUSE_PARSER_CLASSES + +EMPTY_CLASS(AcqRel); +EMPTY_CLASS(Acquire); +EMPTY_CLASS(AdjustArgs); +EMPTY_CLASS(Affinity); +EMPTY_CLASS(Align); +WRAPPER_CLASS(Aligned, OmpAlignedClause); +WRAPPER_CLASS(Allocate, OmpAllocateClause); +WRAPPER_CLASS(Allocator, ScalarIntExpr); +EMPTY_CLASS(AppendArgs); +EMPTY_CLASS(At); +WRAPPER_CLASS(AtomicDefaultMemOrder, OmpAtomicDefaultMemOrderClause); +EMPTY_CLASS(Bind); +EMPTY_CLASS(CancellationConstructType); +EMPTY_CLASS(Capture); +WRAPPER_CLASS(Collapse, ScalarIntConstantExpr); +EMPTY_CLASS(Compare); +WRAPPER_CLASS(Copyprivate, OmpObjectList); +WRAPPER_CLASS(Copyin, OmpObjectList); +WRAPPER_CLASS(Default, OmpDefaultClause); +WRAPPER_CLASS(Defaultmap, OmpDefaultmapClause); +WRAPPER_CLASS(Depend, OmpDependClause); +EMPTY_CLASS(Depobj); +EMPTY_CLASS(Destroy); +EMPTY_CLASS(Detach); +WRAPPER_CLASS(Device, OmpDeviceClause); +EMPTY_CLASS(DeviceType); +WRAPPER_CLASS(DistSchedule, std::optional<ScalarIntExpr>); +EMPTY_CLASS(DynamicAllocators); +EMPTY_CLASS(Exclusive); +WRAPPER_CLASS(Filter, ScalarIntExpr); +WRAPPER_CLASS(Final, ScalarLogicalExpr); +WRAPPER_CLASS(Firstprivate, OmpObjectList); +EMPTY_CLASS(Flush); +WRAPPER_CLASS(From, OmpObjectList); +EMPTY_CLASS(Full); +WRAPPER_CLASS(Grainsize, ScalarIntExpr); +WRAPPER_CLASS(HasDeviceAddr, std::list<Name>); +WRAPPER_CLASS(Hint, ConstantExpr); +WRAPPER_CLASS(If, OmpIfClause); +WRAPPER_CLASS(InReduction, OmpInReductionClause); +EMPTY_CLASS(Inbranch); +EMPTY_CLASS(Inclusive); +EMPTY_CLASS(Indirect); +EMPTY_CLASS(Init); +WRAPPER_CLASS(IsDevicePtr, std::list<Name>); +WRAPPER_CLASS(Lastprivate, OmpObjectList); +WRAPPER_CLASS(Linear, OmpLinearClause); +WRAPPER_CLASS(Link, OmpObjectList); +WRAPPER_CLASS(Map, OmpMapClause); +EMPTY_CLASS(Match); +EMPTY_CLASS(MemoryOrder); +EMPTY_CLASS(Mergeable); +EMPTY_CLASS(Message); +EMPTY_CLASS(Nogroup); +EMPTY_CLASS(Nowait); +WRAPPER_CLASS(Nocontext, ScalarLogicalExpr); +WRAPPER_CLASS(Nontemporal, std::list<Name>); +EMPTY_CLASS(Notinbranch); +WRAPPER_CLASS(Novariants, ScalarLogicalExpr); +WRAPPER_CLASS(NumTasks, ScalarIntExpr); +WRAPPER_CLASS(NumTeams, ScalarIntExpr); +WRAPPER_CLASS(NumThreads, ScalarIntExpr); +WRAPPER_CLASS(OmpxDynCgroupMem, ScalarIntExpr); +EMPTY_CLASS(Order); +WRAPPER_CLASS(Ordered, std::optional<ScalarIntConstantExpr>); +WRAPPER_CLASS(Partial, std::optional<ScalarIntConstantExpr>); +WRAPPER_CLASS(Priority, ScalarIntExpr); +WRAPPER_CLASS(Private, OmpObjectList); +WRAPPER_CLASS(ProcBind, OmpProcBindClause); +EMPTY_CLASS(Read); +WRAPPER_CLASS(Reduction, OmpReductionClause); +EMPTY_CLASS(Relaxed); +EMPTY_CLASS(Release); +EMPTY_CLASS(ReverseOffload); +WRAPPER_CLASS(Safelen, ScalarIntConstantExpr); +WRAPPER_CLASS(Schedule, OmpScheduleClause); +EMPTY_CLASS(SeqCst); +EMPTY_CLASS(Severity); +WRAPPER_CLASS(Shared, OmpObjectList); +EMPTY_CLASS(Simd); +WRAPPER_CLASS(Simdlen, ScalarIntConstantExpr); +WRAPPER_CLASS(Sizes, std::list<ScalarIntExpr>); +WRAPPER_CLASS(TaskReduction, OmpReductionClause); +WRAPPER_CLASS(ThreadLimit, ScalarIntExpr); +EMPTY_CLASS(Threadprivate); +EMPTY_CLASS(Threads); +WRAPPER_CLASS(To, OmpObjectList); +EMPTY_CLASS(UnifiedAddress); +EMPTY_CLASS(UnifiedSharedMemory); +WRAPPER_CLASS(Uniform, std::list<Name>); +EMPTY_CLASS(Unknown); +EMPTY_CLASS(Untied); +EMPTY_CLASS(Update); +EMPTY_CLASS(Use); +EMPTY_CLASS(UseDeviceAddr); +WRAPPER_CLASS(UseDevicePtr, std::list<Name>); +EMPTY_CLASS(UsesAllocators); +EMPTY_CLASS(When); +EMPTY_CLASS(Write); + +#endif // GEN_FLANG_CLAUSE_PARSER_CLASSES + +#ifdef GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST +#undef GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST + +AcqRel +, Acquire +, AdjustArgs +, Affinity +, Align +, Aligned +, Allocate +, Allocator +, AppendArgs +, At +, AtomicDefaultMemOrder +, Bind +, CancellationConstructType +, Capture +, Collapse +, Compare +, Copyprivate +, Copyin +, Default +, Defaultmap +, Depend +, Depobj +, Destroy +, Detach +, Device +, DeviceType +, DistSchedule +, DynamicAllocators +, Exclusive +, Filter +, Final +, Firstprivate +, Flush +, From +, Full +, Grainsize +, HasDeviceAddr +, Hint +, If +, InReduction +, Inbranch +, Inclusive +, Indirect +, Init +, IsDevicePtr +, Lastprivate +, Linear +, Link +, Map +, Match +, MemoryOrder +, Mergeable +, Message +, Nogroup +, Nowait +, Nocontext +, Nontemporal +, Notinbranch +, Novariants +, NumTasks +, NumTeams +, NumThreads +, OmpxDynCgroupMem +, Order +, Ordered +, Partial +, Priority +, Private +, ProcBind +, Read +, Reduction +, Relaxed +, Release +, ReverseOffload +, Safelen +, Schedule +, SeqCst +, Severity +, Shared +, Simd +, Simdlen +, Sizes +, TaskReduction +, ThreadLimit +, Threadprivate +, Threads +, To +, UnifiedAddress +, UnifiedSharedMemory +, Uniform +, Unknown +, Untied +, Update +, Use +, UseDeviceAddr +, UseDevicePtr +, UsesAllocators +, When +, Write + +#endif // GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST + +#ifdef GEN_FLANG_DUMP_PARSE_TREE_CLAUSES +#undef GEN_FLANG_DUMP_PARSE_TREE_CLAUSES + +NODE(OmpClause, AcqRel) +NODE(OmpClause, Acquire) +NODE(OmpClause, AdjustArgs) +NODE(OmpClause, Affinity) +NODE(OmpClause, Align) +NODE(OmpClause, Aligned) +NODE(OmpClause, Allocate) +NODE(OmpClause, Allocator) +NODE(OmpClause, AppendArgs) +NODE(OmpClause, At) +NODE(OmpClause, AtomicDefaultMemOrder) +NODE(OmpClause, Bind) +NODE(OmpClause, CancellationConstructType) +NODE(OmpClause, Capture) +NODE(OmpClause, Collapse) +NODE(OmpClause, Compare) +NODE(OmpClause, Copyprivate) +NODE(OmpClause, Copyin) +NODE(OmpClause, Default) +NODE(OmpClause, Defaultmap) +NODE(OmpClause, Depend) +NODE(OmpClause, Depobj) +NODE(OmpClause, Destroy) +NODE(OmpClause, Detach) +NODE(OmpClause, Device) +NODE(OmpClause, DeviceType) +NODE(OmpClause, DistSchedule) +NODE(OmpClause, DynamicAllocators) +NODE(OmpClause, Exclusive) +NODE(OmpClause, Filter) +NODE(OmpClause, Final) +NODE(OmpClause, Firstprivate) +NODE(OmpClause, Flush) +NODE(OmpClause, From) +NODE(OmpClause, Full) +NODE(OmpClause, Grainsize) +NODE(OmpClause, HasDeviceAddr) +NODE(OmpClause, Hint) +NODE(OmpClause, If) +NODE(OmpClause, InReduction) +NODE(OmpClause, Inbranch) +NODE(OmpClause, Inclusive) +NODE(OmpClause, Indirect) +NODE(OmpClause, Init) +NODE(OmpClause, IsDevicePtr) +NODE(OmpClause, Lastprivate) +NODE(OmpClause, Linear) +NODE(OmpClause, Link) +NODE(OmpClause, Map) +NODE(OmpClause, Match) +NODE(OmpClause, MemoryOrder) +NODE(OmpClause, Mergeable) +NODE(OmpClause, Message) +NODE(OmpClause, Nogroup) +NODE(OmpClause, Nowait) +NODE(OmpClause, Nocontext) +NODE(OmpClause, Nontemporal) +NODE(OmpClause, Notinbranch) +NODE(OmpClause, Novariants) +NODE(OmpClause, NumTasks) +NODE(OmpClause, NumTeams) +NODE(OmpClause, NumThreads) +NODE(OmpClause, OmpxDynCgroupMem) +NODE(OmpClause, Order) +NODE(OmpClause, Ordered) +NODE(OmpClause, Partial) +NODE(OmpClause, Priority) +NODE(OmpClause, Private) +NODE(OmpClause, ProcBind) +NODE(OmpClause, Read) +NODE(OmpClause, Reduction) +NODE(OmpClause, Relaxed) +NODE(OmpClause, Release) +NODE(OmpClause, ReverseOffload) +NODE(OmpClause, Safelen) +NODE(OmpClause, Schedule) +NODE(OmpClause, SeqCst) +NODE(OmpClause, Severity) +NODE(OmpClause, Shared) +NODE(OmpClause, Simd) +NODE(OmpClause, Simdlen) +NODE(OmpClause, Sizes) +NODE(OmpClause, TaskReduction) +NODE(OmpClause, ThreadLimit) +NODE(OmpClause, Threadprivate) +NODE(OmpClause, Threads) +NODE(OmpClause, To) +NODE(OmpClause, UnifiedAddress) +NODE(OmpClause, UnifiedSharedMemory) +NODE(OmpClause, Uniform) +NODE(OmpClause, Unknown) +NODE(OmpClause, Untied) +NODE(OmpClause, Update) +NODE(OmpClause, Use) +NODE(OmpClause, UseDeviceAddr) +NODE(OmpClause, UseDevicePtr) +NODE(OmpClause, UsesAllocators) +NODE(OmpClause, When) +NODE(OmpClause, Write) + +#endif // GEN_FLANG_DUMP_PARSE_TREE_CLAUSES + +#ifdef GEN_FLANG_CLAUSE_UNPARSE +#undef GEN_FLANG_CLAUSE_UNPARSE + +void Before(const OmpClause::AcqRel &) { Word("ACQ_REL"); } +void Before(const OmpClause::Acquire &) { Word("ACQUIRE"); } +void Before(const OmpClause::AdjustArgs &) { Word("ADJUST_ARGS"); } +void Before(const OmpClause::Affinity &) { Word("AFFINITY"); } +void Before(const OmpClause::Align &) { Word("ALIGN"); } +void Unparse(const OmpClause::Aligned &x) { + Word("ALIGNED"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Allocate &x) { + Word("ALLOCATE"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Allocator &x) { + Word("ALLOCATOR"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::AppendArgs &) { Word("APPEND_ARGS"); } +void Before(const OmpClause::At &) { Word("AT"); } +void Unparse(const OmpClause::AtomicDefaultMemOrder &x) { + Word("ATOMIC_DEFAULT_MEM_ORDER"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::Bind &) { Word("BIND"); } +void Before(const OmpClause::CancellationConstructType &) { Word("CANCELLATION_CONSTRUCT_TYPE"); } +void Before(const OmpClause::Capture &) { Word("CAPTURE"); } +void Unparse(const OmpClause::Collapse &x) { + Word("COLLAPSE"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::Compare &) { Word("COMPARE"); } +void Unparse(const OmpClause::Copyprivate &x) { + Word("COPYPRIVATE"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Copyin &x) { + Word("COPYIN"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Default &x) { + Word("DEFAULT"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Defaultmap &x) { + Word("DEFAULTMAP"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Depend &x) { + Word("DEPEND"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::Depobj &) { Word("DEPOBJ"); } +void Before(const OmpClause::Destroy &) { Word("DESTROY"); } +void Before(const OmpClause::Detach &) { Word("DETACH"); } +void Unparse(const OmpClause::Device &x) { + Word("DEVICE"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::DeviceType &) { Word("DEVICE_TYPE"); } +void Unparse(const OmpClause::DistSchedule &x) { + Word("DIST_SCHEDULE"); + Walk("(", x.v, ")"); +} +void Before(const OmpClause::DynamicAllocators &) { Word("DYNAMIC_ALLOCATORS"); } +void Before(const OmpClause::Exclusive &) { Word("EXCLUSIVE"); } +void Unparse(const OmpClause::Filter &x) { + Word("FILTER"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Final &x) { + Word("FINAL"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Firstprivate &x) { + Word("FIRSTPRIVATE"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::Flush &) { Word("FLUSH"); } +void Unparse(const OmpClause::From &x) { + Word("FROM"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::Full &) { Word("FULL"); } +void Unparse(const OmpClause::Grainsize &x) { + Word("GRAINSIZE"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::HasDeviceAddr &x) { + Word("HAS_DEVICE_ADDR"); + Put("("); + Walk(x.v, ","); + Put(")"); +} +void Unparse(const OmpClause::Hint &x) { + Word("HINT"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::If &x) { + Word("IF"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::InReduction &x) { + Word("IN_REDUCTION"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::Inbranch &) { Word("INBRANCH"); } +void Before(const OmpClause::Inclusive &) { Word("INCLUSIVE"); } +void Before(const OmpClause::Indirect &) { Word("INDIRECT"); } +void Before(const OmpClause::Init &) { Word("INIT"); } +void Unparse(const OmpClause::IsDevicePtr &x) { + Word("IS_DEVICE_PTR"); + Put("("); + Walk(x.v, ","); + Put(")"); +} +void Unparse(const OmpClause::Lastprivate &x) { + Word("LASTPRIVATE"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Linear &x) { + Word("LINEAR"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Link &x) { + Word("LINK"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Map &x) { + Word("MAP"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::Match &) { Word("MATCH"); } +void Before(const OmpClause::MemoryOrder &) { Word("MEMORY_ORDER"); } +void Before(const OmpClause::Mergeable &) { Word("MERGEABLE"); } +void Before(const OmpClause::Message &) { Word("MESSAGE"); } +void Before(const OmpClause::Nogroup &) { Word("NOGROUP"); } +void Before(const OmpClause::Nowait &) { Word("NOWAIT"); } +void Unparse(const OmpClause::Nocontext &x) { + Word("NOCONTEXT"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Nontemporal &x) { + Word("NONTEMPORAL"); + Put("("); + Walk(x.v, ","); + Put(")"); +} +void Before(const OmpClause::Notinbranch &) { Word("NOTINBRANCH"); } +void Unparse(const OmpClause::Novariants &x) { + Word("NOVARIANTS"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::NumTasks &x) { + Word("NUM_TASKS"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::NumTeams &x) { + Word("NUM_TEAMS"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::NumThreads &x) { + Word("NUM_THREADS"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::OmpxDynCgroupMem &x) { + Word("OMPX_DYN_CGROUP_MEM"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::Order &) { Word("ORDER"); } +void Unparse(const OmpClause::Ordered &x) { + Word("ORDERED"); + Walk("(", x.v, ")"); +} +void Unparse(const OmpClause::Partial &x) { + Word("PARTIAL"); + Walk("(", x.v, ")"); +} +void Unparse(const OmpClause::Priority &x) { + Word("PRIORITY"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Private &x) { + Word("PRIVATE"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::ProcBind &x) { + Word("PROC_BIND"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::Read &) { Word("READ"); } +void Unparse(const OmpClause::Reduction &x) { + Word("REDUCTION"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::Relaxed &) { Word("RELAXED"); } +void Before(const OmpClause::Release &) { Word("RELEASE"); } +void Before(const OmpClause::ReverseOffload &) { Word("REVERSE_OFFLOAD"); } +void Unparse(const OmpClause::Safelen &x) { + Word("SAFELEN"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Schedule &x) { + Word("SCHEDULE"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::SeqCst &) { Word("SEQ_CST"); } +void Before(const OmpClause::Severity &) { Word("SEVERITY"); } +void Unparse(const OmpClause::Shared &x) { + Word("SHARED"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::Simd &) { Word("SIMD"); } +void Unparse(const OmpClause::Simdlen &x) { + Word("SIMDLEN"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::Sizes &x) { + Word("SIZES"); + Put("("); + Walk(x.v, ","); + Put(")"); +} +void Unparse(const OmpClause::TaskReduction &x) { + Word("TASK_REDUCTION"); + Put("("); + Walk(x.v); + Put(")"); +} +void Unparse(const OmpClause::ThreadLimit &x) { + Word("THREAD_LIMIT"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::Threadprivate &) { Word("THREADPRIVATE"); } +void Before(const OmpClause::Threads &) { Word("THREADS"); } +void Unparse(const OmpClause::To &x) { + Word("TO"); + Put("("); + Walk(x.v); + Put(")"); +} +void Before(const OmpClause::UnifiedAddress &) { Word("UNIFIED_ADDRESS"); } +void Before(const OmpClause::UnifiedSharedMemory &) { Word("UNIFIED_SHARED_MEMORY"); } +void Unparse(const OmpClause::Uniform &x) { + Word("UNIFORM"); + Put("("); + Walk(x.v, ","); + Put(")"); +} +void Before(const OmpClause::Unknown &) { Word("UNKNOWN"); } +void Before(const OmpClause::Untied &) { Word("UNTIED"); } +void Before(const OmpClause::Update &) { Word("UPDATE"); } +void Before(const OmpClause::Use &) { Word("USE"); } +void Before(const OmpClause::UseDeviceAddr &) { Word("USE_DEVICE_ADDR"); } +void Unparse(const OmpClause::UseDevicePtr &x) { + Word("USE_DEVICE_PTR"); + Put("("); + Walk(x.v, ","); + Put(")"); +} +void Before(const OmpClause::UsesAllocators &) { Word("USES_ALLOCATORS"); } +void Before(const OmpClause::When &) { Word("WHEN"); } +void Before(const OmpClause::Write &) { Word("WRITE"); } + +#endif // GEN_FLANG_CLAUSE_UNPARSE + +#ifdef GEN_FLANG_CLAUSE_CHECK_ENTER +#undef GEN_FLANG_CLAUSE_CHECK_ENTER + +void Enter(const parser::OmpClause::AcqRel &); +void Enter(const parser::OmpClause::Acquire &); +void Enter(const parser::OmpClause::AdjustArgs &); +void Enter(const parser::OmpClause::Affinity &); +void Enter(const parser::OmpClause::Align &); +void Enter(const parser::OmpClause::Aligned &); +void Enter(const parser::OmpClause::Allocate &); +void Enter(const parser::OmpClause::Allocator &); +void Enter(const parser::OmpClause::AppendArgs &); +void Enter(const parser::OmpClause::At &); +void Enter(const parser::OmpClause::AtomicDefaultMemOrder &); +void Enter(const parser::OmpClause::Bind &); +void Enter(const parser::OmpClause::CancellationConstructType &); +void Enter(const parser::OmpClause::Capture &); +void Enter(const parser::OmpClause::Collapse &); +void Enter(const parser::OmpClause::Compare &); +void Enter(const parser::OmpClause::Copyprivate &); +void Enter(const parser::OmpClause::Copyin &); +void Enter(const parser::OmpClause::Default &); +void Enter(const parser::OmpClause::Defaultmap &); +void Enter(const parser::OmpClause::Depend &); +void Enter(const parser::OmpClause::Depobj &); +void Enter(const parser::OmpClause::Destroy &); +void Enter(const parser::OmpClause::Detach &); +void Enter(const parser::OmpClause::Device &); +void Enter(const parser::OmpClause::DeviceType &); +void Enter(const parser::OmpClause::DistSchedule &); +void Enter(const parser::OmpClause::DynamicAllocators &); +void Enter(const parser::OmpClause::Exclusive &); +void Enter(const parser::OmpClause::Filter &); +void Enter(const parser::OmpClause::Final &); +void Enter(const parser::OmpClause::Firstprivate &); +void Enter(const parser::OmpClause::Flush &); +void Enter(const parser::OmpClause::From &); +void Enter(const parser::OmpClause::Full &); +void Enter(const parser::OmpClause::Grainsize &); +void Enter(const parser::OmpClause::HasDeviceAddr &); +void Enter(const parser::OmpClause::Hint &); +void Enter(const parser::OmpClause::If &); +void Enter(const parser::OmpClause::InReduction &); +void Enter(const parser::OmpClause::Inbranch &); +void Enter(const parser::OmpClause::Inclusive &); +void Enter(const parser::OmpClause::Indirect &); +void Enter(const parser::OmpClause::Init &); +void Enter(const parser::OmpClause::IsDevicePtr &); +void Enter(const parser::OmpClause::Lastprivate &); +void Enter(const parser::OmpClause::Linear &); +void Enter(const parser::OmpClause::Link &); +void Enter(const parser::OmpClause::Map &); +void Enter(const parser::OmpClause::Match &); +void Enter(const parser::OmpClause::MemoryOrder &); +void Enter(const parser::OmpClause::Mergeable &); +void Enter(const parser::OmpClause::Message &); +void Enter(const parser::OmpClause::Nogroup &); +void Enter(const parser::OmpClause::Nowait &); +void Enter(const parser::OmpClause::Nocontext &); +void Enter(const parser::OmpClause::Nontemporal &); +void Enter(const parser::OmpClause::Notinbranch &); +void Enter(const parser::OmpClause::Novariants &); +void Enter(const parser::OmpClause::NumTasks &); +void Enter(const parser::OmpClause::NumTeams &); +void Enter(const parser::OmpClause::NumThreads &); +void Enter(const parser::OmpClause::OmpxDynCgroupMem &); +void Enter(const parser::OmpClause::Order &); +void Enter(const parser::OmpClause::Ordered &); +void Enter(const parser::OmpClause::Partial &); +void Enter(const parser::OmpClause::Priority &); +void Enter(const parser::OmpClause::Private &); +void Enter(const parser::OmpClause::ProcBind &); +void Enter(const parser::OmpClause::Read &); +void Enter(const parser::OmpClause::Reduction &); +void Enter(const parser::OmpClause::Relaxed &); +void Enter(const parser::OmpClause::Release &); +void Enter(const parser::OmpClause::ReverseOffload &); +void Enter(const parser::OmpClause::Safelen &); +void Enter(const parser::OmpClause::Schedule &); +void Enter(const parser::OmpClause::SeqCst &); +void Enter(const parser::OmpClause::Severity &); +void Enter(const parser::OmpClause::Shared &); +void Enter(const parser::OmpClause::Simd &); +void Enter(const parser::OmpClause::Simdlen &); +void Enter(const parser::OmpClause::Sizes &); +void Enter(const parser::OmpClause::TaskReduction &); +void Enter(const parser::OmpClause::ThreadLimit &); +void Enter(const parser::OmpClause::Threadprivate &); +void Enter(const parser::OmpClause::Threads &); +void Enter(const parser::OmpClause::To &); +void Enter(const parser::OmpClause::UnifiedAddress &); +void Enter(const parser::OmpClause::UnifiedSharedMemory &); +void Enter(const parser::OmpClause::Uniform &); +void Enter(const parser::OmpClause::Unknown &); +void Enter(const parser::OmpClause::Untied &); +void Enter(const parser::OmpClause::Update &); +void Enter(const parser::OmpClause::Use &); +void Enter(const parser::OmpClause::UseDeviceAddr &); +void Enter(const parser::OmpClause::UseDevicePtr &); +void Enter(const parser::OmpClause::UsesAllocators &); +void Enter(const parser::OmpClause::When &); +void Enter(const parser::OmpClause::Write &); + +#endif // GEN_FLANG_CLAUSE_CHECK_ENTER + +#ifdef GEN_FLANG_CLAUSE_PARSER_KIND_MAP +#undef GEN_FLANG_CLAUSE_PARSER_KIND_MAP + +if constexpr (std::is_same_v<A, parser::OmpClause::AcqRel>) + return llvm::omp::Clause::OMPC_acq_rel; +if constexpr (std::is_same_v<A, parser::OmpClause::Acquire>) + return llvm::omp::Clause::OMPC_acquire; +if constexpr (std::is_same_v<A, parser::OmpClause::AdjustArgs>) + return llvm::omp::Clause::OMPC_adjust_args; +if constexpr (std::is_same_v<A, parser::OmpClause::Affinity>) + return llvm::omp::Clause::OMPC_affinity; +if constexpr (std::is_same_v<A, parser::OmpClause::Align>) + return llvm::omp::Clause::OMPC_align; +if constexpr (std::is_same_v<A, parser::OmpClause::Aligned>) + return llvm::omp::Clause::OMPC_aligned; +if constexpr (std::is_same_v<A, parser::OmpClause::Allocate>) + return llvm::omp::Clause::OMPC_allocate; +if constexpr (std::is_same_v<A, parser::OmpClause::Allocator>) + return llvm::omp::Clause::OMPC_allocator; +if constexpr (std::is_same_v<A, parser::OmpClause::AppendArgs>) + return llvm::omp::Clause::OMPC_append_args; +if constexpr (std::is_same_v<A, parser::OmpClause::At>) + return llvm::omp::Clause::OMPC_at; +if constexpr (std::is_same_v<A, parser::OmpClause::AtomicDefaultMemOrder>) + return llvm::omp::Clause::OMPC_atomic_default_mem_order; +if constexpr (std::is_same_v<A, parser::OmpClause::Bind>) + return llvm::omp::Clause::OMPC_bind; +if constexpr (std::is_same_v<A, parser::OmpClause::CancellationConstructType>) + return llvm::omp::Clause::OMPC_cancellation_construct_type; +if constexpr (std::is_same_v<A, parser::OmpClause::Capture>) + return llvm::omp::Clause::OMPC_capture; +if constexpr (std::is_same_v<A, parser::OmpClause::Collapse>) + return llvm::omp::Clause::OMPC_collapse; +if constexpr (std::is_same_v<A, parser::OmpClause::Compare>) + return llvm::omp::Clause::OMPC_compare; +if constexpr (std::is_same_v<A, parser::OmpClause::Copyprivate>) + return llvm::omp::Clause::OMPC_copyprivate; +if constexpr (std::is_same_v<A, parser::OmpClause::Copyin>) + return llvm::omp::Clause::OMPC_copyin; +if constexpr (std::is_same_v<A, parser::OmpClause::Default>) + return llvm::omp::Clause::OMPC_default; +if constexpr (std::is_same_v<A, parser::OmpClause::Defaultmap>) + return llvm::omp::Clause::OMPC_defaultmap; +if constexpr (std::is_same_v<A, parser::OmpClause::Depend>) + return llvm::omp::Clause::OMPC_depend; +if constexpr (std::is_same_v<A, parser::OmpClause::Depobj>) + return llvm::omp::Clause::OMPC_depobj; +if constexpr (std::is_same_v<A, parser::OmpClause::Destroy>) + return llvm::omp::Clause::OMPC_destroy; +if constexpr (std::is_same_v<A, parser::OmpClause::Detach>) + return llvm::omp::Clause::OMPC_detach; +if constexpr (std::is_same_v<A, parser::OmpClause::Device>) + return llvm::omp::Clause::OMPC_device; +if constexpr (std::is_same_v<A, parser::OmpClause::DeviceType>) + return llvm::omp::Clause::OMPC_device_type; +if constexpr (std::is_same_v<A, parser::OmpClause::DistSchedule>) + return llvm::omp::Clause::OMPC_dist_schedule; +if constexpr (std::is_same_v<A, parser::OmpClause::DynamicAllocators>) + return llvm::omp::Clause::OMPC_dynamic_allocators; +if constexpr (std::is_same_v<A, parser::OmpClause::Exclusive>) + return llvm::omp::Clause::OMPC_exclusive; +if constexpr (std::is_same_v<A, parser::OmpClause::Filter>) + return llvm::omp::Clause::OMPC_filter; +if constexpr (std::is_same_v<A, parser::OmpClause::Final>) + return llvm::omp::Clause::OMPC_final; +if constexpr (std::is_same_v<A, parser::OmpClause::Firstprivate>) + return llvm::omp::Clause::OMPC_firstprivate; +if constexpr (std::is_same_v<A, parser::OmpClause::Flush>) + return llvm::omp::Clause::OMPC_flush; +if constexpr (std::is_same_v<A, parser::OmpClause::From>) + return llvm::omp::Clause::OMPC_from; +if constexpr (std::is_same_v<A, parser::OmpClause::Full>) + return llvm::omp::Clause::OMPC_full; +if constexpr (std::is_same_v<A, parser::OmpClause::Grainsize>) + return llvm::omp::Clause::OMPC_grainsize; +if constexpr (std::is_same_v<A, parser::OmpClause::HasDeviceAddr>) + return llvm::omp::Clause::OMPC_has_device_addr; +if constexpr (std::is_same_v<A, parser::OmpClause::Hint>) + return llvm::omp::Clause::OMPC_hint; +if constexpr (std::is_same_v<A, parser::OmpClause::If>) + return llvm::omp::Clause::OMPC_if; +if constexpr (std::is_same_v<A, parser::OmpClause::InReduction>) + return llvm::omp::Clause::OMPC_in_reduction; +if constexpr (std::is_same_v<A, parser::OmpClause::Inbranch>) + return llvm::omp::Clause::OMPC_inbranch; +if constexpr (std::is_same_v<A, parser::OmpClause::Inclusive>) + return llvm::omp::Clause::OMPC_inclusive; +if constexpr (std::is_same_v<A, parser::OmpClause::Indirect>) + return llvm::omp::Clause::OMPC_indirect; +if constexpr (std::is_same_v<A, parser::OmpClause::Init>) + return llvm::omp::Clause::OMPC_init; +if constexpr (std::is_same_v<A, parser::OmpClause::IsDevicePtr>) + return llvm::omp::Clause::OMPC_is_device_ptr; +if constexpr (std::is_same_v<A, parser::OmpClause::Lastprivate>) + return llvm::omp::Clause::OMPC_lastprivate; +if constexpr (std::is_same_v<A, parser::OmpClause::Linear>) + return llvm::omp::Clause::OMPC_linear; +if constexpr (std::is_same_v<A, parser::OmpClause::Link>) + return llvm::omp::Clause::OMPC_link; +if constexpr (std::is_same_v<A, parser::OmpClause::Map>) + return llvm::omp::Clause::OMPC_map; +if constexpr (std::is_same_v<A, parser::OmpClause::Match>) + return llvm::omp::Clause::OMPC_match; +if constexpr (std::is_same_v<A, parser::OmpClause::MemoryOrder>) + return llvm::omp::Clause::OMPC_memory_order; +if constexpr (std::is_same_v<A, parser::OmpClause::Mergeable>) + return llvm::omp::Clause::OMPC_mergeable; +if constexpr (std::is_same_v<A, parser::OmpClause::Message>) + return llvm::omp::Clause::OMPC_message; +if constexpr (std::is_same_v<A, parser::OmpClause::Nogroup>) + return llvm::omp::Clause::OMPC_nogroup; +if constexpr (std::is_same_v<A, parser::OmpClause::Nowait>) + return llvm::omp::Clause::OMPC_nowait; +if constexpr (std::is_same_v<A, parser::OmpClause::Nocontext>) + return llvm::omp::Clause::OMPC_nocontext; +if constexpr (std::is_same_v<A, parser::OmpClause::Nontemporal>) + return llvm::omp::Clause::OMPC_nontemporal; +if constexpr (std::is_same_v<A, parser::OmpClause::Notinbranch>) + return llvm::omp::Clause::OMPC_notinbranch; +if constexpr (std::is_same_v<A, parser::OmpClause::Novariants>) + return llvm::omp::Clause::OMPC_novariants; +if constexpr (std::is_same_v<A, parser::OmpClause::NumTasks>) + return llvm::omp::Clause::OMPC_num_tasks; +if constexpr (std::is_same_v<A, parser::OmpClause::NumTeams>) + return llvm::omp::Clause::OMPC_num_teams; +if constexpr (std::is_same_v<A, parser::OmpClause::NumThreads>) + return llvm::omp::Clause::OMPC_num_threads; +if constexpr (std::is_same_v<A, parser::OmpClause::OmpxDynCgroupMem>) + return llvm::omp::Clause::OMPC_ompx_dyn_cgroup_mem; +if constexpr (std::is_same_v<A, parser::OmpClause::Order>) + return llvm::omp::Clause::OMPC_order; +if constexpr (std::is_same_v<A, parser::OmpClause::Ordered>) + return llvm::omp::Clause::OMPC_ordered; +if constexpr (std::is_same_v<A, parser::OmpClause::Partial>) + return llvm::omp::Clause::OMPC_partial; +if constexpr (std::is_same_v<A, parser::OmpClause::Priority>) + return llvm::omp::Clause::OMPC_priority; +if constexpr (std::is_same_v<A, parser::OmpClause::Private>) + return llvm::omp::Clause::OMPC_private; +if constexpr (std::is_same_v<A, parser::OmpClause::ProcBind>) + return llvm::omp::Clause::OMPC_proc_bind; +if constexpr (std::is_same_v<A, parser::OmpClause::Read>) + return llvm::omp::Clause::OMPC_read; +if constexpr (std::is_same_v<A, parser::OmpClause::Reduction>) + return llvm::omp::Clause::OMPC_reduction; +if constexpr (std::is_same_v<A, parser::OmpClause::Relaxed>) + return llvm::omp::Clause::OMPC_relaxed; +if constexpr (std::is_same_v<A, parser::OmpClause::Release>) + return llvm::omp::Clause::OMPC_release; +if constexpr (std::is_same_v<A, parser::OmpClause::ReverseOffload>) + return llvm::omp::Clause::OMPC_reverse_offload; +if constexpr (std::is_same_v<A, parser::OmpClause::Safelen>) + return llvm::omp::Clause::OMPC_safelen; +if constexpr (std::is_same_v<A, parser::OmpClause::Schedule>) + return llvm::omp::Clause::OMPC_schedule; +if constexpr (std::is_same_v<A, parser::OmpClause::SeqCst>) + return llvm::omp::Clause::OMPC_seq_cst; +if constexpr (std::is_same_v<A, parser::OmpClause::Severity>) + return llvm::omp::Clause::OMPC_severity; +if constexpr (std::is_same_v<A, parser::OmpClause::Shared>) + return llvm::omp::Clause::OMPC_shared; +if constexpr (std::is_same_v<A, parser::OmpClause::Simd>) + return llvm::omp::Clause::OMPC_simd; +if constexpr (std::is_same_v<A, parser::OmpClause::Simdlen>) + return llvm::omp::Clause::OMPC_simdlen; +if constexpr (std::is_same_v<A, parser::OmpClause::Sizes>) + return llvm::omp::Clause::OMPC_sizes; +if constexpr (std::is_same_v<A, parser::OmpClause::TaskReduction>) + return llvm::omp::Clause::OMPC_task_reduction; +if constexpr (std::is_same_v<A, parser::OmpClause::ThreadLimit>) + return llvm::omp::Clause::OMPC_thread_limit; +if constexpr (std::is_same_v<A, parser::OmpClause::Threadprivate>) + return llvm::omp::Clause::OMPC_threadprivate; +if constexpr (std::is_same_v<A, parser::OmpClause::Threads>) + return llvm::omp::Clause::OMPC_threads; +if constexpr (std::is_same_v<A, parser::OmpClause::To>) + return llvm::omp::Clause::OMPC_to; +if constexpr (std::is_same_v<A, parser::OmpClause::UnifiedAddress>) + return llvm::omp::Clause::OMPC_unified_address; +if constexpr (std::is_same_v<A, parser::OmpClause::UnifiedSharedMemory>) + return llvm::omp::Clause::OMPC_unified_shared_memory; +if constexpr (std::is_same_v<A, parser::OmpClause::Uniform>) + return llvm::omp::Clause::OMPC_uniform; +if constexpr (std::is_same_v<A, parser::OmpClause::Unknown>) + return llvm::omp::Clause::OMPC_unknown; +if constexpr (std::is_same_v<A, parser::OmpClause::Untied>) + return llvm::omp::Clause::OMPC_untied; +if constexpr (std::is_same_v<A, parser::OmpClause::Update>) + return llvm::omp::Clause::OMPC_update; +if constexpr (std::is_same_v<A, parser::OmpClause::Use>) + return llvm::omp::Clause::OMPC_use; +if constexpr (std::is_same_v<A, parser::OmpClause::UseDeviceAddr>) + return llvm::omp::Clause::OMPC_use_device_addr; +if constexpr (std::is_same_v<A, parser::OmpClause::UseDevicePtr>) + return llvm::omp::Clause::OMPC_use_device_ptr; +if constexpr (std::is_same_v<A, parser::OmpClause::UsesAllocators>) + return llvm::omp::Clause::OMPC_uses_allocators; +if constexpr (std::is_same_v<A, parser::OmpClause::When>) + return llvm::omp::Clause::OMPC_when; +if constexpr (std::is_same_v<A, parser::OmpClause::Write>) + return llvm::omp::Clause::OMPC_write; +llvm_unreachable("Invalid OpenMP Parser clause"); + +#endif // GEN_FLANG_CLAUSE_PARSER_KIND_MAP + +#ifdef GEN_FLANG_CLAUSES_PARSER +#undef GEN_FLANG_CLAUSES_PARSER + +TYPE_PARSER( + "write" >> construct<OmpClause>(construct<OmpClause::Write>()) || + "when" >> construct<OmpClause>(construct<OmpClause::When>()) || + "uses_allocators" >> construct<OmpClause>(construct<OmpClause::UsesAllocators>()) || + "use_device_ptr" >> construct<OmpClause>(construct<OmpClause::UseDevicePtr>(parenthesized(name))) || + "use_device_addr" >> construct<OmpClause>(construct<OmpClause::UseDeviceAddr>()) || + "use" >> construct<OmpClause>(construct<OmpClause::Use>()) || + "update" >> construct<OmpClause>(construct<OmpClause::Update>()) || + "untied" >> construct<OmpClause>(construct<OmpClause::Untied>()) || + "unknown" >> construct<OmpClause>(construct<OmpClause::Unknown>()) || + "uniform" >> construct<OmpClause>(construct<OmpClause::Uniform>(parenthesized(name))) || + "unified_shared_memory" >> construct<OmpClause>(construct<OmpClause::UnifiedSharedMemory>()) || + "unified_address" >> construct<OmpClause>(construct<OmpClause::UnifiedAddress>()) || + "to" >> construct<OmpClause>(construct<OmpClause::To>(parenthesized(Parser<OmpObjectList>{}))) || + "threads" >> construct<OmpClause>(construct<OmpClause::Threads>()) || + "threadprivate" >> construct<OmpClause>(construct<OmpClause::Threadprivate>()) || + "thread_limit" >> construct<OmpClause>(construct<OmpClause::ThreadLimit>(parenthesized(scalarIntExpr))) || + "task_reduction" >> construct<OmpClause>(construct<OmpClause::TaskReduction>(parenthesized(Parser<OmpReductionClause>{}))) || + "sizes" >> construct<OmpClause>(construct<OmpClause::Sizes>(parenthesized(scalarIntExpr))) || + "simdlen" >> construct<OmpClause>(construct<OmpClause::Simdlen>(parenthesized(scalarIntConstantExpr))) || + "simd" >> construct<OmpClause>(construct<OmpClause::Simd>()) || + "shared" >> construct<OmpClause>(construct<OmpClause::Shared>(parenthesized(Parser<OmpObjectList>{}))) || + "severity" >> construct<OmpClause>(construct<OmpClause::Severity>()) || + "seq_cst" >> construct<OmpClause>(construct<OmpClause::SeqCst>()) || + "schedule" >> construct<OmpClause>(construct<OmpClause::Schedule>(parenthesized(Parser<OmpScheduleClause>{}))) || + "safelen" >> construct<OmpClause>(construct<OmpClause::Safelen>(parenthesized(scalarIntConstantExpr))) || + "reverse_offload" >> construct<OmpClause>(construct<OmpClause::ReverseOffload>()) || + "release" >> construct<OmpClause>(construct<OmpClause::Release>()) || + "relaxed" >> construct<OmpClause>(construct<OmpClause::Relaxed>()) || + "reduction" >> construct<OmpClause>(construct<OmpClause::Reduction>(parenthesized(Parser<OmpReductionClause>{}))) || + "read" >> construct<OmpClause>(construct<OmpClause::Read>()) || + "proc_bind" >> construct<OmpClause>(construct<OmpClause::ProcBind>(parenthesized(Parser<OmpProcBindClause>{}))) || + "private" >> construct<OmpClause>(construct<OmpClause::Private>(parenthesized(Parser<OmpObjectList>{}))) || + "priority" >> construct<OmpClause>(construct<OmpClause::Priority>(parenthesized(scalarIntExpr))) || + "partial" >> construct<OmpClause>(construct<OmpClause::Partial>(maybe(parenthesized(scalarIntConstantExpr)))) || + "ordered" >> construct<OmpClause>(construct<OmpClause::Ordered>(maybe(parenthesized(scalarIntConstantExpr)))) || + "order" >> construct<OmpClause>(construct<OmpClause::Order>()) || + "ompx_dyn_cgroup_mem" >> construct<OmpClause>(construct<OmpClause::OmpxDynCgroupMem>(parenthesized(scalarIntExpr))) || + "num_threads" >> construct<OmpClause>(construct<OmpClause::NumThreads>(parenthesized(scalarIntExpr))) || + "num_teams" >> construct<OmpClause>(construct<OmpClause::NumTeams>(parenthesized(scalarIntExpr))) || + "num_tasks" >> construct<OmpClause>(construct<OmpClause::NumTasks>(parenthesized(scalarIntExpr))) || + "nowait" >> construct<OmpClause>(construct<OmpClause::Nowait>()) || + "novariants" >> construct<OmpClause>(construct<OmpClause::Novariants>(parenthesized(scalarLogicalExpr))) || + "notinbranch" >> construct<OmpClause>(construct<OmpClause::Notinbranch>()) || + "nontemporal" >> construct<OmpClause>(construct<OmpClause::Nontemporal>(parenthesized(name))) || + "nogroup" >> construct<OmpClause>(construct<OmpClause::Nogroup>()) || + "nocontext" >> construct<OmpClause>(construct<OmpClause::Nocontext>(parenthesized(scalarLogicalExpr))) || + "message" >> construct<OmpClause>(construct<OmpClause::Message>()) || + "mergeable" >> construct<OmpClause>(construct<OmpClause::Mergeable>()) || + "memory_order" >> construct<OmpClause>(construct<OmpClause::MemoryOrder>()) || + "match" >> construct<OmpClause>(construct<OmpClause::Match>()) || + "map" >> construct<OmpClause>(construct<OmpClause::Map>(parenthesized(Parser<OmpMapClause>{}))) || + "link" >> construct<OmpClause>(construct<OmpClause::Link>(parenthesized(Parser<OmpObjectList>{}))) || + "linear" >> construct<OmpClause>(construct<OmpClause::Linear>(parenthesized(Parser<OmpLinearClause>{}))) || + "lastprivate" >> construct<OmpClause>(construct<OmpClause::Lastprivate>(parenthesized(Parser<OmpObjectList>{}))) || + "is_device_ptr" >> construct<OmpClause>(construct<OmpClause::IsDevicePtr>(parenthesized(name))) || + "init" >> construct<OmpClause>(construct<OmpClause::Init>()) || + "indirect" >> construct<OmpClause>(construct<OmpClause::Indirect>()) || + "inclusive" >> construct<OmpClause>(construct<OmpClause::Inclusive>()) || + "inbranch" >> construct<OmpClause>(construct<OmpClause::Inbranch>()) || + "in_reduction" >> construct<OmpClause>(construct<OmpClause::InReduction>(parenthesized(Parser<OmpInReductionClause>{}))) || + "if" >> construct<OmpClause>(construct<OmpClause::If>(parenthesized(Parser<OmpIfClause>{}))) || + "hint" >> construct<OmpClause>(construct<OmpClause::Hint>(parenthesized(Parser<ConstantExpr>{}))) || + "has_device_addr" >> construct<OmpClause>(construct<OmpClause::HasDeviceAddr>(parenthesized(name))) || + "grainsize" >> construct<OmpClause>(construct<OmpClause::Grainsize>(parenthesized(scalarIntExpr))) || + "full" >> construct<OmpClause>(construct<OmpClause::Full>()) || + "from" >> construct<OmpClause>(construct<OmpClause::From>(parenthesized(Parser<OmpObjectList>{}))) || + "flush" >> construct<OmpClause>(construct<OmpClause::Flush>()) || + "firstprivate" >> construct<OmpClause>(construct<OmpClause::Firstprivate>(parenthesized(Parser<OmpObjectList>{}))) || + "final" >> construct<OmpClause>(construct<OmpClause::Final>(parenthesized(scalarLogicalExpr))) || + "filter" >> construct<OmpClause>(construct<OmpClause::Filter>(parenthesized(scalarIntExpr))) || + "exclusive" >> construct<OmpClause>(construct<OmpClause::Exclusive>()) || + "dynamic_allocators" >> construct<OmpClause>(construct<OmpClause::DynamicAllocators>()) || + "dist_schedule" >> construct<OmpClause>(construct<OmpClause::DistSchedule>(maybe(parenthesized(scalarIntExpr)))) || + "device_type" >> construct<OmpClause>(construct<OmpClause::DeviceType>()) || + "device" >> construct<OmpClause>(construct<OmpClause::Device>(parenthesized(Parser<OmpDeviceClause>{}))) || + "detach" >> construct<OmpClause>(construct<OmpClause::Detach>()) || + "destroy" >> construct<OmpClause>(construct<OmpClause::Destroy>()) || + "depobj" >> construct<OmpClause>(construct<OmpClause::Depobj>()) || + "depend" >> construct<OmpClause>(construct<OmpClause::Depend>(parenthesized(Parser<OmpDependClause>{}))) || + "defaultmap" >> construct<OmpClause>(construct<OmpClause::Defaultmap>(parenthesized(Parser<OmpDefaultmapClause>{}))) || + "default" >> construct<OmpClause>(construct<OmpClause::Default>(parenthesized(Parser<OmpDefaultClause>{}))) || + "copyprivate" >> construct<OmpClause>(construct<OmpClause::Copyprivate>(parenthesized(Parser<OmpObjectList>{}))) || + "copyin" >> construct<OmpClause>(construct<OmpClause::Copyin>(parenthesized(Parser<OmpObjectList>{}))) || + "compare" >> construct<OmpClause>(construct<OmpClause::Compare>()) || + "collapse" >> construct<OmpClause>(construct<OmpClause::Collapse>(parenthesized(scalarIntConstantExpr))) || + "capture" >> construct<OmpClause>(construct<OmpClause::Capture>()) || + "cancellation_construct_type" >> construct<OmpClause>(construct<OmpClause::CancellationConstructType>()) || + "bind" >> construct<OmpClause>(construct<OmpClause::Bind>()) || + "atomic_default_mem_order" >> construct<OmpClause>(construct<OmpClause::AtomicDefaultMemOrder>(parenthesized(Parser<OmpAtomicDefaultMemOrderClause>{}))) || + "at" >> construct<OmpClause>(construct<OmpClause::At>()) || + "append_args" >> construct<OmpClause>(construct<OmpClause::AppendArgs>()) || + "allocator" >> construct<OmpClause>(construct<OmpClause::Allocator>(parenthesized(scalarIntExpr))) || + "allocate" >> construct<OmpClause>(construct<OmpClause::Allocate>(parenthesized(Parser<OmpAllocateClause>{}))) || + "aligned" >> construct<OmpClause>(construct<OmpClause::Aligned>(parenthesized(Parser<OmpAlignedClause>{}))) || + "align" >> construct<OmpClause>(construct<OmpClause::Align>()) || + "affinity" >> construct<OmpClause>(construct<OmpClause::Affinity>()) || + "adjust_args" >> construct<OmpClause>(construct<OmpClause::AdjustArgs>()) || + "acquire" >> construct<OmpClause>(construct<OmpClause::Acquire>()) || + "acq_rel" >> construct<OmpClause>(construct<OmpClause::AcqRel>()) +) + +#endif // GEN_FLANG_CLAUSES_PARSER + +#ifdef GEN_CLANG_CLAUSE_CLASS +#undef GEN_CLANG_CLAUSE_CLASS + +#ifndef CLAUSE +#define CLAUSE(Enum, Str, Implicit) +#endif +#ifndef CLAUSE_CLASS +#define CLAUSE_CLASS(Enum, Str, Class) +#endif +#ifndef CLAUSE_NO_CLASS +#define CLAUSE_NO_CLASS(Enum, Str) +#endif + +#define __CLAUSE(Name, Class) \ + CLAUSE(OMPC_##Name, #Name, /* Implicit */ false) \ + CLAUSE_CLASS(OMPC_##Name, #Name, Class) +#define __CLAUSE_NO_CLASS(Name) \ + CLAUSE(OMPC_##Name, #Name, /* Implicit */ false) \ + CLAUSE_NO_CLASS(OMPC_##Name, #Name) +#define __IMPLICIT_CLAUSE_CLASS(Name, Str, Class) \ + CLAUSE(OMPC_##Name, Str, /* Implicit */ true) \ + CLAUSE_CLASS(OMPC_##Name, Str, Class) +#define __IMPLICIT_CLAUSE_NO_CLASS(Name, Str) \ + CLAUSE(OMPC_##Name, Str, /* Implicit */ true) \ + CLAUSE_NO_CLASS(OMPC_##Name, Str) + +__CLAUSE(acq_rel, OMPAcqRelClause) +__CLAUSE(acquire, OMPAcquireClause) +__CLAUSE_NO_CLASS(adjust_args) +__CLAUSE(affinity, OMPAffinityClause) +__CLAUSE(align, OMPAlignClause) +__CLAUSE(aligned, OMPAlignedClause) +__CLAUSE(allocate, OMPAllocateClause) +__CLAUSE(allocator, OMPAllocatorClause) +__CLAUSE_NO_CLASS(append_args) +__CLAUSE(at, OMPAtClause) +__CLAUSE(atomic_default_mem_order, OMPAtomicDefaultMemOrderClause) +__CLAUSE(bind, OMPBindClause) +__CLAUSE_NO_CLASS(cancellation_construct_type) +__CLAUSE(capture, OMPCaptureClause) +__CLAUSE(collapse, OMPCollapseClause) +__CLAUSE(compare, OMPCompareClause) +__CLAUSE(copyprivate, OMPCopyprivateClause) +__CLAUSE(copyin, OMPCopyinClause) +__CLAUSE(default, OMPDefaultClause) +__CLAUSE(defaultmap, OMPDefaultmapClause) +__CLAUSE(depend, OMPDependClause) +__IMPLICIT_CLAUSE_CLASS(depobj, "depobj", OMPDepobjClause) +__CLAUSE(destroy, OMPDestroyClause) +__CLAUSE(detach, OMPDetachClause) +__CLAUSE(device, OMPDeviceClause) +__CLAUSE_NO_CLASS(device_type) +__CLAUSE(dist_schedule, OMPDistScheduleClause) +__CLAUSE(dynamic_allocators, OMPDynamicAllocatorsClause) +__CLAUSE(exclusive, OMPExclusiveClause) +__CLAUSE(filter, OMPFilterClause) +__CLAUSE(final, OMPFinalClause) +__CLAUSE(firstprivate, OMPFirstprivateClause) +__IMPLICIT_CLAUSE_CLASS(flush, "flush", OMPFlushClause) +__CLAUSE(from, OMPFromClause) +__CLAUSE(full, OMPFullClause) +__CLAUSE(grainsize, OMPGrainsizeClause) +__CLAUSE(has_device_addr, OMPHasDeviceAddrClause) +__CLAUSE(hint, OMPHintClause) +__CLAUSE(if, OMPIfClause) +__CLAUSE(in_reduction, OMPInReductionClause) +__CLAUSE_NO_CLASS(inbranch) +__CLAUSE(inclusive, OMPInclusiveClause) +__CLAUSE_NO_CLASS(indirect) +__CLAUSE(init, OMPInitClause) +__CLAUSE(is_device_ptr, OMPIsDevicePtrClause) +__CLAUSE(lastprivate, OMPLastprivateClause) +__CLAUSE(linear, OMPLinearClause) +__CLAUSE_NO_CLASS(link) +__CLAUSE(map, OMPMapClause) +__CLAUSE_NO_CLASS(match) +__CLAUSE_NO_CLASS(memory_order) +__CLAUSE(mergeable, OMPMergeableClause) +__CLAUSE(message, OMPMessageClause) +__CLAUSE(nogroup, OMPNogroupClause) +__CLAUSE(nowait, OMPNowaitClause) +__CLAUSE(nocontext, OMPNocontextClause) +__CLAUSE(nontemporal, OMPNontemporalClause) +__CLAUSE_NO_CLASS(notinbranch) +__CLAUSE(novariants, OMPNovariantsClause) +__CLAUSE(num_tasks, OMPNumTasksClause) +__CLAUSE(num_teams, OMPNumTeamsClause) +__CLAUSE(num_threads, OMPNumThreadsClause) +__CLAUSE(ompx_dyn_cgroup_mem, OMPXDynCGroupMemClause) +__CLAUSE(order, OMPOrderClause) +__CLAUSE(ordered, OMPOrderedClause) +__CLAUSE(partial, OMPPartialClause) +__CLAUSE(priority, OMPPriorityClause) +__CLAUSE(private, OMPPrivateClause) +__CLAUSE(proc_bind, OMPProcBindClause) +__CLAUSE(read, OMPReadClause) +__CLAUSE(reduction, OMPReductionClause) +__CLAUSE(relaxed, OMPRelaxedClause) +__CLAUSE(release, OMPReleaseClause) +__CLAUSE(reverse_offload, OMPReverseOffloadClause) +__CLAUSE(safelen, OMPSafelenClause) +__CLAUSE(schedule, OMPScheduleClause) +__CLAUSE(seq_cst, OMPSeqCstClause) +__CLAUSE(severity, OMPSeverityClause) +__CLAUSE(shared, OMPSharedClause) +__CLAUSE(simd, OMPSIMDClause) +__CLAUSE(simdlen, OMPSimdlenClause) +__CLAUSE(sizes, OMPSizesClause) +__CLAUSE(task_reduction, OMPTaskReductionClause) +__CLAUSE(thread_limit, OMPThreadLimitClause) +__IMPLICIT_CLAUSE_NO_CLASS(threadprivate, "threadprivate") +__CLAUSE(threads, OMPThreadsClause) +__CLAUSE(to, OMPToClause) +__CLAUSE(unified_address, OMPUnifiedAddressClause) +__CLAUSE(unified_shared_memory, OMPUnifiedSharedMemoryClause) +__CLAUSE_NO_CLASS(uniform) +__IMPLICIT_CLAUSE_NO_CLASS(unknown, "unknown") +__CLAUSE(untied, OMPUntiedClause) +__CLAUSE(update, OMPUpdateClause) +__CLAUSE(use, OMPUseClause) +__CLAUSE(use_device_addr, OMPUseDeviceAddrClause) +__CLAUSE(use_device_ptr, OMPUseDevicePtrClause) +__CLAUSE(uses_allocators, OMPUsesAllocatorsClause) +__CLAUSE_NO_CLASS(when) +__CLAUSE(write, OMPWriteClause) + +#undef __IMPLICIT_CLAUSE_NO_CLASS +#undef __IMPLICIT_CLAUSE_CLASS +#undef __CLAUSE +#undef CLAUSE_NO_CLASS +#undef CLAUSE_CLASS +#undef CLAUSE + +#endif // GEN_CLANG_CLAUSE_CLASS + +#ifdef GEN_DIRECTIVES_IMPL +#undef GEN_DIRECTIVES_IMPL + +Directive llvm::omp::getOpenMPDirectiveKind(llvm::StringRef Str) { + return llvm::StringSwitch<Directive>(Str) + .Case("allocate",OMPD_allocate) + .Case("assumes",OMPD_assumes) + .Case("atomic",OMPD_atomic) + .Case("barrier",OMPD_barrier) + .Case("begin assumes",OMPD_begin_assumes) + .Case("begin declare target",OMPD_begin_declare_target) + .Case("begin declare variant",OMPD_begin_declare_variant) + .Case("cancel",OMPD_cancel) + .Case("cancellation point",OMPD_cancellation_point) + .Case("critical",OMPD_critical) + .Case("declare mapper",OMPD_declare_mapper) + .Case("declare reduction",OMPD_declare_reduction) + .Case("declare simd",OMPD_declare_simd) + .Case("declare target",OMPD_declare_target) + .Case("declare variant",OMPD_declare_variant) + .Case("depobj",OMPD_depobj) + .Case("distribute",OMPD_distribute) + .Case("distribute parallel do",OMPD_distribute_parallel_do) + .Case("distribute parallel do simd",OMPD_distribute_parallel_do_simd) + .Case("distribute parallel for",OMPD_distribute_parallel_for) + .Case("distribute parallel for simd",OMPD_distribute_parallel_for_simd) + .Case("distribute simd",OMPD_distribute_simd) + .Case("do",OMPD_do) + .Case("do simd",OMPD_do_simd) + .Case("end assumes",OMPD_end_assumes) + .Case("end declare target",OMPD_end_declare_target) + .Case("end declare variant",OMPD_end_declare_variant) + .Case("end do",OMPD_end_do) + .Case("end do simd",OMPD_end_do_simd) + .Case("end sections",OMPD_end_sections) + .Case("end single",OMPD_end_single) + .Case("end workshare",OMPD_end_workshare) + .Case("error",OMPD_error) + .Case("flush",OMPD_flush) + .Case("for",OMPD_for) + .Case("for simd",OMPD_for_simd) + .Case("masked taskloop",OMPD_masked_taskloop) + .Case("masked taskloop simd",OMPD_masked_taskloop_simd) + .Case("master",OMPD_master) + .Case("master taskloop",OMPD_master_taskloop) + .Case("master taskloop simd",OMPD_master_taskloop_simd) + .Case("metadirective",OMPD_metadirective) + .Case("nothing",OMPD_nothing) + .Case("ordered",OMPD_ordered) + .Case("parallel",OMPD_parallel) + .Case("parallel do",OMPD_parallel_do) + .Case("parallel do simd",OMPD_parallel_do_simd) + .Case("parallel for",OMPD_parallel_for) + .Case("parallel for simd",OMPD_parallel_for_simd) + .Case("parallel masked",OMPD_parallel_masked) + .Case("parallel masked taskloop",OMPD_parallel_masked_taskloop) + .Case("parallel masked taskloop simd",OMPD_parallel_masked_taskloop_simd) + .Case("parallel master",OMPD_parallel_master) + .Case("parallel master taskloop",OMPD_parallel_master_taskloop) + .Case("parallel master taskloop simd",OMPD_parallel_master_taskloop_simd) + .Case("parallel sections",OMPD_parallel_sections) + .Case("parallel workshare",OMPD_parallel_workshare) + .Case("requires",OMPD_requires) + .Case("scan",OMPD_scan) + .Case("section",OMPD_section) + .Case("sections",OMPD_sections) + .Case("simd",OMPD_simd) + .Case("single",OMPD_single) + .Case("target",OMPD_target) + .Case("target data",OMPD_target_data) + .Case("target enter data",OMPD_target_enter_data) + .Case("target exit data",OMPD_target_exit_data) + .Case("target parallel",OMPD_target_parallel) + .Case("target parallel do",OMPD_target_parallel_do) + .Case("target parallel do simd",OMPD_target_parallel_do_simd) + .Case("target parallel for",OMPD_target_parallel_for) + .Case("target parallel for simd",OMPD_target_parallel_for_simd) + .Case("target simd",OMPD_target_simd) + .Case("target teams",OMPD_target_teams) + .Case("target teams distribute",OMPD_target_teams_distribute) + .Case("target teams distribute parallel do",OMPD_target_teams_distribute_parallel_do) + .Case("target teams distribute parallel do simd",OMPD_target_teams_distribute_parallel_do_simd) + .Case("target teams distribute parallel for",OMPD_target_teams_distribute_parallel_for) + .Case("target teams distribute parallel for simd",OMPD_target_teams_distribute_parallel_for_simd) + .Case("target teams distribute simd",OMPD_target_teams_distribute_simd) + .Case("target update",OMPD_target_update) + .Case("task",OMPD_task) + .Case("taskgroup",OMPD_taskgroup) + .Case("taskloop",OMPD_taskloop) + .Case("taskloop simd",OMPD_taskloop_simd) + .Case("taskwait",OMPD_taskwait) + .Case("taskyield",OMPD_taskyield) + .Case("teams",OMPD_teams) + .Case("teams distribute",OMPD_teams_distribute) + .Case("teams distribute parallel do",OMPD_teams_distribute_parallel_do) + .Case("teams distribute parallel do simd",OMPD_teams_distribute_parallel_do_simd) + .Case("teams distribute parallel for",OMPD_teams_distribute_parallel_for) + .Case("teams distribute parallel for simd",OMPD_teams_distribute_parallel_for_simd) + .Case("teams distribute simd",OMPD_teams_distribute_simd) + .Case("threadprivate",OMPD_threadprivate) + .Case("tile",OMPD_tile) + .Case("unknown",OMPD_unknown) + .Case("unroll",OMPD_unroll) + .Case("workshare",OMPD_workshare) + .Case("dispatch",OMPD_dispatch) + .Case("interop",OMPD_interop) + .Case("loop",OMPD_loop) + .Case("masked",OMPD_masked) + .Case("parallel loop",OMPD_parallel_loop) + .Case("target parallel loop",OMPD_target_parallel_loop) + .Case("target teams loop",OMPD_target_teams_loop) + .Case("teams loop",OMPD_teams_loop) + .Default(OMPD_unknown); +} + +llvm::StringRef llvm::omp::getOpenMPDirectiveName(Directive Kind) { + switch (Kind) { + case OMPD_allocate: + return "allocate"; + case OMPD_assumes: + return "assumes"; + case OMPD_atomic: + return "atomic"; + case OMPD_barrier: + return "barrier"; + case OMPD_begin_assumes: + return "begin assumes"; + case OMPD_begin_declare_target: + return "begin declare target"; + case OMPD_begin_declare_variant: + return "begin declare variant"; + case OMPD_cancel: + return "cancel"; + case OMPD_cancellation_point: + return "cancellation point"; + case OMPD_critical: + return "critical"; + case OMPD_declare_mapper: + return "declare mapper"; + case OMPD_declare_reduction: + return "declare reduction"; + case OMPD_declare_simd: + return "declare simd"; + case OMPD_declare_target: + return "declare target"; + case OMPD_declare_variant: + return "declare variant"; + case OMPD_depobj: + return "depobj"; + case OMPD_distribute: + return "distribute"; + case OMPD_distribute_parallel_do: + return "distribute parallel do"; + case OMPD_distribute_parallel_do_simd: + return "distribute parallel do simd"; + case OMPD_distribute_parallel_for: + return "distribute parallel for"; + case OMPD_distribute_parallel_for_simd: + return "distribute parallel for simd"; + case OMPD_distribute_simd: + return "distribute simd"; + case OMPD_do: + return "do"; + case OMPD_do_simd: + return "do simd"; + case OMPD_end_assumes: + return "end assumes"; + case OMPD_end_declare_target: + return "end declare target"; + case OMPD_end_declare_variant: + return "end declare variant"; + case OMPD_end_do: + return "end do"; + case OMPD_end_do_simd: + return "end do simd"; + case OMPD_end_sections: + return "end sections"; + case OMPD_end_single: + return "end single"; + case OMPD_end_workshare: + return "end workshare"; + case OMPD_error: + return "error"; + case OMPD_flush: + return "flush"; + case OMPD_for: + return "for"; + case OMPD_for_simd: + return "for simd"; + case OMPD_masked_taskloop: + return "masked taskloop"; + case OMPD_masked_taskloop_simd: + return "masked taskloop simd"; + case OMPD_master: + return "master"; + case OMPD_master_taskloop: + return "master taskloop"; + case OMPD_master_taskloop_simd: + return "master taskloop simd"; + case OMPD_metadirective: + return "metadirective"; + case OMPD_nothing: + return "nothing"; + case OMPD_ordered: + return "ordered"; + case OMPD_parallel: + return "parallel"; + case OMPD_parallel_do: + return "parallel do"; + case OMPD_parallel_do_simd: + return "parallel do simd"; + case OMPD_parallel_for: + return "parallel for"; + case OMPD_parallel_for_simd: + return "parallel for simd"; + case OMPD_parallel_masked: + return "parallel masked"; + case OMPD_parallel_masked_taskloop: + return "parallel masked taskloop"; + case OMPD_parallel_masked_taskloop_simd: + return "parallel masked taskloop simd"; + case OMPD_parallel_master: + return "parallel master"; + case OMPD_parallel_master_taskloop: + return "parallel master taskloop"; + case OMPD_parallel_master_taskloop_simd: + return "parallel master taskloop simd"; + case OMPD_parallel_sections: + return "parallel sections"; + case OMPD_parallel_workshare: + return "parallel workshare"; + case OMPD_requires: + return "requires"; + case OMPD_scan: + return "scan"; + case OMPD_section: + return "section"; + case OMPD_sections: + return "sections"; + case OMPD_simd: + return "simd"; + case OMPD_single: + return "single"; + case OMPD_target: + return "target"; + case OMPD_target_data: + return "target data"; + case OMPD_target_enter_data: + return "target enter data"; + case OMPD_target_exit_data: + return "target exit data"; + case OMPD_target_parallel: + return "target parallel"; + case OMPD_target_parallel_do: + return "target parallel do"; + case OMPD_target_parallel_do_simd: + return "target parallel do simd"; + case OMPD_target_parallel_for: + return "target parallel for"; + case OMPD_target_parallel_for_simd: + return "target parallel for simd"; + case OMPD_target_simd: + return "target simd"; + case OMPD_target_teams: + return "target teams"; + case OMPD_target_teams_distribute: + return "target teams distribute"; + case OMPD_target_teams_distribute_parallel_do: + return "target teams distribute parallel do"; + case OMPD_target_teams_distribute_parallel_do_simd: + return "target teams distribute parallel do simd"; + case OMPD_target_teams_distribute_parallel_for: + return "target teams distribute parallel for"; + case OMPD_target_teams_distribute_parallel_for_simd: + return "target teams distribute parallel for simd"; + case OMPD_target_teams_distribute_simd: + return "target teams distribute simd"; + case OMPD_target_update: + return "target update"; + case OMPD_task: + return "task"; + case OMPD_taskgroup: + return "taskgroup"; + case OMPD_taskloop: + return "taskloop"; + case OMPD_taskloop_simd: + return "taskloop simd"; + case OMPD_taskwait: + return "taskwait"; + case OMPD_taskyield: + return "taskyield"; + case OMPD_teams: + return "teams"; + case OMPD_teams_distribute: + return "teams distribute"; + case OMPD_teams_distribute_parallel_do: + return "teams distribute parallel do"; + case OMPD_teams_distribute_parallel_do_simd: + return "teams distribute parallel do simd"; + case OMPD_teams_distribute_parallel_for: + return "teams distribute parallel for"; + case OMPD_teams_distribute_parallel_for_simd: + return "teams distribute parallel for simd"; + case OMPD_teams_distribute_simd: + return "teams distribute simd"; + case OMPD_threadprivate: + return "threadprivate"; + case OMPD_tile: + return "tile"; + case OMPD_unknown: + return "unknown"; + case OMPD_unroll: + return "unroll"; + case OMPD_workshare: + return "workshare"; + case OMPD_dispatch: + return "dispatch"; + case OMPD_interop: + return "interop"; + case OMPD_loop: + return "loop"; + case OMPD_masked: + return "masked"; + case OMPD_parallel_loop: + return "parallel loop"; + case OMPD_target_parallel_loop: + return "target parallel loop"; + case OMPD_target_teams_loop: + return "target teams loop"; + case OMPD_teams_loop: + return "teams loop"; + } + llvm_unreachable("Invalid OpenMP Directive kind"); +} + +Clause llvm::omp::getOpenMPClauseKind(llvm::StringRef Str) { + return llvm::StringSwitch<Clause>(Str) + .Case("acq_rel",OMPC_acq_rel) + .Case("acquire",OMPC_acquire) + .Case("adjust_args",OMPC_adjust_args) + .Case("affinity",OMPC_affinity) + .Case("align",OMPC_align) + .Case("aligned",OMPC_aligned) + .Case("allocate",OMPC_allocate) + .Case("allocator",OMPC_allocator) + .Case("append_args",OMPC_append_args) + .Case("at",OMPC_at) + .Case("atomic_default_mem_order",OMPC_atomic_default_mem_order) + .Case("bind",OMPC_bind) + .Case("cancellation_construct_type",OMPC_cancellation_construct_type) + .Case("capture",OMPC_capture) + .Case("collapse",OMPC_collapse) + .Case("compare",OMPC_compare) + .Case("copyprivate",OMPC_copyprivate) + .Case("copyin",OMPC_copyin) + .Case("default",OMPC_default) + .Case("defaultmap",OMPC_defaultmap) + .Case("depend",OMPC_depend) + .Case("depobj",OMPC_unknown) + .Case("destroy",OMPC_destroy) + .Case("detach",OMPC_detach) + .Case("device",OMPC_device) + .Case("device_type",OMPC_device_type) + .Case("dist_schedule",OMPC_dist_schedule) + .Case("dynamic_allocators",OMPC_dynamic_allocators) + .Case("exclusive",OMPC_exclusive) + .Case("filter",OMPC_filter) + .Case("final",OMPC_final) + .Case("firstprivate",OMPC_firstprivate) + .Case("flush",OMPC_unknown) + .Case("from",OMPC_from) + .Case("full",OMPC_full) + .Case("grainsize",OMPC_grainsize) + .Case("has_device_addr",OMPC_has_device_addr) + .Case("hint",OMPC_hint) + .Case("if",OMPC_if) + .Case("in_reduction",OMPC_in_reduction) + .Case("inbranch",OMPC_inbranch) + .Case("inclusive",OMPC_inclusive) + .Case("indirect",OMPC_indirect) + .Case("init",OMPC_init) + .Case("is_device_ptr",OMPC_is_device_ptr) + .Case("lastprivate",OMPC_lastprivate) + .Case("linear",OMPC_linear) + .Case("link",OMPC_link) + .Case("map",OMPC_map) + .Case("match",OMPC_match) + .Case("memory_order",OMPC_memory_order) + .Case("mergeable",OMPC_mergeable) + .Case("message",OMPC_message) + .Case("nogroup",OMPC_nogroup) + .Case("nowait",OMPC_nowait) + .Case("nocontext",OMPC_nocontext) + .Case("nontemporal",OMPC_nontemporal) + .Case("notinbranch",OMPC_notinbranch) + .Case("novariants",OMPC_novariants) + .Case("num_tasks",OMPC_num_tasks) + .Case("num_teams",OMPC_num_teams) + .Case("num_threads",OMPC_num_threads) + .Case("ompx_dyn_cgroup_mem",OMPC_ompx_dyn_cgroup_mem) + .Case("order",OMPC_order) + .Case("ordered",OMPC_ordered) + .Case("partial",OMPC_partial) + .Case("priority",OMPC_priority) + .Case("private",OMPC_private) + .Case("proc_bind",OMPC_proc_bind) + .Case("read",OMPC_read) + .Case("reduction",OMPC_reduction) + .Case("relaxed",OMPC_relaxed) + .Case("release",OMPC_release) + .Case("reverse_offload",OMPC_reverse_offload) + .Case("safelen",OMPC_safelen) + .Case("schedule",OMPC_schedule) + .Case("seq_cst",OMPC_seq_cst) + .Case("severity",OMPC_severity) + .Case("shared",OMPC_shared) + .Case("simd",OMPC_simd) + .Case("simdlen",OMPC_simdlen) + .Case("sizes",OMPC_sizes) + .Case("task_reduction",OMPC_task_reduction) + .Case("thread_limit",OMPC_thread_limit) + .Case("threadprivate",OMPC_unknown) + .Case("threads",OMPC_threads) + .Case("to",OMPC_to) + .Case("unified_address",OMPC_unified_address) + .Case("unified_shared_memory",OMPC_unified_shared_memory) + .Case("uniform",OMPC_uniform) + .Case("unknown",OMPC_unknown) + .Case("untied",OMPC_untied) + .Case("update",OMPC_update) + .Case("use",OMPC_use) + .Case("use_device_addr",OMPC_use_device_addr) + .Case("use_device_ptr",OMPC_use_device_ptr) + .Case("uses_allocators",OMPC_uses_allocators) + .Case("when",OMPC_when) + .Case("write",OMPC_write) + .Default(OMPC_unknown); +} + +llvm::StringRef llvm::omp::getOpenMPClauseName(Clause Kind) { + switch (Kind) { + case OMPC_acq_rel: + return "acq_rel"; + case OMPC_acquire: + return "acquire"; + case OMPC_adjust_args: + return "adjust_args"; + case OMPC_affinity: + return "affinity"; + case OMPC_align: + return "align"; + case OMPC_aligned: + return "aligned"; + case OMPC_allocate: + return "allocate"; + case OMPC_allocator: + return "allocator"; + case OMPC_append_args: + return "append_args"; + case OMPC_at: + return "at"; + case OMPC_atomic_default_mem_order: + return "atomic_default_mem_order"; + case OMPC_bind: + return "bind"; + case OMPC_cancellation_construct_type: + return "cancellation_construct_type"; + case OMPC_capture: + return "capture"; + case OMPC_collapse: + return "collapse"; + case OMPC_compare: + return "compare"; + case OMPC_copyprivate: + return "copyprivate"; + case OMPC_copyin: + return "copyin"; + case OMPC_default: + return "default"; + case OMPC_defaultmap: + return "defaultmap"; + case OMPC_depend: + return "depend"; + case OMPC_depobj: + return "depobj"; + case OMPC_destroy: + return "destroy"; + case OMPC_detach: + return "detach"; + case OMPC_device: + return "device"; + case OMPC_device_type: + return "device_type"; + case OMPC_dist_schedule: + return "dist_schedule"; + case OMPC_dynamic_allocators: + return "dynamic_allocators"; + case OMPC_exclusive: + return "exclusive"; + case OMPC_filter: + return "filter"; + case OMPC_final: + return "final"; + case OMPC_firstprivate: + return "firstprivate"; + case OMPC_flush: + return "flush"; + case OMPC_from: + return "from"; + case OMPC_full: + return "full"; + case OMPC_grainsize: + return "grainsize"; + case OMPC_has_device_addr: + return "has_device_addr"; + case OMPC_hint: + return "hint"; + case OMPC_if: + return "if"; + case OMPC_in_reduction: + return "in_reduction"; + case OMPC_inbranch: + return "inbranch"; + case OMPC_inclusive: + return "inclusive"; + case OMPC_indirect: + return "indirect"; + case OMPC_init: + return "init"; + case OMPC_is_device_ptr: + return "is_device_ptr"; + case OMPC_lastprivate: + return "lastprivate"; + case OMPC_linear: + return "linear"; + case OMPC_link: + return "link"; + case OMPC_map: + return "map"; + case OMPC_match: + return "match"; + case OMPC_memory_order: + return "memory_order"; + case OMPC_mergeable: + return "mergeable"; + case OMPC_message: + return "message"; + case OMPC_nogroup: + return "nogroup"; + case OMPC_nowait: + return "nowait"; + case OMPC_nocontext: + return "nocontext"; + case OMPC_nontemporal: + return "nontemporal"; + case OMPC_notinbranch: + return "notinbranch"; + case OMPC_novariants: + return "novariants"; + case OMPC_num_tasks: + return "num_tasks"; + case OMPC_num_teams: + return "num_teams"; + case OMPC_num_threads: + return "num_threads"; + case OMPC_ompx_dyn_cgroup_mem: + return "ompx_dyn_cgroup_mem"; + case OMPC_order: + return "order"; + case OMPC_ordered: + return "ordered"; + case OMPC_partial: + return "partial"; + case OMPC_priority: + return "priority"; + case OMPC_private: + return "private"; + case OMPC_proc_bind: + return "proc_bind"; + case OMPC_read: + return "read"; + case OMPC_reduction: + return "reduction"; + case OMPC_relaxed: + return "relaxed"; + case OMPC_release: + return "release"; + case OMPC_reverse_offload: + return "reverse_offload"; + case OMPC_safelen: + return "safelen"; + case OMPC_schedule: + return "schedule"; + case OMPC_seq_cst: + return "seq_cst"; + case OMPC_severity: + return "severity"; + case OMPC_shared: + return "shared"; + case OMPC_simd: + return "simd"; + case OMPC_simdlen: + return "simdlen"; + case OMPC_sizes: + return "sizes"; + case OMPC_task_reduction: + return "task_reduction"; + case OMPC_thread_limit: + return "thread_limit"; + case OMPC_threadprivate: + return "threadprivate or thread local"; + case OMPC_threads: + return "threads"; + case OMPC_to: + return "to"; + case OMPC_unified_address: + return "unified_address"; + case OMPC_unified_shared_memory: + return "unified_shared_memory"; + case OMPC_uniform: + return "uniform"; + case OMPC_unknown: + return "unknown"; + case OMPC_untied: + return "untied"; + case OMPC_update: + return "update"; + case OMPC_use: + return "use"; + case OMPC_use_device_addr: + return "use_device_addr"; + case OMPC_use_device_ptr: + return "use_device_ptr"; + case OMPC_uses_allocators: + return "uses_allocators"; + case OMPC_when: + return "when"; + case OMPC_write: + return "write"; + } + llvm_unreachable("Invalid OpenMP Clause kind"); +} + +CancellationConstructType llvm::omp::getCancellationConstructType(llvm::StringRef Str) { + return llvm::StringSwitch<CancellationConstructType>(Str) + .Case("parallel",OMP_CANCELLATION_CONSTRUCT_Parallel) + .Case("loop",OMP_CANCELLATION_CONSTRUCT_Loop) + .Case("sections",OMP_CANCELLATION_CONSTRUCT_Sections) + .Case("taskgroup",OMP_CANCELLATION_CONSTRUCT_Taskgroup) + .Case("none",OMP_CANCELLATION_CONSTRUCT_None) + .Default(OMP_CANCELLATION_CONSTRUCT_None); +} + +llvm::StringRef llvm::omp::getOpenMPCancellationConstructTypeName(llvm::omp::CancellationConstructType x) { + switch (x) { + case OMP_CANCELLATION_CONSTRUCT_Parallel: + return "parallel"; + case OMP_CANCELLATION_CONSTRUCT_Loop: + return "loop"; + case OMP_CANCELLATION_CONSTRUCT_Sections: + return "sections"; + case OMP_CANCELLATION_CONSTRUCT_Taskgroup: + return "taskgroup"; + case OMP_CANCELLATION_CONSTRUCT_None: + return "none"; + } + llvm_unreachable("Invalid OpenMP CancellationConstructType kind"); +} + +GrainsizeType llvm::omp::getGrainsizeType(llvm::StringRef Str) { + return llvm::StringSwitch<GrainsizeType>(Str) + .Case("strict",OMP_GRAINSIZE_Strict) + .Case("unkonwn",OMP_GRAINSIZE_Unknown) + .Default(OMP_GRAINSIZE_Unknown); +} + +llvm::StringRef llvm::omp::getOpenMPGrainsizeTypeName(llvm::omp::GrainsizeType x) { + switch (x) { + case OMP_GRAINSIZE_Strict: + return "strict"; + case OMP_GRAINSIZE_Unknown: + return "unkonwn"; + } + llvm_unreachable("Invalid OpenMP GrainsizeType kind"); +} + +MemoryOrderKind llvm::omp::getMemoryOrderKind(llvm::StringRef Str) { + return llvm::StringSwitch<MemoryOrderKind>(Str) + .Case("seq_cst",OMP_MEMORY_ORDER_SeqCst) + .Case("acq_rel",OMP_MEMORY_ORDER_AcqRel) + .Case("acquire",OMP_MEMORY_ORDER_Acquire) + .Case("release",OMP_MEMORY_ORDER_Release) + .Case("relaxed",OMP_MEMORY_ORDER_Relaxed) + .Case("default",OMP_MEMORY_ORDER_Default) + .Default(OMP_MEMORY_ORDER_Default); +} + +llvm::StringRef llvm::omp::getOpenMPMemoryOrderKindName(llvm::omp::MemoryOrderKind x) { + switch (x) { + case OMP_MEMORY_ORDER_SeqCst: + return "seq_cst"; + case OMP_MEMORY_ORDER_AcqRel: + return "acq_rel"; + case OMP_MEMORY_ORDER_Acquire: + return "acquire"; + case OMP_MEMORY_ORDER_Release: + return "release"; + case OMP_MEMORY_ORDER_Relaxed: + return "relaxed"; + case OMP_MEMORY_ORDER_Default: + return "default"; + } + llvm_unreachable("Invalid OpenMP MemoryOrderKind kind"); +} + +NumTasksType llvm::omp::getNumTasksType(llvm::StringRef Str) { + return llvm::StringSwitch<NumTasksType>(Str) + .Case("strict",OMP_NUMTASKS_Strict) + .Case("unkonwn",OMP_NUMTASKS_Unknown) + .Default(OMP_NUMTASKS_Unknown); +} + +llvm::StringRef llvm::omp::getOpenMPNumTasksTypeName(llvm::omp::NumTasksType x) { + switch (x) { + case OMP_NUMTASKS_Strict: + return "strict"; + case OMP_NUMTASKS_Unknown: + return "unkonwn"; + } + llvm_unreachable("Invalid OpenMP NumTasksType kind"); +} + +OrderKind llvm::omp::getOrderKind(llvm::StringRef Str) { + return llvm::StringSwitch<OrderKind>(Str) + .Case("unknown",OMP_ORDER_unknown) + .Case("concurrent",OMP_ORDER_concurrent) + .Default(OMP_ORDER_unknown); +} + +llvm::StringRef llvm::omp::getOpenMPOrderKindName(llvm::omp::OrderKind x) { + switch (x) { + case OMP_ORDER_unknown: + return "unknown"; + case OMP_ORDER_concurrent: + return "concurrent"; + } + llvm_unreachable("Invalid OpenMP OrderKind kind"); +} + +ProcBindKind llvm::omp::getProcBindKind(llvm::StringRef Str) { + return llvm::StringSwitch<ProcBindKind>(Str) + .Case("primary",OMP_PROC_BIND_primary) + .Case("master",OMP_PROC_BIND_master) + .Case("close",OMP_PROC_BIND_close) + .Case("spread",OMP_PROC_BIND_spread) + .Case("default",OMP_PROC_BIND_default) + .Case("unknown",OMP_PROC_BIND_unknown) + .Default(OMP_PROC_BIND_unknown); +} + +llvm::StringRef llvm::omp::getOpenMPProcBindKindName(llvm::omp::ProcBindKind x) { + switch (x) { + case OMP_PROC_BIND_primary: + return "primary"; + case OMP_PROC_BIND_master: + return "master"; + case OMP_PROC_BIND_close: + return "close"; + case OMP_PROC_BIND_spread: + return "spread"; + case OMP_PROC_BIND_default: + return "default"; + case OMP_PROC_BIND_unknown: + return "unknown"; + } + llvm_unreachable("Invalid OpenMP ProcBindKind kind"); +} + +ScheduleKind llvm::omp::getScheduleKind(llvm::StringRef Str) { + return llvm::StringSwitch<ScheduleKind>(Str) + .Case("static",OMP_SCHEDULE_Static) + .Case("dynamic",OMP_SCHEDULE_Dynamic) + .Case("guided",OMP_SCHEDULE_Guided) + .Case("auto",OMP_SCHEDULE_Auto) + .Case("runtime",OMP_SCHEDULE_Runtime) + .Case("default",OMP_SCHEDULE_Default) + .Default(OMP_SCHEDULE_Default); +} + +llvm::StringRef llvm::omp::getOpenMPScheduleKindName(llvm::omp::ScheduleKind x) { + switch (x) { + case OMP_SCHEDULE_Static: + return "static"; + case OMP_SCHEDULE_Dynamic: + return "dynamic"; + case OMP_SCHEDULE_Guided: + return "guided"; + case OMP_SCHEDULE_Auto: + return "auto"; + case OMP_SCHEDULE_Runtime: + return "runtime"; + case OMP_SCHEDULE_Default: + return "default"; + } + llvm_unreachable("Invalid OpenMP ScheduleKind kind"); +} + +bool llvm::omp::isAllowedClauseForDirective(Directive D, Clause C, unsigned Version) { + assert(unsigned(D) <= llvm::omp::Directive_enumSize); + assert(unsigned(C) <= llvm::omp::Clause_enumSize); + switch (D) { + case OMPD_allocate: + switch (C) { + case OMPC_allocator: + return 1 <= Version && 2147483647 >= Version; + case OMPC_align: + return 51 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_assumes: + return false; + break; + case OMPD_atomic: + switch (C) { + case OMPC_read: + return 1 <= Version && 2147483647 >= Version; + case OMPC_write: + return 1 <= Version && 2147483647 >= Version; + case OMPC_update: + return 1 <= Version && 2147483647 >= Version; + case OMPC_capture: + return 1 <= Version && 2147483647 >= Version; + case OMPC_compare: + return 51 <= Version && 2147483647 >= Version; + case OMPC_seq_cst: + return 1 <= Version && 2147483647 >= Version; + case OMPC_acq_rel: + return 50 <= Version && 2147483647 >= Version; + case OMPC_acquire: + return 50 <= Version && 2147483647 >= Version; + case OMPC_release: + return 50 <= Version && 2147483647 >= Version; + case OMPC_relaxed: + return 50 <= Version && 2147483647 >= Version; + case OMPC_hint: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_barrier: + return false; + break; + case OMPD_begin_assumes: + return false; + break; + case OMPD_begin_declare_target: + switch (C) { + case OMPC_to: + return 1 <= Version && 2147483647 >= Version; + case OMPC_link: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device_type: + return 1 <= Version && 2147483647 >= Version; + case OMPC_indirect: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_begin_declare_variant: + return false; + break; + case OMPD_cancel: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_cancellation_point: + return false; + break; + case OMPD_critical: + switch (C) { + case OMPC_hint: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_declare_mapper: + switch (C) { + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_declare_reduction: + return false; + break; + case OMPD_declare_simd: + switch (C) { + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_uniform: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_inbranch: + return 1 <= Version && 2147483647 >= Version; + case OMPC_notinbranch: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_declare_target: + switch (C) { + case OMPC_to: + return 1 <= Version && 2147483647 >= Version; + case OMPC_link: + return 1 <= Version && 2147483647 >= Version; + case OMPC_indirect: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_declare_variant: + switch (C) { + case OMPC_match: + return 1 <= Version && 2147483647 >= Version; + case OMPC_adjust_args: + return 51 <= Version && 2147483647 >= Version; + case OMPC_append_args: + return 51 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_depobj: + switch (C) { + case OMPC_depend: + return 50 <= Version && 2147483647 >= Version; + case OMPC_destroy: + return 50 <= Version && 2147483647 >= Version; + case OMPC_update: + return 50 <= Version && 2147483647 >= Version; + case OMPC_depobj: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_distribute: + switch (C) { + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_distribute_parallel_do: + switch (C) { + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_distribute_parallel_do_simd: + switch (C) { + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_distribute_parallel_for: + switch (C) { + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_distribute_parallel_for_simd: + switch (C) { + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_distribute_simd: + switch (C) { + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 50 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_do: + switch (C) { + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_do_simd: + switch (C) { + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_end_assumes: + return false; + break; + case OMPD_end_declare_target: + return false; + break; + case OMPD_end_declare_variant: + return false; + break; + case OMPD_end_do: + return false; + break; + case OMPD_end_do_simd: + return false; + break; + case OMPD_end_sections: + switch (C) { + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_end_single: + switch (C) { + case OMPC_copyprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_end_workshare: + switch (C) { + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_error: + switch (C) { + case OMPC_at: + return 51 <= Version && 2147483647 >= Version; + case OMPC_severity: + return 51 <= Version && 2147483647 >= Version; + case OMPC_message: + return 51 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_flush: + switch (C) { + case OMPC_acq_rel: + return 50 <= Version && 2147483647 >= Version; + case OMPC_acquire: + return 50 <= Version && 2147483647 >= Version; + case OMPC_release: + return 50 <= Version && 2147483647 >= Version; + case OMPC_flush: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_for: + switch (C) { + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_for_simd: + switch (C) { + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 50 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_masked_taskloop: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_final: + return 1 <= Version && 2147483647 >= Version; + case OMPC_untied: + return 1 <= Version && 2147483647 >= Version; + case OMPC_mergeable: + return 1 <= Version && 2147483647 >= Version; + case OMPC_priority: + return 1 <= Version && 2147483647 >= Version; + case OMPC_grainsize: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nogroup: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_tasks: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_in_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_filter: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_masked_taskloop_simd: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_final: + return 1 <= Version && 2147483647 >= Version; + case OMPC_untied: + return 1 <= Version && 2147483647 >= Version; + case OMPC_mergeable: + return 1 <= Version && 2147483647 >= Version; + case OMPC_priority: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_grainsize: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nogroup: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_tasks: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_in_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + case OMPC_filter: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_master: + return false; + break; + case OMPD_master_taskloop: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_final: + return 1 <= Version && 2147483647 >= Version; + case OMPC_untied: + return 1 <= Version && 2147483647 >= Version; + case OMPC_mergeable: + return 1 <= Version && 2147483647 >= Version; + case OMPC_priority: + return 1 <= Version && 2147483647 >= Version; + case OMPC_grainsize: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nogroup: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_tasks: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_in_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_master_taskloop_simd: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_final: + return 1 <= Version && 2147483647 >= Version; + case OMPC_untied: + return 1 <= Version && 2147483647 >= Version; + case OMPC_mergeable: + return 1 <= Version && 2147483647 >= Version; + case OMPC_priority: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_grainsize: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nogroup: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_tasks: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_in_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_metadirective: + switch (C) { + case OMPC_when: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_nothing: + return false; + break; + case OMPD_ordered: + switch (C) { + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simd: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel: + switch (C) { + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel_do: + switch (C) { + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel_do_simd: + switch (C) { + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel_for: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel_for_simd: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel_masked: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_filter: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel_masked_taskloop: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_final: + return 1 <= Version && 2147483647 >= Version; + case OMPC_untied: + return 1 <= Version && 2147483647 >= Version; + case OMPC_mergeable: + return 1 <= Version && 2147483647 >= Version; + case OMPC_priority: + return 1 <= Version && 2147483647 >= Version; + case OMPC_grainsize: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nogroup: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_tasks: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_filter: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel_masked_taskloop_simd: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_final: + return 1 <= Version && 2147483647 >= Version; + case OMPC_untied: + return 1 <= Version && 2147483647 >= Version; + case OMPC_mergeable: + return 1 <= Version && 2147483647 >= Version; + case OMPC_priority: + return 1 <= Version && 2147483647 >= Version; + case OMPC_grainsize: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nogroup: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_tasks: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + case OMPC_filter: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel_master: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel_master_taskloop: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_final: + return 1 <= Version && 2147483647 >= Version; + case OMPC_untied: + return 1 <= Version && 2147483647 >= Version; + case OMPC_mergeable: + return 1 <= Version && 2147483647 >= Version; + case OMPC_priority: + return 1 <= Version && 2147483647 >= Version; + case OMPC_grainsize: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nogroup: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_tasks: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel_master_taskloop_simd: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_final: + return 1 <= Version && 2147483647 >= Version; + case OMPC_untied: + return 1 <= Version && 2147483647 >= Version; + case OMPC_mergeable: + return 1 <= Version && 2147483647 >= Version; + case OMPC_priority: + return 1 <= Version && 2147483647 >= Version; + case OMPC_grainsize: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nogroup: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_tasks: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel_sections: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel_workshare: + switch (C) { + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_requires: + switch (C) { + case OMPC_unified_address: + return 1 <= Version && 2147483647 >= Version; + case OMPC_unified_shared_memory: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reverse_offload: + return 99 <= Version && 2147483647 >= Version; + case OMPC_dynamic_allocators: + return 1 <= Version && 2147483647 >= Version; + case OMPC_atomic_default_mem_order: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_scan: + switch (C) { + case OMPC_inclusive: + return 50 <= Version && 2147483647 >= Version; + case OMPC_exclusive: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_section: + return false; + break; + case OMPD_sections: + switch (C) { + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_simd: + switch (C) { + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_single: + switch (C) { + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_in_reduction: + return 50 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 50 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 51 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ompx_dyn_cgroup_mem: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_data: + switch (C) { + case OMPC_use_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_use_device_addr: + return 50 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_enter_data: + switch (C) { + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_exit_data: + switch (C) { + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_parallel: + switch (C) { + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 50 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ompx_dyn_cgroup_mem: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_parallel_do: + switch (C) { + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_allocator: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_parallel_do_simd: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_parallel_for: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 50 <= Version && 2147483647 >= Version; + case OMPC_ompx_dyn_cgroup_mem: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_parallel_for_simd: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 50 <= Version && 2147483647 >= Version; + case OMPC_ompx_dyn_cgroup_mem: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_simd: + switch (C) { + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 50 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ompx_dyn_cgroup_mem: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_teams: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 50 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ompx_dyn_cgroup_mem: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_teams_distribute: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 50 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ompx_dyn_cgroup_mem: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_teams_distribute_parallel_do: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_teams_distribute_parallel_do_simd: + switch (C) { + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_teams_distribute_parallel_for: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 50 <= Version && 2147483647 >= Version; + case OMPC_ompx_dyn_cgroup_mem: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_teams_distribute_parallel_for_simd: + switch (C) { + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 50 <= Version && 2147483647 >= Version; + case OMPC_ompx_dyn_cgroup_mem: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_teams_distribute_simd: + switch (C) { + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 50 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ompx_dyn_cgroup_mem: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_update: + switch (C) { + case OMPC_to: + return 1 <= Version && 2147483647 >= Version; + case OMPC_from: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_task: + switch (C) { + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_untied: + return 1 <= Version && 2147483647 >= Version; + case OMPC_mergeable: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_in_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_detach: + return 50 <= Version && 2147483647 >= Version; + case OMPC_affinity: + return 50 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_final: + return 1 <= Version && 2147483647 >= Version; + case OMPC_priority: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_taskgroup: + switch (C) { + case OMPC_task_reduction: + return 50 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_taskloop: + switch (C) { + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_untied: + return 1 <= Version && 2147483647 >= Version; + case OMPC_mergeable: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nogroup: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_in_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_final: + return 1 <= Version && 2147483647 >= Version; + case OMPC_priority: + return 1 <= Version && 2147483647 >= Version; + case OMPC_grainsize: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_tasks: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_taskloop_simd: + switch (C) { + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_in_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_mergeable: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nogroup: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_untied: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_final: + return 1 <= Version && 2147483647 >= Version; + case OMPC_priority: + return 1 <= Version && 2147483647 >= Version; + case OMPC_grainsize: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_tasks: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_taskwait: + switch (C) { + case OMPC_depend: + return 50 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 51 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_taskyield: + return false; + break; + case OMPD_teams: + switch (C) { + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_teams_distribute: + switch (C) { + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_teams_distribute_parallel_do: + switch (C) { + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ordered: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_teams_distribute_parallel_do_simd: + switch (C) { + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_teams_distribute_parallel_for: + switch (C) { + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_teams_distribute_parallel_for_simd: + switch (C) { + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_teams_distribute_simd: + switch (C) { + case OMPC_aligned: + return 1 <= Version && 2147483647 >= Version; + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_linear: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nontemporal: + return 50 <= Version && 2147483647 >= Version; + case OMPC_order: + return 50 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_dist_schedule: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 50 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_safelen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_simdlen: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_threadprivate: + return false; + break; + case OMPD_tile: + switch (C) { + case OMPC_sizes: + return 51 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_unknown: + return false; + break; + case OMPD_unroll: + switch (C) { + case OMPC_full: + return 51 <= Version && 2147483647 >= Version; + case OMPC_partial: + return 51 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_workshare: + return false; + break; + case OMPD_dispatch: + switch (C) { + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_novariants: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nocontext: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_interop: + switch (C) { + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_destroy: + return 1 <= Version && 2147483647 >= Version; + case OMPC_init: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_use: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_loop: + switch (C) { + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_bind: + return 50 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_masked: + switch (C) { + case OMPC_filter: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_parallel_loop: + switch (C) { + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_bind: + return 50 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_parallel_loop: + switch (C) { + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_copyin: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 50 <= Version && 2147483647 >= Version; + case OMPC_bind: + return 50 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_threads: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + case OMPC_proc_bind: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ompx_dyn_cgroup_mem: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_target_teams_loop: + switch (C) { + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_depend: + return 1 <= Version && 2147483647 >= Version; + case OMPC_defaultmap: + return 1 <= Version && 2147483647 >= Version; + case OMPC_device: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_is_device_ptr: + return 1 <= Version && 2147483647 >= Version; + case OMPC_has_device_addr: + return 51 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_map: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_uses_allocators: + return 50 <= Version && 2147483647 >= Version; + case OMPC_bind: + return 50 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_if: + return 1 <= Version && 2147483647 >= Version; + case OMPC_nowait: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + case OMPC_ompx_dyn_cgroup_mem: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + case OMPD_teams_loop: + switch (C) { + case OMPC_allocate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_firstprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_lastprivate: + return 1 <= Version && 2147483647 >= Version; + case OMPC_private: + return 1 <= Version && 2147483647 >= Version; + case OMPC_reduction: + return 1 <= Version && 2147483647 >= Version; + case OMPC_shared: + return 1 <= Version && 2147483647 >= Version; + case OMPC_bind: + return 50 <= Version && 2147483647 >= Version; + case OMPC_collapse: + return 1 <= Version && 2147483647 >= Version; + case OMPC_default: + return 1 <= Version && 2147483647 >= Version; + case OMPC_num_teams: + return 1 <= Version && 2147483647 >= Version; + case OMPC_order: + return 1 <= Version && 2147483647 >= Version; + case OMPC_thread_limit: + return 1 <= Version && 2147483647 >= Version; + default: + return false; + } + break; + } + llvm_unreachable("Invalid OpenMP Directive kind"); +} + +#endif // GEN_DIRECTIVES_IMPL + diff --git a/contrib/libs/llvm16/include/llvm/FuzzMutate/FuzzerCLI.h b/contrib/libs/llvm16/include/llvm/FuzzMutate/FuzzerCLI.h new file mode 100644 index 0000000000..15aa11cc37 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/FuzzMutate/FuzzerCLI.h @@ -0,0 +1,68 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- FuzzerCLI.h - Common logic for CLIs of fuzzers ----------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Common logic needed to implement LLVM's fuzz targets' CLIs - including LLVM +// concepts like cl::opt and libFuzzer concepts like -ignore_remaining_args=1. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_FUZZMUTATE_FUZZERCLI_H +#define LLVM_FUZZMUTATE_FUZZERCLI_H + +#include "llvm/Support/DataTypes.h" +#include <stddef.h> + +namespace llvm { + +class StringRef; + +/// Parse cl::opts from a fuzz target commandline. +/// +/// This handles all arguments after -ignore_remaining_args=1 as cl::opts. +void parseFuzzerCLOpts(int ArgC, char *ArgV[]); + +/// Handle backend options that are encoded in the executable name. +/// +/// Parses some common backend options out of a specially crafted executable +/// name (argv[0]). For example, a name like llvm-foo-fuzzer--aarch64-gisel +/// might set up an AArch64 triple and the Global ISel selector. This should be +/// called *before* parseFuzzerCLOpts if calling both. +/// +/// This is meant to be used for environments like OSS-Fuzz that aren't capable +/// of passing in command line arguments in the normal way. +void handleExecNameEncodedBEOpts(StringRef ExecName); + +/// Handle optimizer options which are encoded in the executable name. +/// Same semantics as in 'handleExecNameEncodedBEOpts'. +void handleExecNameEncodedOptimizerOpts(StringRef ExecName); + +using FuzzerTestFun = int (*)(const uint8_t *Data, size_t Size); +using FuzzerInitFun = int (*)(int *argc, char ***argv); + +/// Runs a fuzz target on the inputs specified on the command line. +/// +/// Useful for testing fuzz targets without linking to libFuzzer. Finds inputs +/// in the argument list in a libFuzzer compatible way. +int runFuzzerOnInputs( + int ArgC, char *ArgV[], FuzzerTestFun TestOne, + FuzzerInitFun Init = [](int *, char ***) { return 0; }); + +} // namespace llvm + +#endif // LLVM_FUZZMUTATE_FUZZERCLI_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/Support/AMDHSAKernelDescriptor.h b/contrib/libs/llvm16/include/llvm/Support/AMDHSAKernelDescriptor.h new file mode 100644 index 0000000000..b5eca2dd70 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Support/AMDHSAKernelDescriptor.h @@ -0,0 +1,246 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===--- AMDHSAKernelDescriptor.h -----------------------------*- C++ -*---===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +/// \file +/// AMDHSA kernel descriptor definitions. For more information, visit +/// https://llvm.org/docs/AMDGPUUsage.html#kernel-descriptor +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_AMDHSAKERNELDESCRIPTOR_H +#define LLVM_SUPPORT_AMDHSAKERNELDESCRIPTOR_H + +#include <cstddef> +#include <cstdint> + +// Gets offset of specified member in specified type. +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((size_t)&((TYPE*)0)->MEMBER) +#endif // offsetof + +// Creates enumeration entries used for packing bits into integers. Enumeration +// entries include bit shift amount, bit width, and bit mask. +#ifndef AMDHSA_BITS_ENUM_ENTRY +#define AMDHSA_BITS_ENUM_ENTRY(NAME, SHIFT, WIDTH) \ + NAME ## _SHIFT = (SHIFT), \ + NAME ## _WIDTH = (WIDTH), \ + NAME = (((1 << (WIDTH)) - 1) << (SHIFT)) +#endif // AMDHSA_BITS_ENUM_ENTRY + +// Gets bits for specified bit mask from specified source. +#ifndef AMDHSA_BITS_GET +#define AMDHSA_BITS_GET(SRC, MSK) ((SRC & MSK) >> MSK ## _SHIFT) +#endif // AMDHSA_BITS_GET + +// Sets bits for specified bit mask in specified destination. +#ifndef AMDHSA_BITS_SET +#define AMDHSA_BITS_SET(DST, MSK, VAL) \ + DST &= ~MSK; \ + DST |= ((VAL << MSK ## _SHIFT) & MSK) +#endif // AMDHSA_BITS_SET + +namespace llvm { +namespace amdhsa { + +// Floating point rounding modes. Must match hardware definition. +enum : uint8_t { + FLOAT_ROUND_MODE_NEAR_EVEN = 0, + FLOAT_ROUND_MODE_PLUS_INFINITY = 1, + FLOAT_ROUND_MODE_MINUS_INFINITY = 2, + FLOAT_ROUND_MODE_ZERO = 3, +}; + +// Floating point denorm modes. Must match hardware definition. +enum : uint8_t { + FLOAT_DENORM_MODE_FLUSH_SRC_DST = 0, + FLOAT_DENORM_MODE_FLUSH_DST = 1, + FLOAT_DENORM_MODE_FLUSH_SRC = 2, + FLOAT_DENORM_MODE_FLUSH_NONE = 3, +}; + +// System VGPR workitem IDs. Must match hardware definition. +enum : uint8_t { + SYSTEM_VGPR_WORKITEM_ID_X = 0, + SYSTEM_VGPR_WORKITEM_ID_X_Y = 1, + SYSTEM_VGPR_WORKITEM_ID_X_Y_Z = 2, + SYSTEM_VGPR_WORKITEM_ID_UNDEFINED = 3, +}; + +// Compute program resource register 1. Must match hardware definition. +#define COMPUTE_PGM_RSRC1(NAME, SHIFT, WIDTH) \ + AMDHSA_BITS_ENUM_ENTRY(COMPUTE_PGM_RSRC1_ ## NAME, SHIFT, WIDTH) +enum : int32_t { + COMPUTE_PGM_RSRC1(GRANULATED_WORKITEM_VGPR_COUNT, 0, 6), + COMPUTE_PGM_RSRC1(GRANULATED_WAVEFRONT_SGPR_COUNT, 6, 4), + COMPUTE_PGM_RSRC1(PRIORITY, 10, 2), + COMPUTE_PGM_RSRC1(FLOAT_ROUND_MODE_32, 12, 2), + COMPUTE_PGM_RSRC1(FLOAT_ROUND_MODE_16_64, 14, 2), + COMPUTE_PGM_RSRC1(FLOAT_DENORM_MODE_32, 16, 2), + COMPUTE_PGM_RSRC1(FLOAT_DENORM_MODE_16_64, 18, 2), + COMPUTE_PGM_RSRC1(PRIV, 20, 1), + COMPUTE_PGM_RSRC1(ENABLE_DX10_CLAMP, 21, 1), + COMPUTE_PGM_RSRC1(DEBUG_MODE, 22, 1), + COMPUTE_PGM_RSRC1(ENABLE_IEEE_MODE, 23, 1), + COMPUTE_PGM_RSRC1(BULKY, 24, 1), + COMPUTE_PGM_RSRC1(CDBG_USER, 25, 1), + COMPUTE_PGM_RSRC1(FP16_OVFL, 26, 1), // GFX9+ + COMPUTE_PGM_RSRC1(RESERVED0, 27, 2), + COMPUTE_PGM_RSRC1(WGP_MODE, 29, 1), // GFX10+ + COMPUTE_PGM_RSRC1(MEM_ORDERED, 30, 1), // GFX10+ + COMPUTE_PGM_RSRC1(FWD_PROGRESS, 31, 1), // GFX10+ +}; +#undef COMPUTE_PGM_RSRC1 + +// Compute program resource register 2. Must match hardware definition. +#define COMPUTE_PGM_RSRC2(NAME, SHIFT, WIDTH) \ + AMDHSA_BITS_ENUM_ENTRY(COMPUTE_PGM_RSRC2_ ## NAME, SHIFT, WIDTH) +enum : int32_t { + COMPUTE_PGM_RSRC2(ENABLE_PRIVATE_SEGMENT, 0, 1), + COMPUTE_PGM_RSRC2(USER_SGPR_COUNT, 1, 5), + COMPUTE_PGM_RSRC2(ENABLE_TRAP_HANDLER, 6, 1), + COMPUTE_PGM_RSRC2(ENABLE_SGPR_WORKGROUP_ID_X, 7, 1), + COMPUTE_PGM_RSRC2(ENABLE_SGPR_WORKGROUP_ID_Y, 8, 1), + COMPUTE_PGM_RSRC2(ENABLE_SGPR_WORKGROUP_ID_Z, 9, 1), + COMPUTE_PGM_RSRC2(ENABLE_SGPR_WORKGROUP_INFO, 10, 1), + COMPUTE_PGM_RSRC2(ENABLE_VGPR_WORKITEM_ID, 11, 2), + COMPUTE_PGM_RSRC2(ENABLE_EXCEPTION_ADDRESS_WATCH, 13, 1), + COMPUTE_PGM_RSRC2(ENABLE_EXCEPTION_MEMORY, 14, 1), + COMPUTE_PGM_RSRC2(GRANULATED_LDS_SIZE, 15, 9), + COMPUTE_PGM_RSRC2(ENABLE_EXCEPTION_IEEE_754_FP_INVALID_OPERATION, 24, 1), + COMPUTE_PGM_RSRC2(ENABLE_EXCEPTION_FP_DENORMAL_SOURCE, 25, 1), + COMPUTE_PGM_RSRC2(ENABLE_EXCEPTION_IEEE_754_FP_DIVISION_BY_ZERO, 26, 1), + COMPUTE_PGM_RSRC2(ENABLE_EXCEPTION_IEEE_754_FP_OVERFLOW, 27, 1), + COMPUTE_PGM_RSRC2(ENABLE_EXCEPTION_IEEE_754_FP_UNDERFLOW, 28, 1), + COMPUTE_PGM_RSRC2(ENABLE_EXCEPTION_IEEE_754_FP_INEXACT, 29, 1), + COMPUTE_PGM_RSRC2(ENABLE_EXCEPTION_INT_DIVIDE_BY_ZERO, 30, 1), + COMPUTE_PGM_RSRC2(RESERVED0, 31, 1), +}; +#undef COMPUTE_PGM_RSRC2 + +// Compute program resource register 3 for GFX90A+. Must match hardware +// definition. +#define COMPUTE_PGM_RSRC3_GFX90A(NAME, SHIFT, WIDTH) \ + AMDHSA_BITS_ENUM_ENTRY(COMPUTE_PGM_RSRC3_GFX90A_ ## NAME, SHIFT, WIDTH) +enum : int32_t { + COMPUTE_PGM_RSRC3_GFX90A(ACCUM_OFFSET, 0, 6), + COMPUTE_PGM_RSRC3_GFX90A(RESERVED0, 6, 10), + COMPUTE_PGM_RSRC3_GFX90A(TG_SPLIT, 16, 1), + COMPUTE_PGM_RSRC3_GFX90A(RESERVED1, 17, 15), +}; +#undef COMPUTE_PGM_RSRC3_GFX90A + +// Compute program resource register 3 for GFX10+. Must match hardware +// definition. +#define COMPUTE_PGM_RSRC3_GFX10_PLUS(NAME, SHIFT, WIDTH) \ + AMDHSA_BITS_ENUM_ENTRY(COMPUTE_PGM_RSRC3_GFX10_PLUS_ ## NAME, SHIFT, WIDTH) +enum : int32_t { + COMPUTE_PGM_RSRC3_GFX10_PLUS(SHARED_VGPR_COUNT, 0, 4), // GFX10+ + COMPUTE_PGM_RSRC3_GFX10_PLUS(INST_PREF_SIZE, 4, 6), // GFX11+ + COMPUTE_PGM_RSRC3_GFX10_PLUS(TRAP_ON_START, 10, 1), // GFX11+ + COMPUTE_PGM_RSRC3_GFX10_PLUS(TRAP_ON_END, 11, 1), // GFX11+ + COMPUTE_PGM_RSRC3_GFX10_PLUS(RESERVED0, 12, 19), + COMPUTE_PGM_RSRC3_GFX10_PLUS(IMAGE_OP, 31, 1), // GFX11+ +}; +#undef COMPUTE_PGM_RSRC3_GFX10_PLUS + +// Kernel code properties. Must be kept backwards compatible. +#define KERNEL_CODE_PROPERTY(NAME, SHIFT, WIDTH) \ + AMDHSA_BITS_ENUM_ENTRY(KERNEL_CODE_PROPERTY_ ## NAME, SHIFT, WIDTH) +enum : int32_t { + KERNEL_CODE_PROPERTY(ENABLE_SGPR_PRIVATE_SEGMENT_BUFFER, 0, 1), + KERNEL_CODE_PROPERTY(ENABLE_SGPR_DISPATCH_PTR, 1, 1), + KERNEL_CODE_PROPERTY(ENABLE_SGPR_QUEUE_PTR, 2, 1), + KERNEL_CODE_PROPERTY(ENABLE_SGPR_KERNARG_SEGMENT_PTR, 3, 1), + KERNEL_CODE_PROPERTY(ENABLE_SGPR_DISPATCH_ID, 4, 1), + KERNEL_CODE_PROPERTY(ENABLE_SGPR_FLAT_SCRATCH_INIT, 5, 1), + KERNEL_CODE_PROPERTY(ENABLE_SGPR_PRIVATE_SEGMENT_SIZE, 6, 1), + KERNEL_CODE_PROPERTY(RESERVED0, 7, 3), + KERNEL_CODE_PROPERTY(ENABLE_WAVEFRONT_SIZE32, 10, 1), // GFX10+ + KERNEL_CODE_PROPERTY(USES_DYNAMIC_STACK, 11, 1), + KERNEL_CODE_PROPERTY(RESERVED1, 12, 4), +}; +#undef KERNEL_CODE_PROPERTY + +// Kernel descriptor. Must be kept backwards compatible. +struct kernel_descriptor_t { + uint32_t group_segment_fixed_size; + uint32_t private_segment_fixed_size; + uint32_t kernarg_size; + uint8_t reserved0[4]; + int64_t kernel_code_entry_byte_offset; + uint8_t reserved1[20]; + uint32_t compute_pgm_rsrc3; // GFX10+ and GFX90A+ + uint32_t compute_pgm_rsrc1; + uint32_t compute_pgm_rsrc2; + uint16_t kernel_code_properties; + uint8_t reserved2[6]; +}; + +enum : uint32_t { + GROUP_SEGMENT_FIXED_SIZE_OFFSET = 0, + PRIVATE_SEGMENT_FIXED_SIZE_OFFSET = 4, + KERNARG_SIZE_OFFSET = 8, + RESERVED0_OFFSET = 12, + KERNEL_CODE_ENTRY_BYTE_OFFSET_OFFSET = 16, + RESERVED1_OFFSET = 24, + COMPUTE_PGM_RSRC3_OFFSET = 44, + COMPUTE_PGM_RSRC1_OFFSET = 48, + COMPUTE_PGM_RSRC2_OFFSET = 52, + KERNEL_CODE_PROPERTIES_OFFSET = 56, + RESERVED2_OFFSET = 58, +}; + +static_assert( + sizeof(kernel_descriptor_t) == 64, + "invalid size for kernel_descriptor_t"); +static_assert(offsetof(kernel_descriptor_t, group_segment_fixed_size) == + GROUP_SEGMENT_FIXED_SIZE_OFFSET, + "invalid offset for group_segment_fixed_size"); +static_assert(offsetof(kernel_descriptor_t, private_segment_fixed_size) == + PRIVATE_SEGMENT_FIXED_SIZE_OFFSET, + "invalid offset for private_segment_fixed_size"); +static_assert(offsetof(kernel_descriptor_t, kernarg_size) == + KERNARG_SIZE_OFFSET, + "invalid offset for kernarg_size"); +static_assert(offsetof(kernel_descriptor_t, reserved0) == RESERVED0_OFFSET, + "invalid offset for reserved0"); +static_assert(offsetof(kernel_descriptor_t, kernel_code_entry_byte_offset) == + KERNEL_CODE_ENTRY_BYTE_OFFSET_OFFSET, + "invalid offset for kernel_code_entry_byte_offset"); +static_assert(offsetof(kernel_descriptor_t, reserved1) == RESERVED1_OFFSET, + "invalid offset for reserved1"); +static_assert(offsetof(kernel_descriptor_t, compute_pgm_rsrc3) == + COMPUTE_PGM_RSRC3_OFFSET, + "invalid offset for compute_pgm_rsrc3"); +static_assert(offsetof(kernel_descriptor_t, compute_pgm_rsrc1) == + COMPUTE_PGM_RSRC1_OFFSET, + "invalid offset for compute_pgm_rsrc1"); +static_assert(offsetof(kernel_descriptor_t, compute_pgm_rsrc2) == + COMPUTE_PGM_RSRC2_OFFSET, + "invalid offset for compute_pgm_rsrc2"); +static_assert(offsetof(kernel_descriptor_t, kernel_code_properties) == + KERNEL_CODE_PROPERTIES_OFFSET, + "invalid offset for kernel_code_properties"); +static_assert(offsetof(kernel_descriptor_t, reserved2) == RESERVED2_OFFSET, + "invalid offset for reserved2"); + +} // end namespace amdhsa +} // end namespace llvm + +#endif // LLVM_SUPPORT_AMDHSAKERNELDESCRIPTOR_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/Support/Solaris/sys/regset.h b/contrib/libs/llvm16/include/llvm/Support/Solaris/sys/regset.h new file mode 100644 index 0000000000..dd564f5d14 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Support/Solaris/sys/regset.h @@ -0,0 +1,49 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +/*===- llvm/Support/Solaris/sys/regset.h ------------------------*- C++ -*-===* + * + * 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 file works around excessive name space pollution from the system header + * on Solaris hosts. + * + *===----------------------------------------------------------------------===*/ + +#ifndef LLVM_SUPPORT_SOLARIS_SYS_REGSET_H + +#include_next <sys/regset.h> + +#undef CS +#undef DS +#undef ES +#undef FS +#undef GS +#undef SS +#undef EAX +#undef ECX +#undef EDX +#undef EBX +#undef ESP +#undef EBP +#undef ESI +#undef EDI +#undef EIP +#undef UESP +#undef EFL +#undef ERR +#undef TRAPNO + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/Support/TaskQueue.h b/contrib/libs/llvm16/include/llvm/Support/TaskQueue.h new file mode 100644 index 0000000000..152aeceb25 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Support/TaskQueue.h @@ -0,0 +1,149 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- llvm/Support/TaskQueue.h - A TaskQueue implementation ---*- C++ -*-===// +// +// 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 file defines a crude C++11 based task queue. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_TASKQUEUE_H +#define LLVM_SUPPORT_TASKQUEUE_H + +#include "llvm/Config/llvm-config.h" +#include "llvm/Support/ThreadPool.h" +#include "llvm/Support/thread.h" + +#include <atomic> +#include <cassert> +#include <condition_variable> +#include <deque> +#include <functional> +#include <future> +#include <memory> +#include <mutex> +#include <utility> + +namespace llvm { +/// TaskQueue executes serialized work on a user-defined Thread Pool. It +/// guarantees that if task B is enqueued after task A, task B begins after +/// task A completes and there is no overlap between the two. +class TaskQueue { + // Because we don't have init capture to use move-only local variables that + // are captured into a lambda, we create the promise inside an explicit + // callable struct. We want to do as much of the wrapping in the + // type-specialized domain (before type erasure) and then erase this into a + // std::function. + template <typename Callable> struct Task { + using ResultTy = std::invoke_result_t<Callable>; + explicit Task(Callable C, TaskQueue &Parent) + : C(std::move(C)), P(std::make_shared<std::promise<ResultTy>>()), + Parent(&Parent) {} + + template<typename T> + void invokeCallbackAndSetPromise(T*) { + P->set_value(C()); + } + + void invokeCallbackAndSetPromise(void*) { + C(); + P->set_value(); + } + + void operator()() noexcept { + ResultTy *Dummy = nullptr; + invokeCallbackAndSetPromise(Dummy); + Parent->completeTask(); + } + + Callable C; + std::shared_ptr<std::promise<ResultTy>> P; + TaskQueue *Parent; + }; + +public: + /// Construct a task queue with no work. + TaskQueue(ThreadPool &Scheduler) : Scheduler(Scheduler) { (void)Scheduler; } + + /// Blocking destructor: the queue will wait for all work to complete. + ~TaskQueue() { + Scheduler.wait(); + assert(Tasks.empty()); + } + + /// Asynchronous submission of a task to the queue. The returned future can be + /// used to wait for the task (and all previous tasks that have not yet + /// completed) to finish. + template <typename Callable> + std::future<std::invoke_result_t<Callable>> async(Callable &&C) { +#if !LLVM_ENABLE_THREADS + static_assert(false, + "TaskQueue requires building with LLVM_ENABLE_THREADS!"); +#endif + Task<Callable> T{std::move(C), *this}; + using ResultTy = std::invoke_result_t<Callable>; + std::future<ResultTy> F = T.P->get_future(); + { + std::lock_guard<std::mutex> Lock(QueueLock); + // If there's already a task in flight, just queue this one up. If + // there is not a task in flight, bypass the queue and schedule this + // task immediately. + if (IsTaskInFlight) + Tasks.push_back(std::move(T)); + else { + Scheduler.async(std::move(T)); + IsTaskInFlight = true; + } + } + return F; + } + +private: + void completeTask() { + // We just completed a task. If there are no more tasks in the queue, + // update IsTaskInFlight to false and stop doing work. Otherwise + // schedule the next task (while not holding the lock). + std::function<void()> Continuation; + { + std::lock_guard<std::mutex> Lock(QueueLock); + if (Tasks.empty()) { + IsTaskInFlight = false; + return; + } + + Continuation = std::move(Tasks.front()); + Tasks.pop_front(); + } + Scheduler.async(std::move(Continuation)); + } + + /// The thread pool on which to run the work. + ThreadPool &Scheduler; + + /// State which indicates whether the queue currently is currently processing + /// any work. + bool IsTaskInFlight = false; + + /// Mutex for synchronizing access to the Tasks array. + std::mutex QueueLock; + + /// Tasks waiting for execution in the queue. + std::deque<std::function<void()>> Tasks; +}; +} // namespace llvm + +#endif // LLVM_SUPPORT_TASKQUEUE_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/Support/X86TargetParser.def b/contrib/libs/llvm16/include/llvm/Support/X86TargetParser.def new file mode 100644 index 0000000000..416d583c35 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Support/X86TargetParser.def @@ -0,0 +1,15 @@ +//===-- llvm/Support/X86TargetParser.def ------------------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// This header is deprecated in favour of +/// `llvm/TargetParser/X86TargetParser.def`. +/// +//===----------------------------------------------------------------------===// + +#include "llvm/TargetParser/X86TargetParser.def" diff --git a/contrib/libs/llvm16/include/llvm/Support/raw_sha1_ostream.h b/contrib/libs/llvm16/include/llvm/Support/raw_sha1_ostream.h new file mode 100644 index 0000000000..996660e318 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Support/raw_sha1_ostream.h @@ -0,0 +1,57 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//==- raw_sha1_ostream.h - raw_ostream that compute SHA1 --*- C++ -*-==// +// +// 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 file defines the raw_sha1_ostream class. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_RAW_SHA1_OSTREAM_H +#define LLVM_SUPPORT_RAW_SHA1_OSTREAM_H + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/SHA1.h" +#include "llvm/Support/raw_ostream.h" + +namespace llvm { + +/// A raw_ostream that hash the content using the sha1 algorithm. +class raw_sha1_ostream : public raw_ostream { + SHA1 State; + + /// See raw_ostream::write_impl. + void write_impl(const char *Ptr, size_t Size) override { + State.update(ArrayRef<uint8_t>((const uint8_t *)Ptr, Size)); + } + +public: + /// Return the current SHA1 hash for the content of the stream + std::array<uint8_t, 20> sha1() { + flush(); + return State.result(); + } + + /// Reset the internal state to start over from scratch. + void resetHash() { State.init(); } + + uint64_t current_pos() const override { return 0; } +}; + +} // end llvm namespace + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/TableGen/Automaton.td b/contrib/libs/llvm16/include/llvm/TableGen/Automaton.td new file mode 100644 index 0000000000..13ced2a0e7 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/TableGen/Automaton.td @@ -0,0 +1,95 @@ +//===- Automaton.td ----------------------------------------*- tablegen -*-===// +// +// 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 file defines the key top-level classes needed to produce a reasonably +// generic finite-state automaton. +// +//===----------------------------------------------------------------------===// + +// Define a record inheriting from GenericAutomaton to generate a reasonably +// generic finite-state automaton over a set of actions and states. +// +// This automaton is defined by: +// 1) a state space (explicit, always bits<32>). +// 2) a set of input symbols (actions, explicit) and +// 3) a transition function from state + action -> state. +// +// A theoretical automaton is defined by <Q, S, d, q0, F>: +// Q: A set of possible states. +// S: (sigma) The input alphabet. +// d: (delta) The transition function f(q in Q, s in S) -> q' in Q. +// F: The set of final (accepting) states. +// +// Because generating all possible states is tedious, we instead define the +// transition function only and crawl all reachable states starting from the +// initial state with all inputs under all transitions until termination. +// +// We define F = S, that is, all valid states are accepting. +// +// To ensure the generation of the automaton terminates, the state transitions +// are defined as a lattice (meaning every transitioned-to state is more +// specific than the transitioned-from state, for some definition of specificity). +// Concretely a transition may set one or more bits in the state that were +// previously zero to one. If any bit was not zero, the transition is invalid. +// +// Instead of defining all possible states (which would be cumbersome), the user +// provides a set of possible Transitions from state A, consuming an input +// symbol A to state B. The Transition object transforms state A to state B and +// acts as a predicate. This means the state space can be discovered by crawling +// all the possible transitions until none are valid. +// +// This automaton is considered to be nondeterministic, meaning that multiple +// transitions can occur from any (state, action) pair. The generated automaton +// is determinized, meaning that is executes in O(k) time where k is the input +// sequence length. +// +// In addition to a generated automaton that determines if a sequence of inputs +// is accepted or not, a table is emitted that allows determining a plausible +// sequence of states traversed to accept that input. +class GenericAutomaton { + // Name of a class that inherits from Transition. All records inheriting from + // this class will be considered when constructing the automaton. + string TransitionClass; + + // Names of fields within TransitionClass that define the action symbol. This + // defines the action as an N-tuple. + // + // Each symbol field can be of class, int, string or code type. + // If the type of a field is a class, the Record's name is used verbatim + // in C++ and the class name is used as the C++ type name. + // If the type of a field is a string, code or int, that is also used + // verbatim in C++. + // + // To override the C++ type name for field F, define a field called TypeOf_F. + // This should be a string that will be used verbatim in C++. + // + // As an example, to define a 2-tuple with an enum and a string, one might: + // def MyTransition : Transition { + // MyEnum S1; + // int S2; + // } + // def MyAutomaton : GenericAutomaton }{ + // let TransitionClass = "Transition"; + // let SymbolFields = ["S1", "S2"]; + // let TypeOf_S1 = "MyEnumInCxxKind"; + // } + list<string> SymbolFields; +} + +// All transitions inherit from Transition. +class Transition { + // A transition S' = T(S) is valid if, for every set bit in NewState, the + // corresponding bit in S is clear. That is: + // def T(S): + // S' = S | NewState + // return S' if S' != S else Failure + // + // The automaton generator uses this property to crawl the set of possible + // transitions from a starting state of 0b0. + bits<32> NewState; +} diff --git a/contrib/libs/llvm16/include/llvm/Testing/ADT/StringMap.h b/contrib/libs/llvm16/include/llvm/Testing/ADT/StringMap.h new file mode 100644 index 0000000000..625c010ce7 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Testing/ADT/StringMap.h @@ -0,0 +1,57 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- llvm/Testing/ADT/StringMap.h ---------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TESTING_ADT_STRINGMAP_H_ +#define LLVM_TESTING_ADT_STRINGMAP_H_ + +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/Support/FormatVariadic.h" +#include "llvm/Testing/ADT/StringMapEntry.h" +#include <ostream> +#include <sstream> + +namespace llvm { + +/// Support for printing to std::ostream, for use with e.g. producing more +/// useful error messages with Google Test. +template <typename T> +std::ostream &operator<<(std::ostream &OS, const StringMap<T> &M) { + if (M.empty()) { + return OS << "{ }"; + } + + std::vector<std::string> Lines; + for (const auto &E : M) { + std::ostringstream SS; + SS << E << ","; + Lines.push_back(SS.str()); + } + llvm::sort(Lines); + Lines.insert(Lines.begin(), "{"); + Lines.insert(Lines.end(), "}"); + + return OS << llvm::formatv("{0:$[\n]}", + make_range(Lines.begin(), Lines.end())) + .str(); +} + +} // namespace llvm + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/Testing/ADT/StringMapEntry.h b/contrib/libs/llvm16/include/llvm/Testing/ADT/StringMapEntry.h new file mode 100644 index 0000000000..7cb5016205 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Testing/ADT/StringMapEntry.h @@ -0,0 +1,140 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- llvm/Testing/ADT/StringMapEntry.h ----------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TESTING_ADT_STRINGMAPENTRY_H_ +#define LLVM_TESTING_ADT_STRINGMAPENTRY_H_ + +#include "llvm/ADT/StringMapEntry.h" +#include "gmock/gmock.h" +#include <ostream> +#include <type_traits> + +namespace llvm { +namespace detail { + +template <typename T, typename = std::void_t<>> +struct CanOutputToOStream : std::false_type {}; + +template <typename T> +struct CanOutputToOStream<T, std::void_t<decltype(std::declval<std::ostream &>() + << std::declval<T>())>> + : std::true_type {}; + +} // namespace detail + +/// Support for printing to std::ostream, for use with e.g. producing more +/// useful error messages with Google Test. +template <typename T> +std::ostream &operator<<(std::ostream &OS, const StringMapEntry<T> &E) { + OS << "{\"" << E.getKey().data() << "\": "; + if constexpr (detail::CanOutputToOStream<decltype(E.getValue())>::value) { + OS << E.getValue(); + } else { + OS << "non-printable value"; + } + return OS << "}"; +} + +namespace detail { + +template <typename StringMapEntryT> +class StringMapEntryMatcherImpl + : public testing::MatcherInterface<StringMapEntryT> { +public: + using ValueT = typename std::remove_reference_t<StringMapEntryT>::ValueType; + + template <typename KeyMatcherT, typename ValueMatcherT> + StringMapEntryMatcherImpl(KeyMatcherT KeyMatcherArg, + ValueMatcherT ValueMatcherArg) + : KeyMatcher( + testing::SafeMatcherCast<const std::string &>(KeyMatcherArg)), + ValueMatcher( + testing::SafeMatcherCast<const ValueT &>(ValueMatcherArg)) {} + + void DescribeTo(std::ostream *OS) const override { + *OS << "has a string key that "; + KeyMatcher.DescribeTo(OS); + *OS << ", and has a value that "; + ValueMatcher.DescribeTo(OS); + } + + void DescribeNegationTo(std::ostream *OS) const override { + *OS << "has a string key that "; + KeyMatcher.DescribeNegationTo(OS); + *OS << ", or has a value that "; + ValueMatcher.DescribeNegationTo(OS); + } + + bool + MatchAndExplain(StringMapEntryT Entry, + testing::MatchResultListener *ResultListener) const override { + testing::StringMatchResultListener KeyListener; + if (!KeyMatcher.MatchAndExplain(Entry.getKey().data(), &KeyListener)) { + *ResultListener << ("which has a string key " + + (KeyListener.str().empty() ? "that doesn't match" + : KeyListener.str())); + return false; + } + testing::StringMatchResultListener ValueListener; + if (!ValueMatcher.MatchAndExplain(Entry.getValue(), &ValueListener)) { + *ResultListener << ("which has a value " + (ValueListener.str().empty() + ? "that doesn't match" + : ValueListener.str())); + return false; + } + *ResultListener << "which is a match"; + return true; + } + +private: + const testing::Matcher<const std::string &> KeyMatcher; + const testing::Matcher<const ValueT &> ValueMatcher; +}; + +template <typename KeyMatcherT, typename ValueMatcherT> +class StringMapEntryMatcher { +public: + StringMapEntryMatcher(KeyMatcherT KMArg, ValueMatcherT VMArg) + : KM(std::move(KMArg)), VM(std::move(VMArg)) {} + + template <typename StringMapEntryT> + operator testing::Matcher<StringMapEntryT>() const { // NOLINT + return testing::Matcher<StringMapEntryT>( + new StringMapEntryMatcherImpl<const StringMapEntryT &>(KM, VM)); + } + +private: + const KeyMatcherT KM; + const ValueMatcherT VM; +}; + +} // namespace detail + +/// Returns a gMock matcher that matches a `StringMapEntry` whose string key +/// matches `KeyMatcher`, and whose value matches `ValueMatcher`. +template <typename KeyMatcherT, typename ValueMatcherT> +detail::StringMapEntryMatcher<KeyMatcherT, ValueMatcherT> +IsStringMapEntry(KeyMatcherT KM, ValueMatcherT VM) { + return detail::StringMapEntryMatcher<KeyMatcherT, ValueMatcherT>( + std::move(KM), std::move(VM)); +} + +} // namespace llvm + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/Testing/Annotations/Annotations.h b/contrib/libs/llvm16/include/llvm/Testing/Annotations/Annotations.h new file mode 100644 index 0000000000..476cd7878c --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Testing/Annotations/Annotations.h @@ -0,0 +1,144 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===--- Annotations.h - Annotated source code for tests ---------*- C++-*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +#ifndef LLVM_TESTING_SUPPORT_ANNOTATIONS_H +#define LLVM_TESTING_SUPPORT_ANNOTATIONS_H + +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include <tuple> +#include <vector> + +namespace llvm { + +class raw_ostream; + +/// Annotations lets you mark points and ranges inside source code, for tests: +/// +/// Annotations Example(R"cpp( +/// int complete() { x.pri^ } // ^ indicates a point +/// void err() { [["hello" == 42]]; } // [[this is a range]] +/// $definition^class Foo{}; // points can be named: "definition" +/// $(foo)^class Foo{}; // ...or have a payload: "foo" +/// $definition(foo)^class Foo{}; // ...or both +/// $fail(runtime)[[assert(false)]] // ranges can have names/payloads too +/// )cpp"); +/// +/// StringRef Code = Example.code(); // annotations stripped. +/// std::vector<size_t> PP = Example.points(); // all unnamed points +/// size_t P = Example.point(); // there must be exactly one +/// llvm::Range R = Example.range("fail"); // find named ranges +/// +/// Points/ranges are coordinated into `code()` which is stripped of +/// annotations. +/// +/// Names consist of only alphanumeric characters or '_'. +/// Payloads can contain any character expect '(' and ')'. +/// +/// Ranges may be nested (and points can be inside ranges), but there's no way +/// to define general overlapping ranges. +/// +/// FIXME: the choice of the marking syntax makes it impossible to represent +/// some of the C++ and Objective C constructs (including common ones +/// like C++ attributes). We can fix this by: +/// 1. introducing an escaping mechanism for the special characters, +/// 2. making characters for marking points and ranges configurable, +/// 3. changing the syntax to something less commonly used, +/// 4. ... +class Annotations { +public: + /// Two offsets pointing to a continuous substring. End is not included, i.e. + /// represents a half-open range. + struct Range { + size_t Begin = 0; + size_t End = 0; + + friend bool operator==(const Range &L, const Range &R) { + return std::tie(L.Begin, L.End) == std::tie(R.Begin, R.End); + } + friend bool operator!=(const Range &L, const Range &R) { return !(L == R); } + }; + + /// Parses the annotations from Text. Crashes if it's malformed. + Annotations(llvm::StringRef Text); + + /// The input text with all annotations stripped. + /// All points and ranges are relative to this stripped text. + llvm::StringRef code() const { return Code; } + + /// Returns the position of the point marked by ^ (or $name^) in the text. + /// Crashes if there isn't exactly one. + size_t point(llvm::StringRef Name = "") const; + /// Returns the position of the point with \p Name and its payload (if any). + std::pair<size_t, llvm::StringRef> + pointWithPayload(llvm::StringRef Name = "") const; + /// Returns the position of all points marked by ^ (or $name^) in the text. + /// Order matches the order within the text. + std::vector<size_t> points(llvm::StringRef Name = "") const; + /// Returns the positions and payloads (if any) of all points named \p Name + std::vector<std::pair<size_t, llvm::StringRef>> + pointsWithPayload(llvm::StringRef Name = "") const; + /// Returns the mapping of all names of points marked in the text to their + /// position. Unnamed points are mapped to the empty string. The positions are + /// sorted. + /// FIXME Remove this and expose `All` directly (currently used out-of-tree) + llvm::StringMap<llvm::SmallVector<size_t, 1>> all_points() const; + + /// Returns the location of the range marked by [[ ]] (or $name[[ ]]). + /// Crashes if there isn't exactly one. + Range range(llvm::StringRef Name = "") const; + /// Returns the location and payload of the range marked by [[ ]] + /// (or $name(payload)[[ ]]). Crashes if there isn't exactly one. + std::pair<Range, llvm::StringRef> + rangeWithPayload(llvm::StringRef Name = "") const; + /// Returns the location of all ranges marked by [[ ]] (or $name[[ ]]). + /// They are ordered by start position within the text. + std::vector<Range> ranges(llvm::StringRef Name = "") const; + /// Returns the location of all ranges marked by [[ ]] + /// (or $name(payload)[[ ]]). + /// They are ordered by start position within the text. + std::vector<std::pair<Range, llvm::StringRef>> + rangesWithPayload(llvm::StringRef Name = "") const; + /// Returns the mapping of all names of ranges marked in the text to their + /// location. Unnamed ranges are mapped to the empty string. The ranges are + /// sorted by their start position. + llvm::StringMap<llvm::SmallVector<Range, 1>> all_ranges() const; + +private: + std::string Code; + /// Either a Point (Only Start) or a Range (Start and End) + struct Annotation { + size_t Begin; + size_t End = -1; + bool isPoint() const { return End == size_t(-1); } + llvm::StringRef Name; + llvm::StringRef Payload; + }; + std::vector<Annotation> All; + // Values are the indices into All + llvm::StringMap<llvm::SmallVector<size_t, 1>> Points; + llvm::StringMap<llvm::SmallVector<size_t, 1>> Ranges; +}; + +llvm::raw_ostream &operator<<(llvm::raw_ostream &O, + const llvm::Annotations::Range &R); + +} // namespace llvm + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/Testing/Support/Error.h b/contrib/libs/llvm16/include/llvm/Testing/Support/Error.h new file mode 100644 index 0000000000..90896c9c32 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Testing/Support/Error.h @@ -0,0 +1,238 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- llvm/Testing/Support/Error.h ---------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TESTING_SUPPORT_ERROR_H +#define LLVM_TESTING_SUPPORT_ERROR_H + +#include "llvm/Support/Error.h" +#include "llvm/Testing/Support/SupportHelpers.h" + +#include "gmock/gmock.h" +#include <ostream> + +namespace llvm { +namespace detail { +ErrorHolder TakeError(Error Err); + +template <typename T> ExpectedHolder<T> TakeExpected(Expected<T> &Exp) { + return {TakeError(Exp.takeError()), Exp}; +} + +template <typename T> ExpectedHolder<T> TakeExpected(Expected<T> &&Exp) { + return TakeExpected(Exp); +} + +template <typename T> +class ValueMatchesMono + : public testing::MatcherInterface<const ExpectedHolder<T> &> { +public: + explicit ValueMatchesMono(const testing::Matcher<T> &Matcher) + : Matcher(Matcher) {} + + bool MatchAndExplain(const ExpectedHolder<T> &Holder, + testing::MatchResultListener *listener) const override { + if (!Holder.Success()) + return false; + + bool result = Matcher.MatchAndExplain(*Holder.Exp, listener); + + if (result || !listener->IsInterested()) + return result; + *listener << "("; + Matcher.DescribeNegationTo(listener->stream()); + *listener << ")"; + return result; + } + + void DescribeTo(std::ostream *OS) const override { + *OS << "succeeded with value ("; + Matcher.DescribeTo(OS); + *OS << ")"; + } + + void DescribeNegationTo(std::ostream *OS) const override { + *OS << "did not succeed or value ("; + Matcher.DescribeNegationTo(OS); + *OS << ")"; + } + +private: + testing::Matcher<T> Matcher; +}; + +template<typename M> +class ValueMatchesPoly { +public: + explicit ValueMatchesPoly(const M &Matcher) : Matcher(Matcher) {} + + template <typename T> + operator testing::Matcher<const ExpectedHolder<T> &>() const { + return MakeMatcher( + new ValueMatchesMono<T>(testing::SafeMatcherCast<T>(Matcher))); + } + +private: + M Matcher; +}; + +template <typename InfoT> +class ErrorMatchesMono : public testing::MatcherInterface<const ErrorHolder &> { +public: + explicit ErrorMatchesMono(std::optional<testing::Matcher<InfoT &>> Matcher) + : Matcher(std::move(Matcher)) {} + + bool MatchAndExplain(const ErrorHolder &Holder, + testing::MatchResultListener *listener) const override { + if (Holder.Success()) + return false; + + if (Holder.Infos.size() > 1) { + *listener << "multiple errors"; + return false; + } + + auto &Info = *Holder.Infos[0]; + if (!Info.isA<InfoT>()) { + *listener << "Error was not of given type"; + return false; + } + + if (!Matcher) + return true; + + return Matcher->MatchAndExplain(static_cast<InfoT &>(Info), listener); + } + + void DescribeTo(std::ostream *OS) const override { + *OS << "failed with Error of given type"; + if (Matcher) { + *OS << " and the error "; + Matcher->DescribeTo(OS); + } + } + + void DescribeNegationTo(std::ostream *OS) const override { + *OS << "succeeded or did not fail with the error of given type"; + if (Matcher) { + *OS << " or the error "; + Matcher->DescribeNegationTo(OS); + } + } + +private: + std::optional<testing::Matcher<InfoT &>> Matcher; +}; + +class ErrorMessageMatches + : public testing::MatcherInterface<const ErrorHolder &> { +public: + explicit ErrorMessageMatches( + testing::Matcher<std::vector<std::string>> Matcher) + : Matcher(std::move(Matcher)) {} + + bool MatchAndExplain(const ErrorHolder &Holder, + testing::MatchResultListener *listener) const override { + std::vector<std::string> Messages; + Messages.reserve(Holder.Infos.size()); + for (const std::shared_ptr<ErrorInfoBase> &Info : Holder.Infos) + Messages.push_back(Info->message()); + + return Matcher.MatchAndExplain(Messages, listener); + } + + void DescribeTo(std::ostream *OS) const override { + *OS << "failed with Error whose message "; + Matcher.DescribeTo(OS); + } + + void DescribeNegationTo(std::ostream *OS) const override { + *OS << "failed with an Error whose message "; + Matcher.DescribeNegationTo(OS); + } + +private: + testing::Matcher<std::vector<std::string>> Matcher; +}; +} // namespace detail + +#define EXPECT_THAT_ERROR(Err, Matcher) \ + EXPECT_THAT(llvm::detail::TakeError(Err), Matcher) +#define ASSERT_THAT_ERROR(Err, Matcher) \ + ASSERT_THAT(llvm::detail::TakeError(Err), Matcher) + +/// Helper macro for checking the result of an 'Expected<T>' +/// +/// @code{.cpp} +/// // function to be tested +/// Expected<int> myDivide(int A, int B); +/// +/// TEST(myDivideTests, GoodAndBad) { +/// // test good case +/// // if you only care about success or failure: +/// EXPECT_THAT_EXPECTED(myDivide(10, 5), Succeeded()); +/// // if you also care about the value: +/// EXPECT_THAT_EXPECTED(myDivide(10, 5), HasValue(2)); +/// +/// // test the error case +/// EXPECT_THAT_EXPECTED(myDivide(10, 0), Failed()); +/// // also check the error message +/// EXPECT_THAT_EXPECTED(myDivide(10, 0), +/// FailedWithMessage("B must not be zero!")); +/// } +/// @endcode + +#define EXPECT_THAT_EXPECTED(Err, Matcher) \ + EXPECT_THAT(llvm::detail::TakeExpected(Err), Matcher) +#define ASSERT_THAT_EXPECTED(Err, Matcher) \ + ASSERT_THAT(llvm::detail::TakeExpected(Err), Matcher) + +MATCHER(Succeeded, "") { return arg.Success(); } +MATCHER(Failed, "") { return !arg.Success(); } + +template <typename InfoT> +testing::Matcher<const detail::ErrorHolder &> Failed() { + return MakeMatcher(new detail::ErrorMatchesMono<InfoT>(std::nullopt)); +} + +template <typename InfoT, typename M> +testing::Matcher<const detail::ErrorHolder &> Failed(M Matcher) { + return MakeMatcher(new detail::ErrorMatchesMono<InfoT>( + testing::SafeMatcherCast<InfoT &>(Matcher))); +} + +template <typename... M> +testing::Matcher<const detail::ErrorHolder &> FailedWithMessage(M... Matcher) { + static_assert(sizeof...(M) > 0); + return MakeMatcher( + new detail::ErrorMessageMatches(testing::ElementsAre(Matcher...))); +} + +template <typename M> +testing::Matcher<const detail::ErrorHolder &> FailedWithMessageArray(M Matcher) { + return MakeMatcher(new detail::ErrorMessageMatches(Matcher)); +} + +template <typename M> +detail::ValueMatchesPoly<M> HasValue(M Matcher) { + return detail::ValueMatchesPoly<M>(Matcher); +} + +} // namespace llvm + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/Testing/Support/SupportHelpers.h b/contrib/libs/llvm16/include/llvm/Testing/Support/SupportHelpers.h new file mode 100644 index 0000000000..56b7330584 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/Testing/Support/SupportHelpers.h @@ -0,0 +1,265 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- Testing/Support/SupportHelpers.h -----------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TESTING_SUPPORT_SUPPORTHELPERS_H +#define LLVM_TESTING_SUPPORT_SUPPORTHELPERS_H + +#include "llvm/ADT/SmallString.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/FileSystem.h" +#include "llvm/Support/Path.h" +#include "llvm/Support/raw_os_ostream.h" +#include "gmock/gmock-matchers.h" +#include "gtest/gtest-printers.h" + +#include <optional> +#include <string> + +namespace llvm { +namespace detail { +struct ErrorHolder { + std::vector<std::shared_ptr<ErrorInfoBase>> Infos; + + bool Success() const { return Infos.empty(); } +}; + +template <typename T> struct ExpectedHolder : public ErrorHolder { + ExpectedHolder(ErrorHolder Err, Expected<T> &Exp) + : ErrorHolder(std::move(Err)), Exp(Exp) {} + + Expected<T> &Exp; +}; + +inline void PrintTo(const ErrorHolder &Err, std::ostream *Out) { + raw_os_ostream OS(*Out); + OS << (Err.Success() ? "succeeded" : "failed"); + if (!Err.Success()) { + const char *Delim = " ("; + for (const auto &Info : Err.Infos) { + OS << Delim; + Delim = "; "; + Info->log(OS); + } + OS << ")"; + } +} + +template <typename T> +void PrintTo(const ExpectedHolder<T> &Item, std::ostream *Out) { + if (Item.Success()) { + *Out << "succeeded with value " << ::testing::PrintToString(*Item.Exp); + } else { + PrintTo(static_cast<const ErrorHolder &>(Item), Out); + } +} + +template <class InnerMatcher> class ValueIsMatcher { +public: + explicit ValueIsMatcher(InnerMatcher ValueMatcher) + : ValueMatcher(ValueMatcher) {} + + template <class T> + operator ::testing::Matcher<const std::optional<T> &>() const { + return ::testing::MakeMatcher( + new Impl<T>(::testing::SafeMatcherCast<T>(ValueMatcher))); + } + + template <class T, class O = std::optional<T>> + class Impl : public ::testing::MatcherInterface<const O &> { + public: + explicit Impl(const ::testing::Matcher<T> &ValueMatcher) + : ValueMatcher(ValueMatcher) {} + + bool MatchAndExplain(const O &Input, + testing::MatchResultListener *L) const override { + return Input && ValueMatcher.MatchAndExplain(*Input, L); + } + + void DescribeTo(std::ostream *OS) const override { + *OS << "has a value that "; + ValueMatcher.DescribeTo(OS); + } + void DescribeNegationTo(std::ostream *OS) const override { + *OS << "does not have a value that "; + ValueMatcher.DescribeTo(OS); + } + + private: + testing::Matcher<T> ValueMatcher; + }; + +private: + InnerMatcher ValueMatcher; +}; +} // namespace detail + +/// Matches an std::optional<T> with a value that conforms to an inner matcher. +/// To match std::nullopt you could use Eq(std::nullopt). +template <class InnerMatcher> +detail::ValueIsMatcher<InnerMatcher> ValueIs(const InnerMatcher &ValueMatcher) { + return detail::ValueIsMatcher<InnerMatcher>(ValueMatcher); +} +namespace unittest { + +SmallString<128> getInputFileDirectory(const char *Argv0); + +/// A RAII object that creates a temporary directory upon initialization and +/// removes it upon destruction. +class TempDir { + SmallString<128> Path; + +public: + /// Creates a managed temporary directory. + /// + /// @param Name The name of the directory to create. + /// @param Unique If true, the directory will be created using + /// llvm::sys::fs::createUniqueDirectory. + explicit TempDir(StringRef Name, bool Unique = false) { + std::error_code EC; + if (Unique) { + EC = llvm::sys::fs::createUniqueDirectory(Name, Path); + if (!EC) { + // Resolve any symlinks in the new directory. + std::string UnresolvedPath(Path.str()); + EC = llvm::sys::fs::real_path(UnresolvedPath, Path); + } + } else { + Path = Name; + EC = llvm::sys::fs::create_directory(Path); + } + if (EC) + Path.clear(); + EXPECT_FALSE(EC) << EC.message(); + } + + ~TempDir() { + if (!Path.empty()) { + EXPECT_FALSE(llvm::sys::fs::remove_directories(Path.str())); + } + } + + TempDir(const TempDir &) = delete; + TempDir &operator=(const TempDir &) = delete; + + TempDir(TempDir &&) = default; + TempDir &operator=(TempDir &&) = default; + + /// The path to the temporary directory. + StringRef path() const { return Path; } + + /// The null-terminated C string pointing to the path. + const char *c_str() { return Path.c_str(); } + + /// Creates a new path by appending the argument to the path of the managed + /// directory using the native path separator. + SmallString<128> path(StringRef component) const { + SmallString<128> Result(Path); + SmallString<128> ComponentToAppend(component); + llvm::sys::path::native(ComponentToAppend); + llvm::sys::path::append(Result, Twine(ComponentToAppend)); + return Result; + } +}; + +/// A RAII object that creates a link upon initialization and +/// removes it upon destruction. +/// +/// The link may be a soft or a hard link, depending on the platform. +class TempLink { + SmallString<128> Path; + +public: + /// Creates a managed link at path Link pointing to Target. + TempLink(StringRef Target, StringRef Link) { + Path = Link; + std::error_code EC = sys::fs::create_link(Target, Link); + if (EC) + Path.clear(); + EXPECT_FALSE(EC); + } + ~TempLink() { + if (!Path.empty()) { + EXPECT_FALSE(llvm::sys::fs::remove(Path.str())); + } + } + + TempLink(const TempLink &) = delete; + TempLink &operator=(const TempLink &) = delete; + + TempLink(TempLink &&) = default; + TempLink &operator=(TempLink &&) = default; + + /// The path to the link. + StringRef path() const { return Path; } +}; + +/// A RAII object that creates a file upon initialization and +/// removes it upon destruction. +class TempFile { + SmallString<128> Path; + +public: + /// Creates a managed file. + /// + /// @param Name The name of the file to create. + /// @param Contents The string to write to the file. + /// @param Unique If true, the file will be created using + /// llvm::sys::fs::createTemporaryFile. + TempFile(StringRef Name, StringRef Suffix = "", StringRef Contents = "", + bool Unique = false) { + std::error_code EC; + int fd; + if (Unique) { + EC = llvm::sys::fs::createTemporaryFile(Name, Suffix, fd, Path); + } else { + Path = Name; + if (!Suffix.empty()) { + Path.append("."); + Path.append(Suffix); + } + EC = llvm::sys::fs::openFileForWrite(Path, fd); + } + EXPECT_FALSE(EC); + raw_fd_ostream OS(fd, /*shouldClose*/ true); + OS << Contents; + OS.flush(); + EXPECT_FALSE(OS.error()); + if (EC || OS.error()) + Path.clear(); + } + ~TempFile() { + if (!Path.empty()) { + EXPECT_FALSE(llvm::sys::fs::remove(Path.str())); + } + } + + TempFile(const TempFile &) = delete; + TempFile &operator=(const TempFile &) = delete; + + TempFile(TempFile &&) = default; + TempFile &operator=(TempFile &&) = default; + + /// The path to the file. + StringRef path() const { return Path; } +}; + +} // namespace unittest +} // namespace llvm + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/WindowsResource/ResourceProcessor.h b/contrib/libs/llvm16/include/llvm/WindowsResource/ResourceProcessor.h new file mode 100644 index 0000000000..b2c81d9596 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/WindowsResource/ResourceProcessor.h @@ -0,0 +1,61 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- ResourceProcessor.h -------------------------------------*- C++-*-===// +// +// 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 +// +//===---------------------------------------------------------------------===// + +#ifndef LLVM_INCLUDE_LLVM_SUPPORT_WINDOWS_RESOURCE_PROCESSOR_H +#define LLVM_INCLUDE_LLVM_SUPPORT_WINDOWS_RESOURCE_PROCESSOR_H + +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/raw_ostream.h" + +#include <memory> +#include <vector> + + +namespace llvm { + +class WindowsResourceProcessor { +public: + using PathType = SmallVector<char, 64>; + + WindowsResourceProcessor() {} + + void addDefine(StringRef Key, StringRef Value = StringRef()) { + PreprocessorDefines.emplace_back(Key, Value); + } + void addInclude(const PathType &IncludePath) { + IncludeList.push_back(IncludePath); + } + void setVerbose(bool Verbose) { IsVerbose = Verbose; } + void setNullAtEnd(bool NullAtEnd) { AppendNull = NullAtEnd; } + + Error process(StringRef InputData, + std::unique_ptr<raw_fd_ostream> OutputStream); + +private: + StringRef InputData; + std::vector<PathType> IncludeList; + std::vector<std::pair<StringRef, StringRef>> PreprocessorDefines; + bool IsVerbose, AppendNull; +}; + +} + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/WindowsResource/ResourceScriptToken.h b/contrib/libs/llvm16/include/llvm/WindowsResource/ResourceScriptToken.h new file mode 100644 index 0000000000..42026a8328 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/WindowsResource/ResourceScriptToken.h @@ -0,0 +1,69 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- ResourceScriptToken.h -----------------------------------*- C++-*-===// +// +// 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 declares the .rc script tokens. +// The list of available tokens is located at ResourceScriptTokenList.h. +// +// Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa380599(v=vs.85).aspx +// +//===---------------------------------------------------------------------===// + +#ifndef LLVM_INCLUDE_LLVM_SUPPORT_WINDOWS_RESOURCE_SCRIPTTOKEN_H +#define LLVM_INCLUDE_LLVM_SUPPORT_WINDOWS_RESOURCE_SCRIPTTOKEN_H + +#include "llvm/ADT/StringRef.h" + +namespace llvm { + +// A definition of a single resource script token. Each token has its kind +// (declared in ResourceScriptTokenList) and holds a value - a reference +// representation of the token. +// RCToken does not claim ownership on its value. A memory buffer containing +// the token value should be stored in a safe place and cannot be freed +// nor reallocated. +class RCToken { +public: + enum class Kind { +#define TOKEN(Name) Name, +#define SHORT_TOKEN(Name, Ch) Name, +#include "ResourceScriptTokenList.h" +#undef TOKEN +#undef SHORT_TOKEN + }; + + RCToken(RCToken::Kind RCTokenKind, StringRef Value); + + // Get an integer value of the integer token. + uint32_t intValue() const; + bool isLongInt() const; + + StringRef value() const; + Kind kind() const; + + // Check if a token describes a binary operator. + bool isBinaryOp() const; + +private: + Kind TokenKind; + StringRef TokenValue; +}; + +} // namespace llvm + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/WindowsResource/ResourceScriptTokenList.h b/contrib/libs/llvm16/include/llvm/WindowsResource/ResourceScriptTokenList.h new file mode 100644 index 0000000000..3e19b83fe6 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/WindowsResource/ResourceScriptTokenList.h @@ -0,0 +1,45 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===-- ResourceScriptTokenList.h -------------------------------*- C++-*-===// +// +// 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 a part of llvm-rc tokens header. It lists all the possible tokens +// that might occur in a correct .rc script. +// +//===---------------------------------------------------------------------===// + + +// Long tokens. They might consist of more than one character. +TOKEN(Invalid) // Invalid token. Should not occur in a valid script. +TOKEN(Int) // Integer (decimal, octal or hexadecimal). +TOKEN(String) // String value. +TOKEN(Identifier) // Script identifier (resource name or type). + +// Short tokens. They usually consist of exactly one character. +// The definitions are of the form SHORT_TOKEN(TokenName, TokenChar). +// TokenChar is the one-character token representation occuring in the correct +// .rc scripts. +SHORT_TOKEN(BlockBegin, '{') // Start of the script block; can also be BEGIN. +SHORT_TOKEN(BlockEnd, '}') // End of the block; can also be END. +SHORT_TOKEN(Comma, ',') // Comma - resource arguments separator. +SHORT_TOKEN(Plus, '+') // Addition operator. +SHORT_TOKEN(Minus, '-') // Subtraction operator. +SHORT_TOKEN(Pipe, '|') // Bitwise-OR operator. +SHORT_TOKEN(Amp, '&') // Bitwise-AND operator. +SHORT_TOKEN(Tilde, '~') // Bitwise-NOT operator. +SHORT_TOKEN(LeftParen, '(') // Left parenthesis in the script expressions. +SHORT_TOKEN(RightParen, ')') // Right parenthesis. + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/XRay/FDRLogBuilder.h b/contrib/libs/llvm16/include/llvm/XRay/FDRLogBuilder.h new file mode 100644 index 0000000000..f851ffd98e --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/XRay/FDRLogBuilder.h @@ -0,0 +1,51 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- FDRLogBuilder.h - XRay FDR Log Building Utility --------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +#ifndef LLVM_XRAY_FDRLOGBUILDER_H +#define LLVM_XRAY_FDRLOGBUILDER_H + +#include "llvm/XRay/FDRRecords.h" + +namespace llvm { +namespace xray { + +/// The LogBuilder class allows for creating ad-hoc collections of records +/// through the `add<...>(...)` function. An example use of this API is in +/// crafting arbitrary sequences of records: +/// +/// auto Records = LogBuilder() +/// .add<BufferExtents>(256) +/// .add<NewBufferRecord>(1) +/// .consume(); +/// +class LogBuilder { + std::vector<std::unique_ptr<Record>> Records; + +public: + template <class R, class... T> LogBuilder &add(T &&... A) { + Records.emplace_back(new R(std::forward<T>(A)...)); + return *this; + } + + std::vector<std::unique_ptr<Record>> consume() { return std::move(Records); } +}; + +} // namespace xray +} // namespace llvm + +#endif // LLVM_XRAY_FDRLOGBUILDER_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif diff --git a/contrib/libs/llvm16/include/llvm/module.extern.modulemap b/contrib/libs/llvm16/include/llvm/module.extern.modulemap new file mode 100644 index 0000000000..8e726a3957 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/module.extern.modulemap @@ -0,0 +1,6 @@ +module LLVM_Extern_Config_Def {} +module LLVM_Extern_IR_Attributes_Gen {} +module LLVM_Extern_IR_Intrinsics_Gen {} +module LLVM_Extern_IR_Intrinsics_Enum {} +module LLVM_Extern_Utils_DataTypes {} +module LLVM_Extern_TargetParser_Gen {} diff --git a/contrib/libs/llvm16/include/llvm/module.modulemap b/contrib/libs/llvm16/include/llvm/module.modulemap new file mode 100644 index 0000000000..741e0a83b1 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/module.modulemap @@ -0,0 +1,462 @@ +module LLVM_Analysis { + requires cplusplus + umbrella "Analysis" + module * { export * } + + // This is intended for (repeated) textual inclusion. + textual header "Analysis/ScalarFuncs.def" + textual header "Analysis/TargetLibraryInfo.def" + textual header "Analysis/VecFuncs.def" +} + +module LLVM_AsmParser { + requires cplusplus + umbrella "AsmParser" + module * { export * } +} + +// A module covering CodeGen/ and Target/. These are intertwined +// and codependent, and thus notionally form a single module. +module LLVM_Backend { + requires cplusplus + + module CodeGen { + umbrella "CodeGen" + module * { export * } + + // Exclude these; they're intended to be included into only a single + // translation unit (or none) and aren't part of this module. + exclude header "CodeGen/LinkAllAsmWriterComponents.h" + exclude header "CodeGen/LinkAllCodegenComponents.h" + + // These are intended for (repeated) textual inclusion. + textual header "CodeGen/DIEValue.def" + textual header "CodeGen/MachinePassRegistry.def" + } +} + +// FIXME: Make this as a submodule of LLVM_Backend again. +// Doing so causes a linker error in clang-format. +module LLVM_Backend_Target { + umbrella "Target" + module * { export * } +} + +module LLVM_Bitcode { + requires cplusplus + umbrella "Bitcode" + module * { export * } +} + +module LLVM_Bitstream { + requires cplusplus + umbrella "Bitstream" + module * { export * } +} + +module LLVM_BinaryFormat { + requires cplusplus + umbrella "BinaryFormat" module * { export * } + textual header "BinaryFormat/Dwarf.def" + textual header "BinaryFormat/DXContainerConstants.def" + textual header "BinaryFormat/DynamicTags.def" + textual header "BinaryFormat/MachO.def" + textual header "BinaryFormat/MinidumpConstants.def" + textual header "BinaryFormat/Swift.def" + textual header "BinaryFormat/ELFRelocs/AArch64.def" + textual header "BinaryFormat/ELFRelocs/AMDGPU.def" + textual header "BinaryFormat/ELFRelocs/ARM.def" + textual header "BinaryFormat/ELFRelocs/ARC.def" + textual header "BinaryFormat/ELFRelocs/AVR.def" + textual header "BinaryFormat/ELFRelocs/BPF.def" + textual header "BinaryFormat/ELFRelocs/CSKY.def" + textual header "BinaryFormat/ELFRelocs/Hexagon.def" + textual header "BinaryFormat/ELFRelocs/i386.def" + textual header "BinaryFormat/ELFRelocs/Lanai.def" + textual header "BinaryFormat/ELFRelocs/LoongArch.def" + textual header "BinaryFormat/ELFRelocs/M68k.def" + textual header "BinaryFormat/ELFRelocs/Mips.def" + textual header "BinaryFormat/ELFRelocs/MSP430.def" + textual header "BinaryFormat/ELFRelocs/PowerPC64.def" + textual header "BinaryFormat/ELFRelocs/PowerPC.def" + textual header "BinaryFormat/ELFRelocs/RISCV.def" + textual header "BinaryFormat/ELFRelocs/Sparc.def" + textual header "BinaryFormat/ELFRelocs/SystemZ.def" + textual header "BinaryFormat/ELFRelocs/VE.def" + textual header "BinaryFormat/ELFRelocs/x86_64.def" + textual header "BinaryFormat/ELFRelocs/Xtensa.def" + textual header "BinaryFormat/WasmRelocs.def" + textual header "BinaryFormat/MsgPack.def" +} + +module LLVM_Config { + requires cplusplus + umbrella "Config" + extern module LLVM_Extern_Config_Def "module.extern.modulemap" + module * { export * } +} + +module LLVM_DebugInfo { + requires cplusplus + module DIContext { header "DebugInfo/DIContext.h" export * } +} + +module LLVM_DebugInfo_DWARF { + requires cplusplus + + umbrella "DebugInfo/DWARF" + module * { export * } +} + +module LLVM_DebugInfo_PDB { + requires cplusplus + + umbrella "DebugInfo/PDB" + module * { export * } + + // Separate out this subdirectory; it's an optional component that depends on + // a separate library which might not be available. + // + // FIXME: There should be a better way to specify this. + exclude header "DebugInfo/PDB/DIA/DIADataStream.h" + exclude header "DebugInfo/PDB/DIA/DIAEnumDebugStreams.h" + exclude header "DebugInfo/PDB/DIA/DIAEnumFrameData.h" + exclude header "DebugInfo/PDB/DIA/DIAEnumInjectedSources.h" + exclude header "DebugInfo/PDB/DIA/DIAEnumLineNumbers.h" + exclude header "DebugInfo/PDB/DIA/DIAEnumSectionContribs.h" + exclude header "DebugInfo/PDB/DIA/DIAEnumSourceFiles.h" + exclude header "DebugInfo/PDB/DIA/DIAEnumSymbols.h" + exclude header "DebugInfo/PDB/DIA/DIAEnumTables.h" + exclude header "DebugInfo/PDB/DIA/DIAError.h" + exclude header "DebugInfo/PDB/DIA/DIAFrameData.h" + exclude header "DebugInfo/PDB/DIA/DIAInjectedSource.h" + exclude header "DebugInfo/PDB/DIA/DIALineNumber.h" + exclude header "DebugInfo/PDB/DIA/DIARawSymbol.h" + exclude header "DebugInfo/PDB/DIA/DIASectionContrib.h" + exclude header "DebugInfo/PDB/DIA/DIASession.h" + exclude header "DebugInfo/PDB/DIA/DIASourceFile.h" + exclude header "DebugInfo/PDB/DIA/DIASupport.h" + exclude header "DebugInfo/PDB/DIA/DIATable.h" + exclude header "DebugInfo/PDB/DIA/DIAUtils.h" +} + +module LLVM_DebugInfo_PDB_DIA { + requires cplusplus + + umbrella "DebugInfo/PDB/DIA" + module * { export * } +} + +module LLVM_DebugInfo_MSF { + requires cplusplus + + umbrella "DebugInfo/MSF" + module * { export * } +} + +module LLVM_DebugInfo_CodeView { + requires cplusplus + + umbrella "DebugInfo/CodeView" + module * { export * } + + // These are intended for (repeated) textual inclusion. + textual header "DebugInfo/CodeView/CodeViewRegisters.def" + textual header "DebugInfo/CodeView/CodeViewTypes.def" + textual header "DebugInfo/CodeView/CodeViewSymbols.def" +} + +module LLVM_DWARFLinker { + requires cplusplus + + umbrella "DWARFLinker" + module * { export * } +} + +module LLVM_ExecutionEngine { + requires cplusplus + + umbrella "ExecutionEngine" + module * { export * } + + // Exclude this; it's an optional component of the ExecutionEngine. + exclude header "ExecutionEngine/OProfileWrapper.h" + + // Exclude these; they're intended to be included into only a single + // translation unit (or none) and aren't part of this module. + exclude header "ExecutionEngine/MCJIT.h" + exclude header "ExecutionEngine/Interpreter.h" + + // Exclude headers from LLVM_OrcSupport. + exclude header "ExecutionEngine/Orc/Shared/OrcError.h" +} + +module LLVM_FileCheck { + requires cplusplus + + umbrella "FileCheck" + module * { export * } +} + +module LLVM_Frontend_OpenMP { + requires cplusplus + + umbrella "Frontend/OpenMP" + module * { export * } + + exclude header "Frontend/OpenMP/OMPKinds.def" +} + +// Orc utilities that don't depend only on Support (not ExecutionEngine or +// IR). This is a workaround for ExecutionEngine's broken layering, and will +// be removed in the future. +module LLVM_OrcSupport { + requires cplusplus + + header "ExecutionEngine/Orc/Shared/OrcError.h" + + export * +} + +module LLVM_Pass { + module Pass { + // PassSupport.h and PassAnalysisSupport.h are made available only through + // Pass.h. + header "Pass.h" + textual header "PassSupport.h" + textual header "PassAnalysisSupport.h" + export * + } + + module PassRegistry { header "PassRegistry.h" export * } + module InitializePasses { header "InitializePasses.h" export * } +} + +module LLVM_intrinsic_gen { + requires cplusplus + + // Delay building the modules containing dependencies to Attributes.h and + // Intrinsics.h because they need to be generated by tablegen first. + + // Attributes.h + module IR_Argument { header "IR/Argument.h" export * } + module IR_Attributes { + header "IR/Attributes.h" + extern module LLVM_Extern_IR_Attributes_Gen "module.extern.modulemap" + export * + } + module IR_AbstractCallSite { header "IR/AbstractCallSite.h" export * } + module IR_ConstantFold { header "IR/ConstantFold.h" export * } + module IR_ConstantFolder { header "IR/ConstantFolder.h" export * } + module IR_GlobalVariable { header "IR/GlobalVariable.h" export * } + module IR_NoFolder { header "IR/NoFolder.h" export * } + module IRBuilderFolder { header "IR/IRBuilderFolder.h" export * } + module IR_Module { header "IR/Module.h" export * } + module IR_ModuleSummaryIndex { header "IR/ModuleSummaryIndex.h" export * } + module IR_ModuleSummaryIndexYAML { header "IR/ModuleSummaryIndexYAML.h" export * } + module IR_Function { header "IR/Function.h" export * } + module IR_InstrTypes { header "IR/InstrTypes.h" export * } + module IR_Instructions { header "IR/Instructions.h" export * } + module IR_TypeFinder { header "IR/TypeFinder.h" export * } + module IR_VectorBuilder { header "IR/VectorBuilder.h" export * } + + + // Intrinsics.h + module IR_CFG { header "IR/CFG.h" export * } + module IR_ConstantRange { header "IR/ConstantRange.h" export * } + module IR_Dominators { header "IR/Dominators.h" export * } + module IR_FixedPointBuilder { header "IR/FixedPointBuilder.h" export * } + module Analysis_PostDominators { header "Analysis/PostDominators.h" export * } + module Analysis_DomTreeUpdater { header "Analysis/DomTreeUpdater.h" export * } + module IR_IRBuilder { header "IR/IRBuilder.h" export * } + module IR_IRPrintingPasses { header "IR/IRPrintingPasses.h" export * } + module IR_MatrixBuilder { header "IR/MatrixBuilder.h" export * } + module IR_PassManager { header "IR/PassManager.h" export * } + module IR_PassManagerImpl { header "IR/PassManagerImpl.h" export * } + module IR_PredIteratorCache { header "IR/PredIteratorCache.h" export * } + module IR_Verifier { header "IR/Verifier.h" export * } + module IR_InstIterator { header "IR/InstIterator.h" export * } + module IR_InstVisitor { header "IR/InstVisitor.h" export * } + module IR_Intrinsics { + header "IR/Intrinsics.h" + extern module LLVM_Extern_IR_Intricsics_Gen "module.extern.modulemap" + extern module LLVM_Extern_IR_Intrinsics_Enum "module.extern.modulemap" + export * + } + module IR_IntrinsicInst { header "IR/IntrinsicInst.h" export * } + module IR_PatternMatch { header "IR/PatternMatch.h" export * } + module IR_SafepointIRVerifier { header "IR/SafepointIRVerifier.h" export * } + module IR_Statepoint { header "IR/Statepoint.h" export * } + module IR_DebugInfo { header "IR/DebugInfo.h" export * } + + export * +} + +module LLVM_IR { + requires cplusplus + + umbrella "IR" + module * { export * } + + // These are intended for (repeated) textual inclusion. + textual header "IR/ConstrainedOps.def" + textual header "IR/DebugInfoFlags.def" + textual header "IR/Instruction.def" + textual header "IR/Metadata.def" + textual header "IR/FixedMetadataKinds.def" + textual header "IR/Value.def" + textual header "IR/VPIntrinsics.def" + textual header "IR/RuntimeLibcalls.def" +} + +module LLVM_IRReader { + requires cplusplus + umbrella "IRReader" + module * { export * } +} + +module LLVM_LineEditor { + requires cplusplus + umbrella "LineEditor" + module * { export * } +} + +module LLVM_LTO { + requires cplusplus + umbrella "LTO" + module * { export * } +} + +module LLVM_MC { + requires cplusplus + + umbrella "MC" + module * { export * } +} + +// Used by llvm-tblgen +module LLVM_MC_TableGen { + requires cplusplus + module MC_LaneBitmask { header "MC/LaneBitmask.h" export * } + module MC_InstrItineraries { header "MC/MCInstrItineraries.h" export * } + module MC_Schedule { header "MC/MCSchedule.h" export * } + module MC_SubtargetFeature { header "MC/SubtargetFeature.h" export * } +} + +module LLVM_Object { + requires cplusplus + umbrella "Object" + module * { export * } +} + +module LLVM_Option { + requires cplusplus + umbrella "Option" + module * { export * } +} + +module LLVM_ProfileData { + requires cplusplus + + umbrella "ProfileData" + module * { export * } + + textual header "ProfileData/InstrProfData.inc" + textual header "ProfileData/MemProfData.inc" + textual header "ProfileData/MIBEntryDef.inc" +} + +// FIXME: Mislayered? +module LLVM_Support_TargetRegistry { + requires cplusplus + header "Support/TargetRegistry.h" + export * +} + +module LLVM_TableGen { + requires cplusplus + umbrella "TableGen" + module * { export * } +} + +module LLVM_Transforms { + requires cplusplus + umbrella "Transforms" + + module * { export * } + + // Requires DEBUG_TYPE to be defined by including file. + exclude header "Transforms/Utils/InstructionWorklist.h" +} + +extern module LLVM_Extern_Utils_DataTypes "module.extern.modulemap" + +// Build the module with the tablegen-generated files needed by the +// TargetParser module before building the TargetParser module itself. +module TargetParserGen { + module RISCVTargetParserDef { + header "TargetParser/RISCVTargetParser.h" + extern module LLVM_Extern_TargetParser_Gen "module.extern.modulemap" + export * + } +} + +// A module covering ADT/ and Support/. These are intertwined and +// codependent, and notionally form a single module. +module LLVM_Utils { + module ADT { + requires cplusplus + + umbrella "ADT" + module * { export * } + } + + module Support { + requires cplusplus + + umbrella "Support" + module * { export * } + + // Exclude this; it should only be used on Windows. + exclude header "Support/Windows/WindowsSupport.h" + + // Exclude these; they are fundamentally non-modular. + exclude header "Support/PluginLoader.h" + exclude header "Support/Solaris/sys/regset.h" + textual header "Support/TargetOpcodes.def" + + } + + module TargetParser { + requires cplusplus + + umbrella "TargetParser" + module * { export * } + + // These are intended for textual inclusion. + textual header "TargetParser/ARMTargetParser.def" + textual header "TargetParser/CSKYTargetParser.def" + textual header "TargetParser/X86TargetParser.def" + textual header "TargetParser/LoongArchTargetParser.def" + } + + // This part of the module is usable from both C and C++ code. + module ConvertUTF { + header "Support/ConvertUTF.h" + export * + } +} + +// This is used for a $src == $build compilation. Otherwise we use +// LLVM_Support_DataTypes_Build, defined in a module map that is +// copied into the build area. +module LLVM_Support_DataTypes_Src { + header "llvm/Support/DataTypes.h" + export * +} + +module LLVM_WindowsManifest { + requires cplusplus + umbrella "WindowsManifest" + module * { export * } +} diff --git a/contrib/libs/llvm16/include/llvm/module.modulemap.build b/contrib/libs/llvm16/include/llvm/module.modulemap.build new file mode 100644 index 0000000000..162a262a00 --- /dev/null +++ b/contrib/libs/llvm16/include/llvm/module.modulemap.build @@ -0,0 +1,13 @@ +// This is copied into the build area for a $src != $build compilation. +module LLVM_Support_DataTypes { + header "Support/DataTypes.h" + export * +} +module LLVM_Config_ABI_Breaking { + header "Config/abi-breaking.h" + export * +} +module LLVM_Config_Config { + header "Config/llvm-config.h" + export * +} |