[llvm-commits] [llvm] r117264 - in /llvm/trunk: docs/LangRef.html include/llvm/Attributes.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/VMCore/Attributes.cpp
Charles Davis
cdavis at mines.edu
Mon Oct 25 08:37:09 PDT 2010
Author: cdavis
Date: Mon Oct 25 10:37:09 2010
New Revision: 117264
URL: http://llvm.org/viewvc/llvm-project?rev=117264&view=rev
Log:
Add a new 'hotpatch' attribute. This attribute will insert a two-byte no-op
instruction at the beginning of each function that has the attribute, allowing
the function to be easily hooked and/or patched.
Modified:
llvm/trunk/docs/LangRef.html
llvm/trunk/include/llvm/Attributes.h
llvm/trunk/lib/AsmParser/LLLexer.cpp
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/AsmParser/LLToken.h
llvm/trunk/lib/VMCore/Attributes.cpp
Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=117264&r1=117263&r2=117264&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Mon Oct 25 10:37:09 2010
@@ -1131,6 +1131,11 @@
function into callers whenever possible, ignoring any active inlining size
threshold for this caller.</dd>
+ <dt><tt><b>hotpatch</b></tt></dt>
+ <dd>This attribute indicates that the prologue should contain a 'hotpatch'
+ sequence at the beginning. This is the same sequence used in the
+ system DLLs in Microsoft Windows XP Service Pack 2 and higher.</dd>
+
<dt><tt><b>inlinehint</b></tt></dt>
<dd>This attribute indicates that the source code contained a hint that inlining
this function is desirable (such as the "inline" keyword in C/C++). It
Modified: llvm/trunk/include/llvm/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=117264&r1=117263&r2=117264&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Attributes.h (original)
+++ llvm/trunk/include/llvm/Attributes.h Mon Oct 25 10:37:09 2010
@@ -65,6 +65,8 @@
///of alignment with +1 bias
///0 means unaligned (different from
///alignstack(1))
+const Attributes Hotpatch = 1<<29; ///< Function should have special
+ ///'hotpatch' sequence in prologue
/// @brief Attributes that only apply to function parameters.
const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture;
@@ -73,7 +75,8 @@
/// be used on return values or function parameters.
const Attributes FunctionOnly = NoReturn | NoUnwind | ReadNone | ReadOnly |
NoInline | AlwaysInline | OptimizeForSize | StackProtect | StackProtectReq |
- NoRedZone | NoImplicitFloat | Naked | InlineHint | StackAlignment;
+ NoRedZone | NoImplicitFloat | Naked | InlineHint | StackAlignment |
+ Hotpatch;
/// @brief Parameter attributes that do not apply to vararg call arguments.
const Attributes VarArgsIncompatible = StructRet;
Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=117264&r1=117263&r2=117264&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLLexer.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLLexer.cpp Mon Oct 25 10:37:09 2010
@@ -573,6 +573,7 @@
KEYWORD(noredzone);
KEYWORD(noimplicitfloat);
KEYWORD(naked);
+ KEYWORD(hotpatch);
KEYWORD(type);
KEYWORD(opaque);
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=117264&r1=117263&r2=117264&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Oct 25 10:37:09 2010
@@ -982,6 +982,7 @@
case lltok::kw_noredzone: Attrs |= Attribute::NoRedZone; break;
case lltok::kw_noimplicitfloat: Attrs |= Attribute::NoImplicitFloat; break;
case lltok::kw_naked: Attrs |= Attribute::Naked; break;
+ case lltok::kw_hotpatch: Attrs |= Attribute::Hotpatch; break;
case lltok::kw_alignstack: {
unsigned Alignment;
Modified: llvm/trunk/lib/AsmParser/LLToken.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLToken.h?rev=117264&r1=117263&r2=117264&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLToken.h (original)
+++ llvm/trunk/lib/AsmParser/LLToken.h Mon Oct 25 10:37:09 2010
@@ -96,6 +96,7 @@
kw_noredzone,
kw_noimplicitfloat,
kw_naked,
+ kw_hotpatch,
kw_type,
kw_opaque,
Modified: llvm/trunk/lib/VMCore/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=117264&r1=117263&r2=117264&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Attributes.cpp (original)
+++ llvm/trunk/lib/VMCore/Attributes.cpp Mon Oct 25 10:37:09 2010
@@ -70,6 +70,8 @@
Result += "noimplicitfloat ";
if (Attrs & Attribute::Naked)
Result += "naked ";
+ if (Attrs & Attribute::Hotpatch)
+ Result += "hotpatch ";
if (Attrs & Attribute::StackAlignment) {
Result += "alignstack(";
Result += utostr(Attribute::getStackAlignmentFromAttrs(Attrs));
More information about the llvm-commits
mailing list