-
Notifications
You must be signed in to change notification settings - Fork 822
Expand file tree
/
Copy pathHostPipes.h
More file actions
59 lines (48 loc) · 1.83 KB
/
HostPipes.h
File metadata and controls
59 lines (48 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//===------- HostPipes.h - get required info about FPGA Host Pipes --------===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// The file contains a number of functions to extract corresponding attributes
// of the host pipe global variables and save them as a property set for the
// runtime.
//===----------------------------------------------------------------------===//
#pragma once
#include "llvm/ADT/MapVector.h"
#include <cstdint>
#include <vector>
namespace llvm {
class GlobalVariable;
class Module;
class StringRef;
// Represents a host pipe variable - at SYCL RT level host pipe
// variables are being represented as a byte-array.
struct HostPipeProperty {
HostPipeProperty(uint32_t Size) : Size(Size) {}
// Encodes size of the underlying type T of the host pipe variable.
uint32_t Size;
};
using HostPipePropertyMapTy =
MapVector<StringRef, std::vector<HostPipeProperty>>;
/// Return \c true if the variable @GV is a host pipe variable.
///
/// The function checks whether the variable has the LLVM IR attribute \c
/// sycl-host-pipe
/// @param GV [in] A variable to test.
///
/// @return \c true if the variable is a host pipe variable, \c false
/// otherwise.
bool isHostPipeVariable(const GlobalVariable &GV);
/// Searches given module for occurrences of host pipe variable-specific
/// metadata and builds "host pipe variable name" ->
/// vector<"variable properties"> map.
///
/// @param M [in] LLVM Module.
///
/// @returns the "host pipe variable name" -> vector<"variable properties">
/// map.
HostPipePropertyMapTy collectHostPipeProperties(const Module &M);
} // end namespace llvm