summaryrefslogtreecommitdiff
path: root/lib/SPIRV/Mangler/NameMangleAPI.h
blob: c80ec69c0f42cf2976efac62fd53e56f59190704 (plain)
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
//===------------------------- NameMangleAPI.h ---------------------------===//
//
//                              SPIR Tools
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
/*
 * Contributed by: Intel Corporation.
 */
#ifndef SPIRV_MANGLER_NAMEMANGLEAPI_H
#define SPIRV_MANGLER_NAMEMANGLEAPI_H

#include "FunctionDescriptor.h"
#include <string>

namespace SPIR {
struct NameMangler {

  /// @brief Constructor.
  /// @param SPIRversion spir version to mangle according to.
  NameMangler(SPIRversion);

  /// @brief Converts the given function descriptor to string that represents
  ///        the function's prototype.
  ///        The mangling algorithm is based on Itanium mangling algorithm
  ///        (http://sourcery.mentor.com/public/cxx-abi/abi.html#mangling), with
  ///        SPIR extensions.
  /// @param FunctionDescriptor function to be mangled.
  /// @param std::string the mangled name if the mangling succeeds,
  ///        the error otherwise.
  /// @return MangleError enum representing the status - success or the error.
  MangleError mangle(const FunctionDescriptor &, std::string &);

private:
  SPIRversion Spir_version;
};
} // namespace SPIR

#endif // SPIRV_MANGLER_NAMEMANGLEAPI_H