LLVM 24.0.0git
Mangler.cpp
Go to the documentation of this file.
1//===------------- Mangler.cpp -- Linker name mangling for ORC ------------===//
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
13
14#include <cassert>
15
16#define DEBUG_TYPE "orc"
17
18namespace llvm::orc {
19
20Mangler::Mode Mangler::fromDataLayoutStr(StringRef DLStr) {
21 for (StringRef Spec : split(DLStr, '-')) {
22 if (!Spec.starts_with("m:"))
23 continue;
24 auto ModeStr = Spec.drop_front(2);
25 assert(ModeStr.size() == 1 &&
26 "invalid data layout string from Triple::computeDataLayout");
27 switch (ModeStr[0]) {
28 case 'e':
29 return Mode::ELF;
30 case 'l':
31 return Mode::GOFF;
32 case 'o':
33 return Mode::MachO;
34 case 'm':
35 return Mode::Mips;
36 case 'w':
37 return Mode::WinCOFF;
38 case 'x':
39 return Mode::WinCOFFX86;
40 case 'a':
41 return Mode::XCOFF;
42 default:
43 llvm_unreachable("Invalid mangling mode from Triple::computeDataLayout");
44 }
45 }
46 return Mode::None;
47}
48
49Mangler::Mode Mangler::fromTriple(const Triple &TT, StringRef ABIName) {
50 return fromDataLayoutStr(TT.computeDataLayout(ABIName));
51}
52
53} // namespace llvm::orc
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains some functions that are useful when dealing with strings.
Mode
The linker name-mangling scheme for a target, determined by its object format.
Definition Mangler.h:33
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
iterator_range< SplittingIterator > split(StringRef Str, StringRef Separator)
Split the specified string over a separator and return a range-compatible iterable over its partition...