[PATCH] Prologue support
Ben Gamari
bgamari at gmail.com
Fri Nov 28 07:20:11 PST 2014
Hi rnk, pcc, rafael,
This redefines the `prefix` attribute introduced previously and
introduces a `prologue` attribute. There are a two primary usecases
that these attributes aim to serve,
1. Function prologue sigils: TODO figure out what Reid meant by this
2. Function hot-patching: Enable the user to insert `nop` operations
at the beginning of the function which can later be safely replaced
with a call to some instrumentation facility
3. Runtime metadata: Allow a compiler to insert data for use by the
runtime during execution. GHC is one example of a compiler that
needs this functionality for its tables-next-to-code functionality.
Previously `prefix` served cases (1) and (2) quite well by allowing the user
to introduce arbitrary data at the entrypoint but before the function
body. Case (3), however, was poorly handled by this approach as it
required that prefix data was valid executable code.
Here we redefine the notion of prefix data to instead be data which
occurs immediately before the function entrypoint (i.e. the symbol
address). Since prefix data now occurs before the function entrypoint,
there is no need for the data to be valid code.
The previous notion of prefix data now goes under the name "prologue
data" to emphasize its duality with the function epilogue.
The intention here is to handle cases (1) and (2) with prologue data and
case (3) with prefix data.
References
----------
This idea arose out of discussions[1] with Reid Kleckner in response to a
proposal to introduce the notion of symbol offsets to enable handling of
case (3).
[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-May/073235.html
http://reviews.llvm.org/D6454
Files:
docs/BitCodeFormat.rst
docs/LangRef.rst
docs/ReleaseNotes.rst
include/llvm/IR/Function.h
lib/AsmParser/LLLexer.cpp
lib/AsmParser/LLParser.cpp
lib/AsmParser/LLParser.h
lib/AsmParser/LLToken.h
lib/Bitcode/Reader/BitcodeReader.cpp
lib/Bitcode/Reader/BitcodeReader.h
lib/Bitcode/Writer/BitcodeWriter.cpp
lib/Bitcode/Writer/ValueEnumerator.cpp
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/IR/AsmWriter.cpp
lib/IR/Function.cpp
lib/IR/LLVMContextImpl.h
lib/IR/TypeFinder.cpp
lib/Linker/LinkModules.cpp
lib/Transforms/IPO/GlobalDCE.cpp
test/CodeGen/X86/prefixdata.ll
test/CodeGen/X86/prologuedata.ll
test/Feature/prologuedata.ll
test/Linker/prefixdata.ll
test/Linker/prologuedata.ll
tools/verify-uselistorder/verify-uselistorder.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6454.16736.patch
Type: text/x-patch
Size: 30849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141128/5a5c5fb8/attachment.bin>
More information about the llvm-commits
mailing list