summaryrefslogtreecommitdiffstats
path: root/llvm/docs
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2016-04-19 05:24:47 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2016-04-19 05:24:47 +0000
commitc0441c29df6498257eca59d41d9ccaf6d5a9adf3 (patch)
tree50847e0c84b62a0efe0b8078f1ff6ca9b1c97d11 /llvm/docs
parent28d8d0465733b4363461c27cbf58721e1163d763 (diff)
downloadbcm5719-llvm-c0441c29df6498257eca59d41d9ccaf6d5a9adf3.tar.gz
bcm5719-llvm-c0441c29df6498257eca59d41d9ccaf6d5a9adf3.zip
Introduce a "patchable-function" function attribute
Summary: The `"patchable-function"` attribute can be used by an LLVM client to influence LLVM's code generation in ways that makes the generated code easily patchable at runtime (for instance, to redirect control). Right now only one patchability scheme is supported, `"prologue-short-redirect"`, but this can be expanded in the future. Reviewers: joker.eph, rnk, echristo, dberris Subscribers: joker.eph, echristo, mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D19046 llvm-svn: 266715
Diffstat (limited to 'llvm/docs')
-rw-r--r--llvm/docs/LangRef.rst25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 57ed68e4a81..2582e4aa0a5 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -1405,6 +1405,31 @@ example:
passes make choices that keep the code size of this function low,
and otherwise do optimizations specifically to reduce code size as
long as they do not significantly impact runtime performance.
+``"patchable-function"``
+ This attribute tells the code generator that the code
+ generated for this function needs to follow certain conventions that
+ make it possible for a runtime function to patch over it later.
+ The exact effect of this attribute depends on its string value,
+ for which there currently is one legal possiblity:
+
+ * ``"prologue-short-redirect"`` - This style of patchable
+ function is intended to support patching a function prologue to
+ redirect control away from the function in a thread safe
+ manner. It guarantees that the first instruction of the
+ function will be large enough to accommodate a short jump
+ instruction, and will be sufficiently aligned to allow being
+ fully changed via an atomic compare-and-swap instruction.
+ While the first requirement can be satisfied by inserting large
+ enough NOP, LLVM can and will try to re-purpose an existing
+ instruction (i.e. one that would have to be emitted anyway) as
+ the patchable instruction larger than a short jump.
+
+ ``"prologue-short-redirect"`` is currently only supported on
+ x86-64.
+
+ This attribute by itself does not imply restrictions on
+ inter-procedural optimizations. All of the semantic effects the
+ patching may have to be separately conveyed via the linkage type.
``readnone``
On a function, this attribute indicates that the function computes its
result (or decides to unwind an exception) based strictly on its arguments,
OpenPOWER on IntegriCloud