Transform: add SymbolRewriter pass
authorSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 7 Nov 2014 21:32:08 +0000 (21:32 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 7 Nov 2014 21:32:08 +0000 (21:32 +0000)
commit35c163020a7dbb90502ff6f9fdb8458744508936
treeb9b77a73b213ccc17b6f005f65814a9cdb9c9785
parent049368273b23af8419d3c306e25232ac157e549b
Transform: add SymbolRewriter pass

This introduces the symbol rewriter. This is an IR->IR transformation that is
implemented as a CodeGenPrepare pass. This allows for the transparent
adjustment of the symbols during compilation.

It provides a clean, simple, elegant solution for symbol inter-positioning. This
technique is often used, such as in the various sanitizers and performance
analysis.

The control of this is via a custom YAML syntax map file that indicates source
to destination mapping, so as to avoid having the compiler to know the exact
details of the source to destination transformations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221548 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Module.h
include/llvm/InitializePasses.h
include/llvm/LinkAllPasses.h
include/llvm/Transforms/Utils/SymbolRewriter.h [new file with mode: 0644]
lib/CodeGen/Passes.cpp
lib/Transforms/Utils/CMakeLists.txt
lib/Transforms/Utils/SymbolRewriter.cpp [new file with mode: 0644]
test/SymbolRewriter/rewrite.ll [new file with mode: 0644]
test/SymbolRewriter/rewrite.map [new file with mode: 0644]
tools/opt/opt.cpp