TPDE
Loading...
Searching...
No Matches
tpde::FunctionWriter< Derived > Class Template Reference

Helper class to write function text. More...

#include <FunctionWriter.hpp>

Public Member Functions

SecRef get_sec_ref () const noexcept
 Get the SecRef of the current section.
 
DataSection & get_section () const noexcept
 Get the current section.
 
void switch_section (DataSection &new_section) noexcept
 Switch section writer to new section; must be flushed.
 
Text Writing
size_t offset () const noexcept
 Get the current offset into the section.
 
size_t allocated_size () const noexcept
 Get the current allocated size of the section.
 
u8 * begin_ptr () noexcept
 Pointer to beginning of section data.
 
u8 *& cur_ptr () noexcept
 
Labels
Label label_create () noexcept
 Create a new unplaced label.
 
void label_place (Label label, u32 off) noexcept
 Place unplaced label at the specified offset inside the section.
 
void label_ref (Label label, u32 off, LabelFixupKind kind) noexcept
 Reference label at given offset inside the code section.
 

Public Attributes

util::SmallVector< u32 > label_offsets
 Label offsets into section, ~0u indicates unplaced label.
 

Protected Attributes

util::SmallVector< LabelFixup > label_fixups
 Fixups for labels placed after their first use, processed at function end.
 
u32 growth_size = 0x10000
 Growth size for more_space; adjusted exponentially after every grow.
 

Detailed Description

template<typename Derived>
class tpde::FunctionWriter< Derived >

Helper class to write function text.

Definition at line 29 of file FunctionWriter.hpp.

Member Function Documentation

◆ cur_ptr()

template<typename Derived>
u8 *& tpde::FunctionWriter< Derived >::cur_ptr ( )
inlinenoexcept

Modifiable pointer to current writing position of the section. Must not be moved beyond the allocated region.

Definition at line 109 of file FunctionWriter.hpp.


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