GTPin
Public Member Functions
gtpin::IGtRegAllocator Class Reference

Register allocation interface. More...

#include <igt_reg_allocator.h>

Public Member Functions

virtual bool Reserve (GtVregNum vn)=0
 Assign an available physical register (preg) to the specified virtual register (vreg)
virtual bool ReserveAll ()=0
 Assign physical registers to all currently defined virtual registers that are not yet assigned.
virtual const GtRegGetReserved (GtVregNum vn) const =0
 Get physical register assigned to the specified virtual register.
virtual void ReleaseReserved (GtVregNum vn)=0
 Remove assignment of a physical register to the specified virtual register, if any.
virtual void ReleaseAllReserved ()=0
 Remove all physical-to-virtual register assignments.
virtual bool ReserveVregOperands (const IGtGenProcedure &proc)=0
 Assign physical registers to all virtual registers used in the specified procedure.

Detailed Description

Register allocation interface.

Normally, GTPin allocates registers when the tool finishes instrumentation of the original code. This process is triggered automatically, without any tool's guidance.
The register allocation algorithm analyses register liveness in each instrumentation point, so that the same virtual register can be assigned to different physical registers in different points. However, if needed, the tool can use the IGtRegAllocator interface to allocate physical register (preg) for a virtual register (vreg) globally, so that the same preg will represent vreg in all instrumentation procedures.
Note, such global assignments restrict flexibility of the register allocator in GTPin, so, in general, using the instrumentation-time register allocation is discouraged. It is only recommended for tools, that need to enforce minimal overhead of a specific instrumentation procedure.

Availability:

Member Function Documentation

virtual const GtReg* gtpin::IGtRegAllocator::GetReserved ( GtVregNum  vn) const [pure virtual]

Get physical register assigned to the specified virtual register.

Parameters:
[in]vnIdentifier of the virtual register being queried
Returns:
Physical register allocated for the specified virtual register. Return nullptr, if this virtual register is not (yet) reserved.
virtual void gtpin::IGtRegAllocator::ReleaseReserved ( GtVregNum  vn) [pure virtual]

Remove assignment of a physical register to the specified virtual register, if any.

Parameters:
[in]vnIdentifier of the virtual register to be released
virtual bool gtpin::IGtRegAllocator::Reserve ( GtVregNum  vn) [pure virtual]

Assign an available physical register (preg) to the specified virtual register (vreg)

The assignment is global: preg will represent vreg in all instrumentation procedures.

Parameters:
[in]vnIdentifier of the virtual register to be assigned
Returns:
true - success, false - no appropriate free physical register is found
virtual bool gtpin::IGtRegAllocator::ReserveAll ( ) [pure virtual]

Assign physical registers to all currently defined virtual registers that are not yet assigned.

The assignments are global: each vreg will be represented by the same preg in all instrumentation procedures.

Returns:
true - success, false - some virtual registers could not be assigned because no appropriate free physical registers are found. Note, even if the function fails, it attempts to allocate as many vregs as possible.
virtual bool gtpin::IGtRegAllocator::ReserveVregOperands ( const IGtGenProcedure proc) [pure virtual]

Assign physical registers to all virtual registers used in the specified procedure.

Parameters:
[in]procProcedure in which vregs should be allocated
Returns:
true - success, false - virtual operands could not be assigned because no appropriate free physical registers are found. Note, if the function fails, the state of register allocations remains unchaged.
 All Data Structures Functions Variables Typedefs Enumerations Enumerator


  Copyright (C) 2013-2025 Intel Corporation
SPDX-License-Identifier: MIT