LLVM 24.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"
22
23namespace llvm::orc {
24
25/// Mangles symbol names then uniques them in the context of an
26/// ExecutionSession.
28public:
39
44
45private:
46 static ManglingMode fromDataLayoutStr(StringRef DLStr);
47 static ManglingMode fromTriple(const Triple &TT, StringRef ABIName);
48 static ManglingMode fromDataLayout(const DataLayout &DL);
49 bool doNotMangleLeadingQuestionMark() const;
50
52 ManglingMode Mode;
53};
54
55/// Maps IR global values to their linker symbol names / flags.
56///
57/// This utility can be used when adding new IR globals in the JIT.
59public:
61 bool EmulatedTLS = false;
62 };
63
64 using SymbolNameToDefinitionMap = std::map<SymbolStringPtr, GlobalValue *>;
65
66 /// Add mangled symbols for the given GlobalValues to SymbolFlags.
67 /// If a SymbolToDefinitionMap pointer is supplied then it will be populated
68 /// with Name-to-GlobalValue* mappings. Note that this mapping is not
69 /// necessarily one-to-one: thread-local GlobalValues, for example, may
70 /// produce more than one symbol, in which case the map will contain duplicate
71 /// values.
72 LLVM_ABI static void
75 SymbolNameToDefinitionMap *SymbolToDefinition = nullptr);
76};
77
78} // namespace llvm::orc
79
80#endif // LLVM_EXECUTIONENGINE_ORC_MANGLING_H
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define LLVM_ABI
Definition Compiler.h:215
Module.h This file contains the declarations for the Module class.
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
An ExecutionSession represents a running JIT program.
Definition Core.h:1111
Maps IR global values to their linker symbol names / flags.
Definition Mangling.h:58
static LLVM_ABI 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:96
std::map< SymbolStringPtr, GlobalValue * > SymbolNameToDefinitionMap
Definition Mangling.h:64
LLVM_ABI SymbolStringPtr operator()(StringRef Name)
Definition Mangling.cpp:36
LLVM_ABI MangleAndInterner(ExecutionSession &ES, StringRef ABIName="")
Definition Mangling.cpp:20
Pointer to a pooled string representing a symbol name.
DenseMap< SymbolStringPtr, JITSymbolFlags > SymbolFlagsMap
A map from symbol names (as SymbolStringPtrs) to JITSymbolFlags.