summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CGCall.h
diff options
context:
space:
mode:
authorLeny Kholodov <lkholodov@accesssoftek.com>2015-06-08 10:23:49 +0000
committerLeny Kholodov <lkholodov@accesssoftek.com>2015-06-08 10:23:49 +0000
commit24f40a8c37670707ba1ba7da2fc150cf566e89b3 (patch)
tree5ab41f1eeb209b9775ee696dd4faa9bdbaaba170 /lib/CodeGen/CGCall.h
parent411fab5c85bea837c4a0b576421f80fdb0ccc6ae (diff)
[CodeGen] Reuse stack space from unused function results (with more accurate unused result detection)
This patch fixes issues with unused result detection which were found in patch http://reviews.llvm.org/D9743. Differential Revision: http://reviews.llvm.org/D10042 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239294 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.h')
-rw-r--r--lib/CodeGen/CGCall.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/CodeGen/CGCall.h b/lib/CodeGen/CGCall.h
index b228733fb8..7a4708e5cc 100644
--- a/lib/CodeGen/CGCall.h
+++ b/lib/CodeGen/CGCall.h
@@ -155,17 +155,25 @@ namespace CodeGen {
/// ReturnValueSlot - Contains the address where the return value of a
/// function can be stored, and whether the address is volatile or not.
class ReturnValueSlot {
- llvm::PointerIntPair<llvm::Value *, 1, bool> Value;
+ llvm::PointerIntPair<llvm::Value *, 2, unsigned int> Value;
+
+ // Return value slot flags
+ enum Flags {
+ IS_VOLATILE = 0x1,
+ IS_UNUSED = 0x2,
+ };
public:
ReturnValueSlot() {}
- ReturnValueSlot(llvm::Value *Value, bool IsVolatile)
- : Value(Value, IsVolatile) {}
+ ReturnValueSlot(llvm::Value *Value, bool IsVolatile, bool IsUnused = false)
+ : Value(Value,
+ (IsVolatile ? IS_VOLATILE : 0) | (IsUnused ? IS_UNUSED : 0)) {}
bool isNull() const { return !getValue(); }
-
- bool isVolatile() const { return Value.getInt(); }
+
+ bool isVolatile() const { return Value.getInt() & IS_VOLATILE; }
llvm::Value *getValue() const { return Value.getPointer(); }
+ bool isUnused() const { return Value.getInt() & IS_UNUSED; }
};
} // end namespace CodeGen