diff options
author | Joerg Sonnenberger <joerg@bec.de> | 2011-12-18 20:35:43 +0000 |
---|---|---|
committer | Joerg Sonnenberger <joerg@bec.de> | 2011-12-18 20:35:43 +0000 |
commit | 34706936412b9e9ff73511fed58e97bf6e100e69 (patch) | |
tree | 8dd5690e4a2988b2c84baedc156af57496e320dd /include | |
parent | 2ea4cdb81f0f69f89d93f4726f25e849216ac973 (diff) |
Allow inlining of functions with returns_twice calls, if they have the
attribute themselve.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146851 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/CodeMetrics.h | 7 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineFunction.h | 26 |
2 files changed, 19 insertions, 14 deletions
diff --git a/include/llvm/Analysis/CodeMetrics.h b/include/llvm/Analysis/CodeMetrics.h index 5f78021f3d..c01507f0a9 100644 --- a/include/llvm/Analysis/CodeMetrics.h +++ b/include/llvm/Analysis/CodeMetrics.h @@ -31,8 +31,9 @@ namespace llvm { /// caller. // bool NeverInline; - // True if this function contains a call to setjmp or _setjmp - bool callsSetJmp; + // True if this function contains a call to setjmp or other functions + // with attribute "returns twice" without having the attribute by itself. + bool exposesReturnsTwice; // True if this function calls itself bool isRecursive; @@ -66,7 +67,7 @@ namespace llvm { /// NumRets - Keep track of how many Ret instructions the block contains. unsigned NumRets; - CodeMetrics() : callsSetJmp(false), isRecursive(false), + CodeMetrics() : exposesReturnsTwice(false), isRecursive(false), containsIndirectBr(false), usesDynamicAlloca(false), NumInsts(0), NumBlocks(0), NumCalls(0), NumInlineCandidates(0), NumVectorInsts(0), diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index 3a4568a59d..fd4cac8c12 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -120,10 +120,12 @@ class MachineFunction { /// Alignment - The alignment of the function. unsigned Alignment; - /// CallsSetJmp - True if the function calls setjmp or sigsetjmp. This is used - /// to limit optimizations which cannot reason about the control flow of - /// setjmp. - bool CallsSetJmp; + /// ExposesReturnsTwice - True if the function calls setjmp or related + /// functions with attribute "returns twice", but doesn't have + /// the attribute itself. + /// This is used to limit optimizations which cannot reason + /// about the control flow of such functions. + bool ExposesReturnsTwice; MachineFunction(const MachineFunction &); // DO NOT IMPLEMENT void operator=(const MachineFunction&); // DO NOT IMPLEMENT @@ -192,15 +194,17 @@ public: if (Alignment < A) Alignment = A; } - /// callsSetJmp - Returns true if the function calls setjmp or sigsetjmp. - bool callsSetJmp() const { - return CallsSetJmp; + /// exposesReturnsTwice - Returns true if the function calls setjmp or + /// any other similar functions with attribute "returns twice" without + /// having the attribute itself. + bool exposesReturnsTwice() const { + return ExposesReturnsTwice; } - /// setCallsSetJmp - Set a flag that indicates if there's a call to setjmp or - /// sigsetjmp. - void setCallsSetJmp(bool B) { - CallsSetJmp = B; + /// setCallsSetJmp - Set a flag that indicates if there's a call to + /// a "returns twice" function. + void setExposesReturnsTwice(bool B) { + ExposesReturnsTwice = B; } /// getInfo - Keep track of various per-function pieces of information for |