diff options
author | Duncan Sands <baldrick@free.fr> | 2008-01-06 18:27:01 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-01-06 18:27:01 +0000 |
commit | ad9a9e15595bc9d5ba1ed752caf8572957f77a3d (patch) | |
tree | 1ff466f71bdde8cc209d51f581e13dc1654c7b10 /include | |
parent | a9d0c9dc58855a5f01dcc5c85c89fd3fc737d3e8 (diff) | |
download | external_llvm-ad9a9e15595bc9d5ba1ed752caf8572957f77a3d.zip external_llvm-ad9a9e15595bc9d5ba1ed752caf8572957f77a3d.tar.gz external_llvm-ad9a9e15595bc9d5ba1ed752caf8572957f77a3d.tar.bz2 |
The transform that tries to turn calls to bitcast functions into
direct calls bails out unless caller and callee have essentially
equivalent parameter attributes. This is illogical - the callee's
attributes should be of no relevance here. Rework the logic, which
incidentally fixes a crash when removed arguments have attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45658 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ParameterAttributes.h | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/include/llvm/ParameterAttributes.h b/include/llvm/ParameterAttributes.h index fc0f96e..b66f991 100644 --- a/include/llvm/ParameterAttributes.h +++ b/include/llvm/ParameterAttributes.h @@ -22,6 +22,8 @@ #include <cassert> namespace llvm { +class Type; + namespace ParamAttr { /// Function parameters and results can have attributes to indicate how they @@ -44,13 +46,6 @@ enum Attributes { ReadOnly = 1 << 10 ///< Function only reads from memory }; -/// These attributes can safely be dropped from a function or a function call: -/// doing so may reduce the number of optimizations performed, but it will not -/// change a correct program into an incorrect one. -/// @brief Attributes that do not change the calling convention. -const uint16_t Informative = NoReturn | NoUnwind | NoAlias | - ReadNone | ReadOnly; - /// @brief Attributes that only apply to function parameters. const uint16_t ParameterOnly = ByVal | InReg | Nest | StructRet; @@ -63,10 +58,6 @@ const uint16_t IntegerTypeOnly = SExt | ZExt; /// @brief Attributes that only apply to pointers. const uint16_t PointerTypeOnly = ByVal | Nest | NoAlias | StructRet; -/// @brief Attributes that do not apply to void type function return values. -const uint16_t VoidTypeIncompatible = IntegerTypeOnly | PointerTypeOnly | - ParameterOnly; - /// @brief Attributes that are mutually incompatible. const uint16_t MutuallyIncompatible[3] = { ByVal | InReg | Nest | StructRet, @@ -74,6 +65,9 @@ const uint16_t MutuallyIncompatible[3] = { ReadNone | ReadOnly }; +/// @brief Which of the given attributes do not apply to the type. +uint16_t incompatibleWithType (const Type *Ty, uint16_t attrs); + } // end namespace ParamAttr /// This is just a pair of values to associate a set of parameter attributes @@ -158,11 +152,6 @@ class ParamAttrsList : public FoldingSetNode { static const ParamAttrsList *excludeAttrs(const ParamAttrsList *PAL, uint16_t idx, uint16_t attrs); - /// Returns whether each of the specified lists of attributes can be safely - /// replaced with the other in a function or a function call. - /// @brief Whether one attribute list can safely replace the other. - static bool areCompatible(const ParamAttrsList *A, const ParamAttrsList *B); - /// @} /// @name Accessors /// @{ |