freebsd-dev/contrib/llvm/lib/Analysis/PtrUseVisitor.cpp
Dimitry Andric 39d628a0c7 Merge llvm 3.6.0rc1 from ^/vendor/llvm/dist, merge clang 3.6.0rc1 from
^/vendor/clang/dist, resolve conflicts, and cleanup patches.
2015-01-25 23:36:55 +00:00

36 lines
1.0 KiB
C++

//===- PtrUseVisitor.cpp - InstVisitors over a pointers uses --------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
/// \file
/// Implementation of the pointer use visitors.
///
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/PtrUseVisitor.h"
using namespace llvm;
void detail::PtrUseVisitorBase::enqueueUsers(Instruction &I) {
for (Use &U : I.uses()) {
if (VisitedUses.insert(&U).second) {
UseToVisit NewU = {
UseToVisit::UseAndIsOffsetKnownPair(&U, IsOffsetKnown),
Offset
};
Worklist.push_back(std::move(NewU));
}
}
}
bool detail::PtrUseVisitorBase::adjustOffsetForGEP(GetElementPtrInst &GEPI) {
if (!IsOffsetKnown)
return false;
return GEPI.accumulateConstantOffset(DL, Offset);
}