pointers that employ unused bits in a pointer to store extra data.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43373
91177308-0d34-0410-b5e6-
96231b3b80d8
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Allocator.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/DataTypes.h"
#include <vector>
namespace llvm {
#include <vector>
namespace llvm {
struct BPatchNode {
BPatchNode* const Next;
struct BPatchNode {
BPatchNode* const Next;
- void*& PtrRef;
- BPatchNode(BPatchNode* n, void*& pref) : Next(n), PtrRef(pref) {}
+ uintptr_t& PtrRef;
+ BPatchNode(BPatchNode* n, void*& pref)
+ : Next(n), PtrRef(reinterpret_cast<uintptr_t&>(pref)) {
+ PtrRef = 0;
+ }
assert (Entry.Ptr && "No pointer found for backpatch.");
for (BPatchNode* N = Entry.Head; N != NULL; N = N->Next)
assert (Entry.Ptr && "No pointer found for backpatch.");
for (BPatchNode* N = Entry.Head; N != NULL; N = N->Next)
+ // Bitwise-OR in the pointer to support "smart" pointers that use
+ // unused bits to store extra data.
+ N->PtrRef |= reinterpret_cast<uintptr_t>(Entry.Ptr);