003 File Manager
Current Path:
/usr/src/contrib/llvm-project/llvm/include/llvm/Transforms/Utils
usr
/
src
/
contrib
/
llvm-project
/
llvm
/
include
/
llvm
/
Transforms
/
Utils
/
📁
..
📄
AMDGPUEmitPrintf.h
(864 B)
📄
ASanStackFrameLayout.h
(3.51 KB)
📄
AddDiscriminators.h
(1.04 KB)
📄
AssumeBundleBuilder.h
(2.29 KB)
📄
BasicBlockUtils.h
(20.81 KB)
📄
BreakCriticalEdges.h
(1.16 KB)
📄
BuildLibCalls.h
(9.67 KB)
📄
BypassSlowDivision.h
(2.55 KB)
📄
CallGraphUpdater.h
(3.84 KB)
📄
CallPromotionUtils.h
(3.41 KB)
📄
CanonicalizeAliases.h
(998 B)
📄
CanonicalizeFreezeInLoops.h
(1.15 KB)
📄
Cloning.h
(12.34 KB)
📄
CodeExtractor.h
(9.58 KB)
📄
CodeMoverUtils.h
(2.85 KB)
📄
CtorUtils.h
(1021 B)
📄
Debugify.h
(3.36 KB)
📄
EntryExitInstrumenter.h
(1.16 KB)
📄
EscapeEnumerator.h
(1.56 KB)
📄
Evaluator.h
(4.69 KB)
📄
FunctionComparator.h
(17.12 KB)
📄
FunctionImportUtils.h
(5.73 KB)
📄
GlobalStatus.h
(2.97 KB)
📄
GuardUtils.h
(1.92 KB)
📄
ImportedFunctionsInliningStatistics.h
(4.35 KB)
📄
InjectTLIMappings.h
(1.27 KB)
📄
IntegerDivision.h
(2.88 KB)
📄
LCSSA.h
(1.56 KB)
📄
LibCallsShrinkWrap.h
(908 B)
📄
Local.h
(24.77 KB)
📄
LoopRotationUtils.h
(1.54 KB)
📄
LoopSimplify.h
(2.85 KB)
📄
LoopUtils.h
(21.25 KB)
📄
LoopVersioning.h
(5.87 KB)
📄
LowerInvoke.h
(1.08 KB)
📄
LowerMemIntrinsics.h
(2.14 KB)
📄
Mem2Reg.h
(921 B)
📄
MisExpect.h
(1.81 KB)
📄
ModuleUtils.h
(5.04 KB)
📄
NameAnonGlobals.h
(1.03 KB)
📄
PredicateInfo.h
(7.76 KB)
📄
PromoteMemToReg.h
(1.57 KB)
📄
SSAUpdater.h
(6.12 KB)
📄
SSAUpdaterBulk.h
(3.18 KB)
📄
SSAUpdaterImpl.h
(15.75 KB)
📄
SanitizerStats.h
(1.53 KB)
📄
ScalarEvolutionExpander.h
(17.87 KB)
📄
SimplifyIndVar.h
(2.12 KB)
📄
SimplifyLibCalls.h
(10.85 KB)
📄
SizeOpts.h
(4.84 KB)
📄
SplitModule.h
(1.53 KB)
📄
SymbolRewriter.h
(5.02 KB)
📄
UnifyFunctionExitNodes.h
(1.83 KB)
📄
UniqueInternalLinkageNames.h
(1.07 KB)
📄
UnrollLoop.h
(6.05 KB)
📄
VNCoercion.h
(4.99 KB)
📄
ValueMapper.h
(11.67 KB)
Editing: SymbolRewriter.h
//===- SymbolRewriter.h - Symbol Rewriting Pass -----------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file provides the prototypes and definitions related to the Symbol // Rewriter pass. // // The Symbol Rewriter pass takes a set of rewrite descriptors which define // transformations for symbol names. These can be either single name to name // trnsformation or more broad regular expression based transformations. // // All the functions are re-written at the IR level. The Symbol Rewriter itself // is exposed as a module level pass. All symbols at the module level are // iterated. For any matching symbol, the requested transformation is applied, // updating references to it as well (a la RAUW). The resulting binary will // only contain the rewritten symbols. // // By performing this operation in the compiler, we are able to catch symbols // that would otherwise not be possible to catch (e.g. inlined symbols). // // This makes it possible to cleanly transform symbols without resorting to // overly-complex macro tricks and the pre-processor. An example of where this // is useful is the sanitizers where we would like to intercept a well-defined // set of functions across the module. // //===----------------------------------------------------------------------===// #ifndef LLVM_TRANSFORMS_UTILS_SYMBOLREWRITER_H #define LLVM_TRANSFORMS_UTILS_SYMBOLREWRITER_H #include "llvm/IR/PassManager.h" #include <list> #include <memory> #include <string> namespace llvm { class MemoryBuffer; class Module; class ModulePass; namespace yaml { class KeyValueNode; class MappingNode; class ScalarNode; class Stream; } // end namespace yaml namespace SymbolRewriter { /// The basic entity representing a rewrite operation. It serves as the base /// class for any rewrite descriptor. It has a certain set of specializations /// which describe a particular rewrite. /// /// The RewriteMapParser can be used to parse a mapping file that provides the /// mapping for rewriting the symbols. The descriptors individually describe /// whether to rewrite a function, global variable, or global alias. Each of /// these can be selected either by explicitly providing a name for the ones to /// be rewritten or providing a (posix compatible) regular expression that will /// select the symbols to rewrite. This descriptor list is passed to the /// SymbolRewriter pass. class RewriteDescriptor { public: enum class Type { Invalid, /// invalid Function, /// function - descriptor rewrites a function GlobalVariable, /// global variable - descriptor rewrites a global variable NamedAlias, /// named alias - descriptor rewrites a global alias }; RewriteDescriptor(const RewriteDescriptor &) = delete; RewriteDescriptor &operator=(const RewriteDescriptor &) = delete; virtual ~RewriteDescriptor() = default; Type getType() const { return Kind; } virtual bool performOnModule(Module &M) = 0; protected: explicit RewriteDescriptor(Type T) : Kind(T) {} private: const Type Kind; }; using RewriteDescriptorList = std::list<std::unique_ptr<RewriteDescriptor>>; class RewriteMapParser { public: bool parse(const std::string &MapFile, RewriteDescriptorList *Descriptors); private: bool parse(std::unique_ptr<MemoryBuffer> &MapFile, RewriteDescriptorList *DL); bool parseEntry(yaml::Stream &Stream, yaml::KeyValueNode &Entry, RewriteDescriptorList *DL); bool parseRewriteFunctionDescriptor(yaml::Stream &Stream, yaml::ScalarNode *Key, yaml::MappingNode *Value, RewriteDescriptorList *DL); bool parseRewriteGlobalVariableDescriptor(yaml::Stream &Stream, yaml::ScalarNode *Key, yaml::MappingNode *Value, RewriteDescriptorList *DL); bool parseRewriteGlobalAliasDescriptor(yaml::Stream &YS, yaml::ScalarNode *K, yaml::MappingNode *V, RewriteDescriptorList *DL); }; } // end namespace SymbolRewriter ModulePass *createRewriteSymbolsPass(); ModulePass *createRewriteSymbolsPass(SymbolRewriter::RewriteDescriptorList &); class RewriteSymbolPass : public PassInfoMixin<RewriteSymbolPass> { public: RewriteSymbolPass() { loadAndParseMapFiles(); } RewriteSymbolPass(SymbolRewriter::RewriteDescriptorList &DL) { Descriptors.splice(Descriptors.begin(), DL); } PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); // Glue for old PM bool runImpl(Module &M); private: void loadAndParseMapFiles(); SymbolRewriter::RewriteDescriptorList Descriptors; }; } // end namespace llvm #endif //LLVM_TRANSFORMS_UTILS_SYMBOLREWRITER_H
Upload File
Create Folder