LLVM 24.0.0git
OMPVersion.h
Go to the documentation of this file.
1//===-- OMPVersion.h - OpenMP version definition ------------------ C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains the core set of OpenMP definitions and declarations.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_FRONTEND_OPENMP_OMPVERSION_H
14#define LLVM_FRONTEND_OPENMP_OMPVERSION_H
15
17
18namespace llvm {
19namespace omp {
20struct Version {
22 constexpr explicit Version(value_type Ver = 0) : V(Ver) {}
23 constexpr explicit operator value_type() const { return V; }
24 constexpr explicit operator bool() const { return V != 0; }
25
26 friend constexpr bool operator<(Version A, Version B);
27 friend constexpr bool operator==(Version A, Version B);
28
29private:
30 value_type V;
31};
32
33inline constexpr bool operator==(Version A, Version B) { return A.V == B.V; }
34inline constexpr bool operator!=(Version A, Version B) { return !(A == B); }
35inline constexpr bool operator<(Version A, Version B) { return A.V < B.V; }
36inline constexpr bool operator<=(Version A, Version B) {
37 return A < B || A == B;
38}
39inline constexpr bool operator>(Version A, Version B) { return !(A <= B); }
40inline constexpr bool operator>=(Version A, Version B) { return !(A < B); }
41
42inline constexpr bool operator==(Version A, int B) { return A == Version(B); }
43inline constexpr bool operator!=(Version A, int B) { return A != Version(B); }
44inline constexpr bool operator<(Version A, int B) { return A < Version(B); }
45inline constexpr bool operator<=(Version A, int B) { return A <= Version(B); }
46inline constexpr bool operator>(Version A, int B) { return A > Version(B); }
47inline constexpr bool operator>=(Version A, int B) { return A >= Version(B); }
48} // namespace omp
49
50template <> struct DenseMapInfo<omp::Version> {
51 static unsigned getHashValue(omp::Version V) {
52 using UnderlyingTy = omp::Version::value_type;
54 static_cast<UnderlyingTy>(V));
55 }
56 static bool isEqual(omp::Version LHS, omp::Version RHS) { return LHS == RHS; }
57};
58} // namespace llvm
59
60#endif // LLVM_FRONTEND_OPENMP_OMPVERSION_H
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file defines DenseMapInfo traits for DenseMap.
Value * RHS
Value * LHS
constexpr bool operator>(Version A, Version B)
Definition OMPVersion.h:39
constexpr bool operator<(Version A, Version B)
Definition OMPVersion.h:35
constexpr bool operator<=(Version A, Version B)
Definition OMPVersion.h:36
constexpr bool operator>=(Version A, Version B)
Definition OMPVersion.h:40
constexpr bool operator!=(Version A, Version B)
Definition OMPVersion.h:34
constexpr bool operator==(Version A, Version B)
Definition OMPVersion.h:33
This is an optimization pass for GlobalISel generic memory operations.
static bool isEqual(omp::Version LHS, omp::Version RHS)
Definition OMPVersion.h:56
static unsigned getHashValue(omp::Version V)
Definition OMPVersion.h:51
An information struct used to provide DenseMap with the various necessary components for a given valu...
unsigned value_type
Definition OMPVersion.h:21
friend constexpr bool operator<(Version A, Version B)
Definition OMPVersion.h:35
friend constexpr bool operator==(Version A, Version B)
Definition OMPVersion.h:33
constexpr Version(value_type Ver=0)
Definition OMPVersion.h:22