class PHITransAddr

Declaration

class PHITransAddr { /* full declaration omitted */ };

Description

PHITransAddr - An address value which tracks and handles phi translation. As we walk "up" the CFG through predecessors, we need to ensure that the address we're tracking is kept up to date. For example, if we're analyzing an address of "&A[i]" and walk through the definition of 'i' which is a PHI node, we *must* phi translate i to get "&A[j]" or else we will analyze an incorrect pointer in the predecessor block. This is designed to be a relatively small object that lives on the stack and is copyable.

Declared at: llvm/include/llvm/Analysis/PHITransAddr.h:35

Member Variables

private llvm::Value* Addr
Addr - The actual address we're analyzing.
private const llvm::DataLayout& DL
The DataLayout we are playing with.
private const llvm::TargetLibraryInfo* TLI = nullptr
TLI - The target library info if known, otherwise null.
private llvm::AssumptionCache* AC
A cache of @ llvm.assume calls used by SimplifyInstruction.
private SmallVector<llvm::Instruction*, 4> InstInputs
InstInputs - The inputs for our symbolic address.

Method Overview

  • private llvm::Value * AddAsInput(llvm::Value * V)
  • private llvm::Value * InsertPHITranslatedSubExpr(llvm::Value * InVal, llvm::BasicBlock * CurBB, llvm::BasicBlock * PredBB, const llvm::DominatorTree & DT, SmallVectorImpl<llvm::Instruction *> & NewInsts)
  • public bool IsPotentiallyPHITranslatable() const
  • public bool NeedsPHITranslationFromBlock(llvm::BasicBlock * BB) const
  • public PHITransAddr(llvm::Value * addr, const llvm::DataLayout & DL, llvm::AssumptionCache * AC)
  • private llvm::Value * PHITranslateSubExpr(llvm::Value * V, llvm::BasicBlock * CurBB, llvm::BasicBlock * PredBB, const llvm::DominatorTree * DT)
  • public bool PHITranslateValue(llvm::BasicBlock * CurBB, llvm::BasicBlock * PredBB, const llvm::DominatorTree * DT, bool MustDominate)
  • public llvm::Value * PHITranslateWithInsertion(llvm::BasicBlock * CurBB, llvm::BasicBlock * PredBB, const llvm::DominatorTree & DT, SmallVectorImpl<llvm::Instruction *> & NewInsts)
  • public bool Verify() const
  • public void dump() const
  • public llvm::Value * getAddr() const

Methods

llvm::Value* AddAsInput(llvm::Value* V)

Description

AddAsInput - If the specified value is an instruction, add it as an input.

Declared at: llvm/include/llvm/Analysis/PHITransAddr.h:116

Parameters

llvm::Value* V

llvm::Value* InsertPHITranslatedSubExpr(
    llvm::Value* InVal,
    llvm::BasicBlock* CurBB,
    llvm::BasicBlock* PredBB,
    const llvm::DominatorTree& DT,
    SmallVectorImpl<llvm::Instruction*>& NewInsts)

Description

InsertPHITranslatedSubExpr - Insert a computation of the PHI translated version of 'V' for the edge PredBB->CurBB into the end of the PredBB block. All newly created instructions are added to the NewInsts list. This returns null on failure.

Declared at: llvm/include/llvm/Analysis/PHITransAddr.h:111

Parameters

llvm::Value* InVal
llvm::BasicBlock* CurBB
llvm::BasicBlock* PredBB
const llvm::DominatorTree& DT
SmallVectorImpl<llvm::Instruction*>& NewInsts

bool IsPotentiallyPHITranslatable() const

Description

IsPotentiallyPHITranslatable - If this needs PHI translation, return true if we have some hope of doing it. This should be used as a filter to avoid calling PHITranslateValue in hopeless situations.

Declared at: llvm/include/llvm/Analysis/PHITransAddr.h:75

bool NeedsPHITranslationFromBlock(
    llvm::BasicBlock* BB) const

Description

NeedsPHITranslationFromBlock - Return true if moving from the specified BasicBlock to its predecessors requires PHI translation.

Declared at: llvm/include/llvm/Analysis/PHITransAddr.h:63

Parameters

llvm::BasicBlock* BB

PHITransAddr(llvm::Value* addr,
             const llvm::DataLayout& DL,
             llvm::AssumptionCache* AC)

Declared at: llvm/include/llvm/Analysis/PHITransAddr.h:52

Parameters

llvm::Value* addr
const llvm::DataLayout& DL
llvm::AssumptionCache* AC

llvm::Value* PHITranslateSubExpr(
    llvm::Value* V,
    llvm::BasicBlock* CurBB,
    llvm::BasicBlock* PredBB,
    const llvm::DominatorTree* DT)

Declared at: llvm/include/llvm/Analysis/PHITransAddr.h:103

Parameters

llvm::Value* V
llvm::BasicBlock* CurBB
llvm::BasicBlock* PredBB
const llvm::DominatorTree* DT

bool PHITranslateValue(
    llvm::BasicBlock* CurBB,
    llvm::BasicBlock* PredBB,
    const llvm::DominatorTree* DT,
    bool MustDominate)

Description

PHITranslateValue - PHI translate the current address up the CFG from CurBB to Pred, updating our state to reflect any needed changes. If 'MustDominate' is true, the translated value must dominate PredBB. This returns true on failure and sets Addr to null.

Declared at: llvm/include/llvm/Analysis/PHITransAddr.h:81

Parameters

llvm::BasicBlock* CurBB
llvm::BasicBlock* PredBB
const llvm::DominatorTree* DT
bool MustDominate

llvm::Value* PHITranslateWithInsertion(
    llvm::BasicBlock* CurBB,
    llvm::BasicBlock* PredBB,
    const llvm::DominatorTree& DT,
    SmallVectorImpl<llvm::Instruction*>& NewInsts)

Description

PHITranslateWithInsertion - PHI translate this value into the specified predecessor block, inserting a computation of the value if it is unavailable. All newly created instructions are added to the NewInsts list. This returns null on failure.

Declared at: llvm/include/llvm/Analysis/PHITransAddr.h:91

Parameters

llvm::BasicBlock* CurBB
llvm::BasicBlock* PredBB
const llvm::DominatorTree& DT
SmallVectorImpl<llvm::Instruction*>& NewInsts

bool Verify() const

Description

Verify - Check internal consistency of this data structure. If the structure is valid, it returns true. If invalid, it prints errors and returns false.

Declared at: llvm/include/llvm/Analysis/PHITransAddr.h:100

void dump() const

Declared at: llvm/include/llvm/Analysis/PHITransAddr.h:95

llvm::Value* getAddr() const

Declared at: llvm/include/llvm/Analysis/PHITransAddr.h:59