diff options
author | Gabor Greif <ggreif@gmail.com> | 2008-10-16 15:33:02 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2008-10-16 15:33:02 +0000 |
commit | 0bd120e8175c110e8aa78b2b6ca3da0e02100c65 (patch) | |
tree | 2cfee331f6859a309774401fa3d0debf3d5f57ee /llvm/lib | |
parent | 9546eee50ae6aa0cf182ec6ec7fa154e8c23ca9a (diff) | |
download | bcm5719-llvm-0bd120e8175c110e8aa78b2b6ca3da0e02100c65.tar.gz bcm5719-llvm-0bd120e8175c110e8aa78b2b6ca3da0e02100c65.zip |
Introduce a typing refinenement on tagged data
using the 'volatile' qualifier. This should not have any operational consequences
on code, because tags should always be stripped off (giving a non-volatile pointer)
before dereferencing. The new qualification is there to catch some attempts to use
tagged pointers in a context where an untagged pointer is appropriate.
Notably this approach does not catch dereferencing of tagged pointers, but helps
in separating the two concepts a bit.
llvm-svn: 57641
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/VMCore/Use.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/Use.cpp b/llvm/lib/VMCore/Use.cpp index d96a0e57fd4..5eadaadbb33 100644 --- a/llvm/lib/VMCore/Use.cpp +++ b/llvm/lib/VMCore/Use.cpp @@ -127,7 +127,7 @@ void Use::zap(Use *Start, const Use *Stop, bool del) { //===----------------------------------------------------------------------===// struct AugmentedUse : Use { - User *ref; + volatile User *ref; AugmentedUse(); // not implemented }; @@ -138,12 +138,10 @@ struct AugmentedUse : Use { User *Use::getUser() const { const Use *End = getImpliedUser(); - User *She = static_cast<const AugmentedUse*>(End - 1)->ref; - She = extractTag<Tag, tagOne>(She) + volatile User *She = static_cast<const AugmentedUse*>(End - 1)->ref; + return extractTag<Tag, tagOne>(She) ? llvm::stripTag<tagOne>(She) : reinterpret_cast<User*>(const_cast<Use*>(End)); - - return She; } //===----------------------------------------------------------------------===// |