diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-05-25 03:44:17 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-05-25 03:44:17 +0000 |
commit | fc2bb8c4448fa884d79e437cc2d2627a7d7740a8 (patch) | |
tree | 47e663210a235ef6d9113cb02691310b10821c4f /include | |
parent | 053546c31e4752e3d76e1f0915ddd6c8a3280351 (diff) | |
download | llvm-fc2bb8c4448fa884d79e437cc2d2627a7d7740a8.tar.gz llvm-fc2bb8c4448fa884d79e437cc2d2627a7d7740a8.tar.bz2 llvm-fc2bb8c4448fa884d79e437cc2d2627a7d7740a8.tar.xz |
Replace the -unwind-tables option with a per function flag. This is more
LTO friendly as we can now correctly merge files compiled with or without
-fasynchronous-unwind-tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132033 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Attributes.h | 16 | ||||
-rw-r--r-- | include/llvm/Function.h | 16 | ||||
-rw-r--r-- | include/llvm/Target/TargetOptions.h | 4 |
3 files changed, 31 insertions, 5 deletions
diff --git a/include/llvm/Attributes.h b/include/llvm/Attributes.h index da6188b1a8..57c84357ae 100644 --- a/include/llvm/Attributes.h +++ b/include/llvm/Attributes.h @@ -67,6 +67,20 @@ const Attributes StackAlignment = 7<<26; ///< Alignment of stack for ///alignstack(1)) const Attributes Hotpatch = 1<<29; ///< Function should have special ///'hotpatch' sequence in prologue +const Attributes UWTable = 1<<30; ///< Function must be in a unwind + ///table + +/// Note that uwtable is about the ABI or the user mandating an entry in the +/// unwind table. The nounwind attribute is about an exception passing by the +/// function. +/// In a theoretical system that uses tables for profiling and sjlj for +/// exceptions, they would be fully independent. In a normal system that +/// uses tables for both, the semantics are: +/// nil = Needs an entry because an exception might pass by. +/// nounwind = No need for an entry +/// ehframe = Needs an entry because the ABI says so and because +/// an exception might pass by. +/// ehframe + nounwind = Needs an entry because the ABI says so. /// @brief Attributes that only apply to function parameters. const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture; @@ -76,7 +90,7 @@ const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture; const Attributes FunctionOnly = NoReturn | NoUnwind | ReadNone | ReadOnly | NoInline | AlwaysInline | OptimizeForSize | StackProtect | StackProtectReq | NoRedZone | NoImplicitFloat | Naked | InlineHint | StackAlignment | - Hotpatch; + Hotpatch | UWTable; /// @brief Parameter attributes that do not apply to vararg call arguments. const Attributes VarArgsIncompatible = StructRet; diff --git a/include/llvm/Function.h b/include/llvm/Function.h index b34a6b2542..9319a5b39e 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -253,6 +253,22 @@ public: else removeFnAttr(Attribute::NoUnwind); } + /// @brief True if the ABI mandates this function be in a unwind table. + bool hasUWTable() const { + return hasFnAttr(Attribute::UWTable); + } + void setHasUWTable(bool HasUWTable = true) { + if (HasUWTable) + addFnAttr(Attribute::UWTable); + else + removeFnAttr(Attribute::UWTable); + } + + /// @brief True if this function needs in a unwind table. + bool needsUnwindTableEntry() const { + return hasUWTable() || !doesNotThrow(); + } + /// @brief Determine if the function returns a structure through first /// pointer argument. bool hasStructRetAttr() const { diff --git a/include/llvm/Target/TargetOptions.h b/include/llvm/Target/TargetOptions.h index 62190c166e..beed039d1d 100644 --- a/include/llvm/Target/TargetOptions.h +++ b/include/llvm/Target/TargetOptions.h @@ -125,10 +125,6 @@ namespace llvm { /// flag is hidden and is only for debugging the debug info. extern bool JITEmitDebugInfoToDisk; - /// UnwindTablesMandatory - This flag indicates that unwind tables should - /// be emitted for all functions. - extern bool UnwindTablesMandatory; - /// GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is /// specified on the commandline. When the flag is on, participating targets /// will perform tail call optimization on all calls which use the fastcc |