DPC++ Runtime
Runtime libraries for oneAPI DPC++
fpga_datapath.hpp
Go to the documentation of this file.
1 //==----------- fpga_datapath.hpp - SYCL fpga_datapath extension -----------==//
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 #pragma once
10 
11 #include <sycl/access/access.hpp> // for address_space
12 #include <sycl/exception.hpp> // for make_error_code
13 
14 namespace sycl {
15 inline namespace _V1 {
16 namespace ext::intel::experimental {
17 
18 template <typename T>
19 class
20 // Annotation when object is instantiated in global scope
21 #ifdef __SYCL_DEVICE_ONLY__
22  [[__sycl_detail__::add_ir_attributes_global_variable("sycl-datapath", "")]]
23 #endif
25 protected:
26  T val
27 #ifdef __SYCL_DEVICE_ONLY__
28  // Annotation when object is instantiated in function scope
29  [[__sycl_detail__::add_ir_annotations_member("sycl-datapath", "")]]
30 #endif
31  ;
32 
33 public:
34  // All the initialization
35  // constexpr is used as a hint to the compiler to try and evaluate the
36  // constructor at compile-time
37  template <typename... S> constexpr fpga_datapath(S... args) : val{args...} {}
38 
39  fpga_datapath() = default;
40 
41  fpga_datapath(const fpga_datapath &) = default;
43  fpga_datapath &operator=(const fpga_datapath &) = default;
45 
46  T &get() noexcept { return val; }
47 
48  constexpr const T &get() const noexcept { return val; }
49 
50  // Allows for implicit conversion from this to T
51  operator T &() noexcept { return get(); }
52 
53  // Allows for implicit conversion from this to T
54  constexpr operator const T &() const noexcept { return get(); }
55 
56  fpga_datapath &operator=(const T &newValue) noexcept {
57  val = newValue;
58  return *this;
59  }
60 
61  // Note that there is no need for "fpga_datapath" to define member functions
62  // for operators like "++", "[]", "->", comparison, etc. Instead, the type
63  // "T" need only define these operators as non-member functions. Because
64  // there is an implicit conversion from "fpga_datapath" to "T&".
65 };
66 
67 } // namespace ext::intel::experimental
68 } // namespace _V1
69 } // namespace sycl
fpga_datapath & operator=(const T &newValue) noexcept
fpga_datapath & operator=(fpga_datapath &&)=default
fpga_datapath(const fpga_datapath &)=default
constexpr const T & get() const noexcept
fpga_datapath & operator=(const fpga_datapath &)=default
pointer get() const
Definition: multi_ptr.hpp:544
Definition: access.hpp:18
_Abi const simd< _Tp, _Abi > & noexcept
Definition: simd.hpp:1324