struct MustBeExecutedIterator

Declaration

struct MustBeExecutedIterator { /* full declaration omitted */ };

Description

Must be executed iterators visit stretches of instructions that are guaranteed to be executed together, potentially with other instruction executed in-between. Given the following code, and assuming all statements are single instructions which transfer execution to the successor (see isGuaranteedToTransferExecutionToSuccessor), there are two possible outcomes. If we start the iterator at A, B, or E, we will visit only A, B, and E. If we start at C or D, we will visit all instructions A-E. Below is the example extneded with instructions F and G. Now we assume F might not transfer execution to it's successor G. As a result we get the following visit sets: Start Instruction | Visit Set A | A, B, E, F B | A, B, E, F C | A, B, C, D, E, F D | A, B, C, D, E, F E | A, B, E, F F | A, B, E, F G | A, B, E, F, G A more complex example involving conditionals, loops, break, and continue is shown below. We again assume all instructions will transmit control to the successor and we assume we can prove the inner loop to be finite. We omit non-trivial branch conditions as the exploration is oblivious to them. Constant branches are assumed to be unconditional in the CFG. The resulting visist sets are shown in the table below. Start Instruction | Visit Set A | A, B B | A, B C | A, B, C D | A, B, D E | A, B, D, E, F F | A, B, D, F G | A, B, D, G Note that the examples show optimal visist sets but not necessarily the ones derived by the explorer depending on the available CFG analyses (see MustBeExecutedContextExplorer). Also note that we, depending on the options, the visit set can contain instructions from other functions.

Declared at: llvm/include/llvm/Analysis/MustExecute.h:271

Method Overview

Methods

MustBeExecutedIterator(
    const llvm::MustBeExecutedIterator& Other)

Declared at: llvm/include/llvm/Analysis/MustExecute.h:283

Parameters

const llvm::MustBeExecutedIterator& Other

MustBeExecutedIterator(
    llvm::MustBeExecutedIterator&& Other)

Declared at: llvm/include/llvm/Analysis/MustExecute.h:287

Parameters

llvm::MustBeExecutedIterator&& Other

bool count(const llvm::Instruction* I) const

Description

Return true if \p I was encountered by this iterator already.

Declared at: llvm/include/llvm/Analysis/MustExecute.h:331

Parameters

const llvm::Instruction* I

const llvm::Instruction* getCurrentInst() const

Declared at: llvm/include/llvm/Analysis/MustExecute.h:328

~MustBeExecutedIterator()

Declared at: llvm/include/llvm/Analysis/MustExecute.h:299