Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:54

0001 //===------ Mangling.h -- Name Mangling Utilities for ORC -------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // Name mangling utilities for ORC.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_EXECUTIONENGINE_ORC_MANGLING_H
0014 #define LLVM_EXECUTIONENGINE_ORC_MANGLING_H
0015 
0016 #include "llvm/ExecutionEngine/Orc/Core.h"
0017 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
0018 #include "llvm/IR/Module.h"
0019 #include "llvm/Support/MemoryBuffer.h"
0020 
0021 namespace llvm {
0022 namespace orc {
0023 
0024 /// Mangles symbol names then uniques them in the context of an
0025 /// ExecutionSession.
0026 class MangleAndInterner {
0027 public:
0028   MangleAndInterner(ExecutionSession &ES, const DataLayout &DL);
0029   SymbolStringPtr operator()(StringRef Name);
0030 
0031 private:
0032   ExecutionSession &ES;
0033   const DataLayout &DL;
0034 };
0035 
0036 /// Maps IR global values to their linker symbol names / flags.
0037 ///
0038 /// This utility can be used when adding new IR globals in the JIT.
0039 class IRSymbolMapper {
0040 public:
0041   struct ManglingOptions {
0042     bool EmulatedTLS = false;
0043   };
0044 
0045   using SymbolNameToDefinitionMap = std::map<SymbolStringPtr, GlobalValue *>;
0046 
0047   /// Add mangled symbols for the given GlobalValues to SymbolFlags.
0048   /// If a SymbolToDefinitionMap pointer is supplied then it will be populated
0049   /// with Name-to-GlobalValue* mappings. Note that this mapping is not
0050   /// necessarily one-to-one: thread-local GlobalValues, for example, may
0051   /// produce more than one symbol, in which case the map will contain duplicate
0052   /// values.
0053   static void add(ExecutionSession &ES, const ManglingOptions &MO,
0054                   ArrayRef<GlobalValue *> GVs, SymbolFlagsMap &SymbolFlags,
0055                   SymbolNameToDefinitionMap *SymbolToDefinition = nullptr);
0056 };
0057 
0058 } // End namespace orc
0059 } // End namespace llvm
0060 
0061 #endif // LLVM_EXECUTIONENGINE_ORC_MANGLING_H