ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Partitioner::BasicBlock Struct Reference

Represents a basic block within the Partitioner. More...

#include <Partitioner.h>

Collaboration diagram for Partitioner::BasicBlock:

Public Member Functions

 BasicBlock ()
 Constructor. More...
 
 ~BasicBlock ()
 Destructor. More...
 
bool valid_cache () const
 Returns true if the block analysis cache is up to date. More...
 
void invalidate_cache ()
 Marks the block analysis cache as being outdated. More...
 
void validate_cache ()
 Marks the block analysis cache as being up to date. More...
 
void clear_data_blocks ()
 Remove all data blocks from this basic block. More...
 
Instructionlast_insn () const
 Returns the last executed (exit) instruction of the block. More...
 
rose_addr_t address () const
 Returns the first address of a basic block. More...
 

Public Attributes

unsigned reason
 Reasons this block was created; SgAsmBlock::Reason bit flags. More...
 
std::vector< Instruction * > insns
 Non-empty set of instructions composing this basic block, in address order. More...
 
std::set< DataBlock * > data_blocks
 Data blocks owned by this basic block. More...
 
BlockAnalysisCache cache
 Cached results of local analyses. More...
 
Functionfunction
 Function to which this basic block is assigned, or null. More...
 
double code_likelihood
 Likelihood (0..1) that this is code. More...
 

Detailed Description

Represents a basic block within the Partitioner.

Each basic block will eventually become an SgAsmBlock node in the AST. However, if the SgAsmFunction::FUNC_LEFTOVER bit is set in the Partitioner::set_search() method then blocks that were not assigned to any function to not result in an SgAsmBlock node.

The first instruction of a basic block should never change. In particular, the address of the first instruction should not change because this address is used as a key to link a BasicBlock object to a Function object.

Definition at line 215 of file Partitioner.h.

Constructor & Destructor Documentation

Partitioner::BasicBlock::BasicBlock ( )
inline

Constructor.

This constructor should not be called directly since the Partitioner has other pointers that it needs to establish to this block. Instead, call Partitioner::find_bb_containing().

Definition at line 218 of file Partitioner.h.

Partitioner::BasicBlock::~BasicBlock ( )
inline

Destructor.

This destructor should not be called directly since there are other pointers to this block that the block does not know about. Instead, call Partitioner::discard().

Definition at line 222 of file Partitioner.h.

Member Function Documentation

bool Partitioner::BasicBlock::valid_cache ( ) const
inline

Returns true if the block analysis cache is up to date.

Definition at line 225 of file Partitioner.h.

References Partitioner::BlockAnalysisCache::age, cache, and insns.

Referenced by Partitioner::update_analyses().

void Partitioner::BasicBlock::invalidate_cache ( )
inline

Marks the block analysis cache as being outdated.

Definition at line 228 of file Partitioner.h.

References Partitioner::BlockAnalysisCache::age, and cache.

void Partitioner::BasicBlock::validate_cache ( )
inline

Marks the block analysis cache as being up to date.

Definition at line 231 of file Partitioner.h.

References Partitioner::BlockAnalysisCache::age, cache, and insns.

Referenced by Partitioner::update_analyses().

void Partitioner::BasicBlock::clear_data_blocks ( )

Remove all data blocks from this basic block.

The data blocks continue to exist, they're just no longer associated with this basic block.

Definition at line 525 of file Partitioner.C.

Referenced by Partitioner::discard(), and Partitioner::truncate().

Partitioner::Instruction * Partitioner::BasicBlock::last_insn ( ) const

Returns the last executed (exit) instruction of the block.

Definition at line 517 of file Partitioner.C.

Referenced by Partitioner::analyze_cfg(), Partitioner::discover_jump_table(), Partitioner::successors(), and Partitioner::update_analyses().

rose_addr_t Partitioner::BasicBlock::address ( ) const

Returns the first address of a basic block.

Since the instructions of a basic block are not necessarily monotonically increasing, the first address might not be the lowest address.

Definition at line 487 of file Partitioner.C.

Referenced by Partitioner::analyze_cfg(), Partitioner::append(), Partitioner::build_ast(), Partitioner::discard(), Partitioner::discover_blocks(), Partitioner::discover_first_block(), Partitioner::find_bb_starting(), Partitioner::FindInsnPadding::operator()(), Partitioner::FindThunks::operator()(), Partitioner::FindPostFunctionInsns::operator()(), Partitioner::post_cfg(), and Partitioner::remove().

Member Data Documentation

unsigned Partitioner::BasicBlock::reason

Reasons this block was created; SgAsmBlock::Reason bit flags.

Definition at line 239 of file Partitioner.h.

Referenced by Partitioner::append(), Partitioner::build_ast(), Partitioner::detach_thunk(), and Partitioner::post_cfg().

std::set<DataBlock*> Partitioner::BasicBlock::data_blocks

Data blocks owned by this basic block.

E.g., this block's jump table.

Definition at line 241 of file Partitioner.h.

Referenced by Partitioner::append(), Partitioner::build_ast(), Partitioner::function_extent(), and Partitioner::remove().

double Partitioner::BasicBlock::code_likelihood

Likelihood (0..1) that this is code.

One unless detected statistically.

Definition at line 244 of file Partitioner.h.

Referenced by Partitioner::build_ast().


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