| 1 |
//===----------------------- FunctionDescriptor.h ------------------------===// |
| 2 |
// |
| 3 |
// SPIR Tools |
| 4 |
// |
| 5 |
// This file is distributed under the University of Illinois Open Source |
| 6 |
// License. See LICENSE.TXT for details. |
| 7 |
// |
| 8 |
//===---------------------------------------------------------------------===// |
| 9 |
/* |
| 10 |
* Contributed by: Intel Corporation. |
| 11 |
*/ |
| 12 |
|
| 13 |
#ifndef SPIRV_MANGLER_FUNCTIONDESCRIPTOR_H |
| 14 |
#define SPIRV_MANGLER_FUNCTIONDESCRIPTOR_H |
| 15 |
|
| 16 |
#include "ParameterType.h" |
| 17 |
#include "Refcount.h" |
| 18 |
#include <string> |
| 19 |
#include <vector> |
| 20 |
|
| 21 |
namespace SPIR { |
| 22 |
typedef std::vector<RefCount<ParamType>> TypeVector; |
| 23 |
|
| 24 |
struct FunctionDescriptor { |
| 25 |
/// @brief Returns a human readable string representation of the function's |
| 26 |
/// prototype. |
| 27 |
/// @returns std::string representing the function's prototype. |
| 28 |
std::string toString() const; |
| 29 |
|
| 30 |
/// The name of the function (stripped). |
| 31 |
std::string Name; |
| 32 |
/// Parameter list of the function. |
| 33 |
TypeVector Parameters; |
| 34 |
|
| 35 |
bool operator==(const FunctionDescriptor &) const; |
| 36 |
|
| 37 |
/// @brief Enables function descriptors to serve as keys in stl maps. |
| 38 |
bool operator<(const FunctionDescriptor &) const; |
| 39 |
bool isNull() const; |
| 40 |
|
| 41 |
/// @brief Create a singular value, that represents a 'null' |
| 42 |
/// FunctionDescriptor. |
| 43 |
static FunctionDescriptor null(); |
| 44 |
|
| 45 |
static std::string nullString(); |
| 46 |
}; |
| 47 |
|
| 48 |
template <typename T> |
| 49 |
std::ostream &operator<<(T &O, const SPIR::FunctionDescriptor &Fd) { |
| 50 |
O << Fd.toString(); |
| 51 |
return O; |
| 52 |
} |
| 53 |
} // namespace SPIR |
| 54 |
|
| 55 |
#endif // SPIRV_MANGLER_FUNCTIONDESCRIPTOR_H |