LLVM  15.0.0git
Mangling.h
Go to the documentation of this file.
1 //===------ Mangling.h -- Name Mangling Utilities for ORC -------*- C++ -*-===//
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 // Name mangling utilities for ORC.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_EXECUTIONENGINE_ORC_MANGLING_H
14 #define LLVM_EXECUTIONENGINE_ORC_MANGLING_H
15 
18 #include "llvm/IR/Module.h"
20 
21 namespace llvm {
22 namespace orc {
23 
24 /// Mangles symbol names then uniques them in the context of an
25 /// ExecutionSession.
27 public:
30 
31 private:
32  ExecutionSession &ES;
33  const DataLayout &DL;
34 };
35 
36 /// Maps IR global values to their linker symbol names / flags.
37 ///
38 /// This utility can be used when adding new IR globals in the JIT.
40 public:
41  struct ManglingOptions {
42  bool EmulatedTLS = false;
43  };
44 
45  using SymbolNameToDefinitionMap = std::map<SymbolStringPtr, GlobalValue *>;
46 
47  /// Add mangled symbols for the given GlobalValues to SymbolFlags.
48  /// If a SymbolToDefinitionMap pointer is supplied then it will be populated
49  /// with Name-to-GlobalValue* mappings. Note that this mapping is not
50  /// necessarily one-to-one: thread-local GlobalValues, for example, may
51  /// produce more than one symbol, in which case the map will contain duplicate
52  /// values.
53  static void add(ExecutionSession &ES, const ManglingOptions &MO,
55  SymbolNameToDefinitionMap *SymbolToDefinition = nullptr);
56 };
57 
58 } // End namespace orc
59 } // End namespace llvm
60 
61 #endif // LLVM_EXECUTIONENGINE_ORC_MANGLING_H
llvm::orc::IRSymbolMapper::add
static void add(ExecutionSession &ES, const ManglingOptions &MO, ArrayRef< GlobalValue * > GVs, SymbolFlagsMap &SymbolFlags, SymbolNameToDefinitionMap *SymbolToDefinition=nullptr)
Add mangled symbols for the given GlobalValues to SymbolFlags.
Definition: Mangling.cpp:31
MemoryBuffer.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:113
llvm::orc::IRSymbolMapper::SymbolNameToDefinitionMap
std::map< SymbolStringPtr, GlobalValue * > SymbolNameToDefinitionMap
Definition: Mangling.h:45
llvm::orc::SymbolStringPtr
Pointer to a pooled string representing a symbol name.
Definition: SymbolStringPool.h:50
ThreadSafeModule.h
Module.h
llvm::orc::MangleAndInterner::MangleAndInterner
MangleAndInterner(ExecutionSession &ES, const DataLayout &DL)
Definition: Mangling.cpp:19
llvm::MachO::SymbolFlags
SymbolFlags
Symbol flags.
Definition: Symbol.h:24
llvm::orc::IRSymbolMapper
Maps IR global values to their linker symbol names / flags.
Definition: Mangling.h:39
llvm::DenseMap< SymbolStringPtr, JITSymbolFlags >
llvm::orc::IRSymbolMapper::ManglingOptions::EmulatedTLS
bool EmulatedTLS
Definition: Mangling.h:42
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::orc::MangleAndInterner::operator()
SymbolStringPtr operator()(StringRef Name)
Definition: Mangling.cpp:22
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::orc::MangleAndInterner
Mangles symbol names then uniques them in the context of an ExecutionSession.
Definition: Mangling.h:26
llvm::orc::IRSymbolMapper::ManglingOptions
Definition: Mangling.h:41
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
llvm::orc::ExecutionSession
An ExecutionSession represents a running JIT program.
Definition: Core.h:1362
Core.h