GTPin: gtpin::IGtCfg Class Reference

GTPin

- Main Page
- Related Pages
- Modules
- Data Structures

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

Public Member Functions
gtpin::IGtCfg Class Reference
Control Flow Inspection

Class that represents a control flow graph (CFG) and provides the code traversal interface. More...

`#include <igt_cfg.h>`

## Public Member Functions
virtual BblSpan | Bbls () const =0
| Return sequence of basic blocks in the fallthrough order.
virtual FunctionSpan | Functions () const =0
| Return sequence of functions in this CFG.
virtual BblSpan | EntryBbls () const =0
| Return sequence of entry basic blocks.
virtual BblSpan | ExitBbls () const =0
| Return sequence of EOT basic blocks.
virtual bool | IsEmpty () const =0
| Return true, if this CFG is empty.
virtual uint32_t | NumBbls () const =0
| Return number of BBLs in this CFG.
virtual uint32_t | NumFunctions () const =0
| Return number of functions in this CFG.
virtual const IGtIns & | GetInstruction (InsId insId) const =0
| Given identifier of an instruction, return reference to the corresponding IGtIns object.
virtual const IGtBbl & | GetBbl (BblId bblId) const =0
| Given identifier of a basic block, return reference to the corresponding IGtBbl object.
virtual const IGtFunction & | GetFunction (FunctionId funcId) const =0
| Given identifier of a function, return reference to the corresponding IGtFunction object.
virtual const IGtBbl & | GetBbl (const IGtIns &ins) const =0
| Get basic block the specified instruction belongs to.
virtual const IGtFunction * | FindFunction (const IGtIns &ins) const =0
| Get function that contains the specified instruction.
virtual const IGtFunction & | GetMainFunction () const =0
| Get the main kernel function.
virtual ImgOffset | GetInstructionOffsetInFunction (const IGtIns &ins) const =0
| Get the offset of the specified instruction within the function it belongs to.
virtual ImgOffset | GetInstructionOffset (const IGtIns &ins) const =0
| Get the offset of the specified instruction within the kernel binary.

## Detailed Description

Class that represents a control flow graph (CFG) and provides the code traversal interface.

Availability:
  - IGtTool::OnKernelBuild

## Member Function Documentation

virtual const IGtFunction* gtpin::IGtCfg::FindFunction | ( | const IGtIns & | ins | ) | const`[pure virtual]`

Get function that contains the specified instruction.

Returns:
  Pointer to the requested function, or null pointer if such function is not found

virtual const IGtBbl& gtpin::IGtCfg::GetBbl | ( | BblId | bblId | ) | const`[pure virtual]`

Given identifier of a basic block, return reference to the corresponding IGtBbl object.

Precondition:
  bblId.IsValid()

virtual const IGtBbl& gtpin::IGtCfg::GetBbl | ( | const IGtIns & | ins | ) | const`[pure virtual]`

Get basic block the specified instruction belongs to.

Precondition:
  ins.Id().IsValid()

Returns:
  reference to the requested basic block

virtual const IGtFunction& gtpin::IGtCfg::GetFunction | ( | FunctionId | funcId | ) | const`[pure virtual]`

Given identifier of a function, return reference to the corresponding IGtFunction object.

Precondition:
  funcId.IsValid()

virtual const IGtIns& gtpin::IGtCfg::GetInstruction | ( | InsId | insId | ) | const`[pure virtual]`

Given identifier of an instruction, return reference to the corresponding IGtIns object.

Precondition:
  insId.IsValid()

virtual ImgOffset gtpin::IGtCfg::GetInstructionOffset | ( | const IGtIns & | ins | ) | const`[pure virtual]`

Get the offset of the specified instruction within the kernel binary.

Returns:
  Offset of the specified instruction within the kernel binary, as provided by the IgtKernel::Binary() function. For instruction that does not belong to this CFG, the returned value is ImgOffset::Invalid().

Note:
  This function should not be used to associate IGtIns object with the corresponding instruction in the program's ELF, because it does not indicate which ELF section contains this instruction. Instead, GetFunction() and GetInstructionOffsetInFunction() functions can be used to look up ELF information associated with the instruction.
  For monolithic kernels that consist of a single (main) function, both GetInstructionOffsetInFunction() and GetInstructionOffset() return the same value

virtual ImgOffset gtpin::IGtCfg::GetInstructionOffsetInFunction | ( | const IGtIns & | ins | ) | const`[pure virtual]`

Get the offset of the specified instruction within the function it belongs to.

Returns:
  Offset of the specified instruction relative to the beginning of the function it belongs to. For instruction that does not belong to any function of this CFG, the returned value is ImgOffset::Invalid().

virtual const IGtFunction& gtpin::IGtCfg::GetMainFunction | ( |  | ) | const`[pure virtual]`

Get the main kernel function.

Precondition:
  This CFG is not empty

Returns:
  Reference to the main kernel function

All Data Structures Functions Variables Typedefs Enumerations Enumerator

      Copyright (C) 2013-2025 Intel Corporation

      SPDX-License-Identifier: MIT