clang 24.0.0git
clang::threadSafety::til::BasicBlock Class Reference

A basic block is part of an SCFG. More...

#include "clang/Analysis/Analyses/ThreadSafetyTIL.h"

Inheritance diagram for clang::threadSafety::til::BasicBlock:
[legend]

Classes

struct  TopologyNode

Public Types

using InstrArray = SimpleArray<SExpr *>
using BlockArray = SimpleArray<BasicBlock *>

Public Member Functions

 BasicBlock (MemRegionRef A)
 BasicBlock (BasicBlock &B, MemRegionRef A, InstrArray &&As, InstrArray &&Is, Terminator *T)
int blockID () const
 Returns the block ID. Every block has a unique ID in the CFG.
size_t numPredecessors () const
 Returns the number of predecessors.
size_t numSuccessors () const
const SCFG * cfg () const
SCFG * cfg ()
const BasicBlock * parent () const
BasicBlock * parent ()
const InstrArray & arguments () const
InstrArray & arguments ()
InstrArray & instructions ()
const InstrArray & instructions () const
BlockArray & predecessors ()
 Returns a list of predecessors.
const BlockArray & predecessors () const
ArrayRef< BasicBlock * > successors ()
ArrayRef< BasicBlock * > successors () const
const Terminator * terminator () const
Terminator * terminator ()
void setTerminator (Terminator *E)
bool Dominates (const BasicBlock &Other)
bool PostDominates (const BasicBlock &Other)
void addArgument (Phi *V)
 Add a new argument.
void addInstruction (SExpr *V)
 Add a new instruction.
unsigned addPredecessor (BasicBlock *Pred)
void reserveArguments (unsigned Nargs)
void reserveInstructions (unsigned Nins)
void reservePredecessors (unsigned NumPreds)
unsigned findPredecessorIndex (const BasicBlock *BB) const
 Return the index of BB, or Predecessors.size if BB is not a predecessor.
template<class V>
V::R_BasicBlock traverse (V &Vs, typename V::R_Ctx Ctx)
template<class C>
C::CType compare (const BasicBlock *E, C &Cmp) const
Public Member Functions inherited from clang::threadSafety::til::SExpr
 SExpr ()=delete
TIL_Opcode opcode () const
void * operator new (size_t S, MemRegionRef &R)
void * operator new (size_t)=delete
 SExpr objects must be created in an arena.
void operator delete (void *)=delete
 SExpr objects cannot be deleted.
unsigned id () const
 Returns the instruction ID for this expression.
BasicBlock * block () const
 Returns the block, if this is an instruction in a basic block, otherwise returns null.
void setID (BasicBlock *B, unsigned id)
 Set the basic block and instruction ID for this expression.

Static Public Member Functions

static bool classof (const SExpr *E)

Friends

class SCFG

Additional Inherited Members

Protected Member Functions inherited from clang::threadSafety::til::SExpr
 SExpr (TIL_Opcode Op)
 SExpr (const SExpr &E)
SExpr & operator= (const SExpr &)=delete
Protected Attributes inherited from clang::threadSafety::til::SExpr
const TIL_Opcode Opcode
unsigned char Reserved = 0
unsigned short Flags = 0
unsigned SExprID = 0
BasicBlock * Block = nullptr

Detailed Description

A basic block is part of an SCFG.

It can be treated as a function in continuation passing style. A block consists of a sequence of phi nodes, which are "arguments" to the function, followed by a sequence of instructions. It ends with a Terminator, which is a Branch or Goto to another basic block in the same SCFG.

Definition at line 1424 of file ThreadSafetyTIL.h.

Member Typedef Documentation

◆ BlockArray

◆ InstrArray

Constructor & Destructor Documentation

◆ BasicBlock() [1/2]

clang::threadSafety::til::BasicBlock::BasicBlock ( MemRegionRef A)
inlineexplicit

◆ BasicBlock() [2/2]

clang::threadSafety::til::BasicBlock::BasicBlock ( BasicBlock & B,
MemRegionRef A,
InstrArray && As,
InstrArray && Is,
Terminator * T )
inline

Member Function Documentation

◆ addArgument()

void clang::threadSafety::til::BasicBlock::addArgument ( Phi * V)
inline

Add a new argument.

Definition at line 1506 of file ThreadSafetyTIL.h.

References V.

◆ addInstruction()

void clang::threadSafety::til::BasicBlock::addInstruction ( SExpr * V)
inline

Add a new instruction.

Definition at line 1512 of file ThreadSafetyTIL.h.

References clang::threadSafety::til::SExpr::SExpr(), and V.

◆ addPredecessor()

unsigned BasicBlock::addPredecessor ( BasicBlock * Pred)

Definition at line 57 of file ThreadSafetyTIL.cpp.

References BasicBlock().

◆ arguments() [1/2]

InstrArray & clang::threadSafety::til::BasicBlock::arguments ( )
inline

Definition at line 1478 of file ThreadSafetyTIL.h.

◆ arguments() [2/2]

const InstrArray & clang::threadSafety::til::BasicBlock::arguments ( ) const
inline

◆ blockID()

int clang::threadSafety::til::BasicBlock::blockID ( ) const
inline

◆ cfg() [1/2]

SCFG * clang::threadSafety::til::BasicBlock::cfg ( )
inline

Definition at line 1472 of file ThreadSafetyTIL.h.

References SCFG.

◆ cfg() [2/2]

const SCFG * clang::threadSafety::til::BasicBlock::cfg ( ) const
inline

Definition at line 1471 of file ThreadSafetyTIL.h.

References SCFG.

◆ classof()

bool clang::threadSafety::til::BasicBlock::classof ( const SExpr * E)
inlinestatic

◆ compare()

template<class C>
C::CType clang::threadSafety::til::BasicBlock::compare ( const BasicBlock * E,
C & Cmp ) const
inline

Definition at line 1561 of file ThreadSafetyTIL.h.

References BasicBlock(), clang::C, and Cmp.

◆ Dominates()

bool clang::threadSafety::til::BasicBlock::Dominates ( const BasicBlock & Other)
inline

Definition at line 1497 of file ThreadSafetyTIL.h.

References BasicBlock(), and clang::Other.

◆ findPredecessorIndex()

unsigned clang::threadSafety::til::BasicBlock::findPredecessorIndex ( const BasicBlock * BB) const
inline

Return the index of BB, or Predecessors.size if BB is not a predecessor.

Definition at line 1531 of file ThreadSafetyTIL.h.

References BasicBlock().

◆ instructions() [1/2]

InstrArray & clang::threadSafety::til::BasicBlock::instructions ( )
inline

◆ instructions() [2/2]

const InstrArray & clang::threadSafety::til::BasicBlock::instructions ( ) const
inline

Definition at line 1481 of file ThreadSafetyTIL.h.

◆ numPredecessors()

size_t clang::threadSafety::til::BasicBlock::numPredecessors ( ) const
inline

Returns the number of predecessors.

Definition at line 1468 of file ThreadSafetyTIL.h.

◆ numSuccessors()

size_t clang::threadSafety::til::BasicBlock::numSuccessors ( ) const
inline

Definition at line 1469 of file ThreadSafetyTIL.h.

References successors().

◆ parent() [1/2]

BasicBlock * clang::threadSafety::til::BasicBlock::parent ( )
inline

Definition at line 1475 of file ThreadSafetyTIL.h.

References BasicBlock().

◆ parent() [2/2]

const BasicBlock * clang::threadSafety::til::BasicBlock::parent ( ) const
inline

◆ PostDominates()

bool clang::threadSafety::til::BasicBlock::PostDominates ( const BasicBlock & Other)
inline

Definition at line 1501 of file ThreadSafetyTIL.h.

References BasicBlock(), and clang::Other.

◆ predecessors() [1/2]

BlockArray & clang::threadSafety::til::BasicBlock::predecessors ( )
inline

Returns a list of predecessors.

The order of predecessors in the list is important; each phi node has exactly one argument for each precessor, in the same order.

Definition at line 1486 of file ThreadSafetyTIL.h.

◆ predecessors() [2/2]

const BlockArray & clang::threadSafety::til::BasicBlock::predecessors ( ) const
inline

Definition at line 1487 of file ThreadSafetyTIL.h.

◆ reserveArguments()

void clang::threadSafety::til::BasicBlock::reserveArguments ( unsigned Nargs)
inline

Definition at line 1522 of file ThreadSafetyTIL.h.

◆ reserveInstructions()

void clang::threadSafety::til::BasicBlock::reserveInstructions ( unsigned Nins)
inline

Definition at line 1525 of file ThreadSafetyTIL.h.

◆ reservePredecessors()

void BasicBlock::reservePredecessors ( unsigned NumPreds)

Definition at line 70 of file ThreadSafetyTIL.cpp.

◆ setTerminator()

void clang::threadSafety::til::BasicBlock::setTerminator ( Terminator * E)
inline

Definition at line 1495 of file ThreadSafetyTIL.h.

◆ successors() [1/2]

ArrayRef< BasicBlock * > clang::threadSafety::til::BasicBlock::successors ( )
inline

Definition at line 1489 of file ThreadSafetyTIL.h.

Referenced by numSuccessors().

◆ successors() [2/2]

ArrayRef< BasicBlock * > clang::threadSafety::til::BasicBlock::successors ( ) const
inline

Definition at line 1490 of file ThreadSafetyTIL.h.

◆ terminator() [1/2]

Terminator * clang::threadSafety::til::BasicBlock::terminator ( )
inline

Definition at line 1493 of file ThreadSafetyTIL.h.

◆ terminator() [2/2]

const Terminator * clang::threadSafety::til::BasicBlock::terminator ( ) const
inline

◆ traverse()

template<class V>
V::R_BasicBlock clang::threadSafety::til::BasicBlock::traverse ( V & Vs,
typename V::R_Ctx Ctx )
inline

Definition at line 1537 of file ThreadSafetyTIL.h.

References V.

◆ SCFG

friend class SCFG
friend

Definition at line 1567 of file ThreadSafetyTIL.h.

References SCFG.

Referenced by cfg(), cfg(), and SCFG.


The documentation for this class was generated from the following files: