diff options
author | Charles Davis <cdavis@mines.edu> | 2010-10-25 15:37:09 +0000 |
---|---|---|
committer | Charles Davis <cdavis@mines.edu> | 2010-10-25 15:37:09 +0000 |
commit | 970bfcc7d8b9991430caa7ab33975617f3f4c40d (patch) | |
tree | 4d3a6ad9273bd06be457f993741ac2b9cc78fca3 /lib | |
parent | d8c5ec6aece5732c766bd7d773ff75976d364168 (diff) | |
download | external_llvm-970bfcc7d8b9991430caa7ab33975617f3f4c40d.tar.gz external_llvm-970bfcc7d8b9991430caa7ab33975617f3f4c40d.tar.bz2 external_llvm-970bfcc7d8b9991430caa7ab33975617f3f4c40d.zip |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117264 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AsmParser/LLLexer.cpp | 1 | ||||
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 1 | ||||
-rw-r--r-- | lib/AsmParser/LLToken.h | 1 | ||||
-rw-r--r-- | lib/VMCore/Attributes.cpp | 2 |
4 files changed, 5 insertions, 0 deletions
diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp index eeaadf68ea..f924b5a908 100644 --- a/lib/AsmParser/LLLexer.cpp +++ b/lib/AsmParser/LLLexer.cpp @@ -573,6 +573,7 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(noredzone); KEYWORD(noimplicitfloat); KEYWORD(naked); + KEYWORD(hotpatch); KEYWORD(type); KEYWORD(opaque); diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 4d3bd87932..a1f70fb024 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -982,6 +982,7 @@ bool LLParser::ParseOptionalAttrs(unsigned &Attrs, unsigned AttrKind) { 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; diff --git a/lib/AsmParser/LLToken.h b/lib/AsmParser/LLToken.h index 8a8663e739..72128c9ae0 100644 --- a/lib/AsmParser/LLToken.h +++ b/lib/AsmParser/LLToken.h @@ -96,6 +96,7 @@ namespace lltok { kw_noredzone, kw_noimplicitfloat, kw_naked, + kw_hotpatch, kw_type, kw_opaque, diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp index 3422faf273..6f5ecd278d 100644 --- a/lib/VMCore/Attributes.cpp +++ b/lib/VMCore/Attributes.cpp @@ -70,6 +70,8 @@ std::string Attribute::getAsString(Attributes Attrs) { 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)); |