IrBuilder

Undocumented in source.
struct IrBuilder {}

Members

Functions

addBasicBlock
IrIndex addBasicBlock()

Creates new block and inserts it after lastBasicBlock and sets lastBasicBlock

addBinBranch
IrIndex addBinBranch(IrIndex blockIndex, IrBinaryCondition cond, IrArgSize argSize, IrIndex arg0, IrIndex arg1, IrLabel trueExit, IrLabel falseExit)
Undocumented in source. Be warned that the author may not have intended to support it.
addBinBranch
IrIndex addBinBranch(IrIndex blockIndex, IrBinaryCondition cond, IrArgSize argSize, IrIndex arg0, IrIndex arg1)
Undocumented in source. Be warned that the author may not have intended to support it.
addBlockTarget
void addBlockTarget(IrIndex fromBasicBlockIndex, IrIndex toBasicBlockIndex)

Adds control-flow edge pointing fromBlock -> toBlock.

addJump
IrIndex addJump(IrIndex blockIndex)
Undocumented in source. Be warned that the author may not have intended to support it.
addJumpToLabel
void addJumpToLabel(IrIndex blockIndex, IrLabel label)
Undocumented in source. Be warned that the author may not have intended to support it.
addPhi
IrIndex addPhi(IrIndex blockIndex, IrIndex type, IrIndex var)
Undocumented in source. Be warned that the author may not have intended to support it.
addPhiArg
void addPhiArg(IrIndex phiIndex, IrIndex value)
Undocumented in source. Be warned that the author may not have intended to support it.
addReturn
void addReturn(IrIndex blockIndex, IrIndex returnValue)
Undocumented in source. Be warned that the author may not have intended to support it.
addReturn
void addReturn(IrIndex blockIndex)
Undocumented in source. Be warned that the author may not have intended to support it.
addUnaryBranch
IrIndex addUnaryBranch(IrIndex blockIndex, IrUnaryCondition cond, IrArgSize argSize, IrIndex arg0, IrLabel trueExit, IrLabel falseExit)
Undocumented in source. Be warned that the author may not have intended to support it.
addUnaryBranch
IrIndex addUnaryBranch(IrIndex blockIndex, IrUnaryCondition cond, IrArgSize argSize, IrIndex arg0)
Undocumented in source. Be warned that the author may not have intended to support it.
addUnreachable
void addUnreachable(IrIndex blockIndex)
Undocumented in source. Be warned that the author may not have intended to support it.
addUser
void addUser(IrIndex user, IrIndex used)

Puts user into a list of users of used value

addVirtualRegister
IrIndex addVirtualRegister(IrIndex definition, IrIndex type)

Creates virtual register to represent result of phi/instruction definition is phi/instruction that produces a value

allocateIrArray
IrIndex allocateIrArray(uint capacity)
Undocumented in source. Be warned that the author may not have intended to support it.
appendBasicBlockSlot
IrIndex appendBasicBlockSlot()
Undocumented in source. Be warned that the author may not have intended to support it.
appendBlockInstr
void appendBlockInstr(IrIndex blockIndex, IrIndex instr)

Adds instruction to the end of basic block Doesn't set any instruction info except prevInstr, nextInstr index

appendInstructionSlots
void appendInstructionSlots(uint numSlots)
Undocumented in source. Be warned that the author may not have intended to support it.
appendPayloadSlots
void appendPayloadSlots(uint numSlots)
Undocumented in source. Be warned that the author may not have intended to support it.
appendPhiSlot
IrIndex appendPhiSlot()
Undocumented in source. Be warned that the author may not have intended to support it.
appendStackSlot
IrIndex appendStackSlot(IrIndex type, SizeAndAlignment sizealign, StackSlotKind kind)
Undocumented in source. Be warned that the author may not have intended to support it.
appendVirtRegSlot
IrIndex appendVirtRegSlot()
Undocumented in source. Be warned that the author may not have intended to support it.
begin
void begin(IrFunction* ir, CompilationContext* context)

Must be called before compilation of each function. Allows reusing temp buffers. Sets up entry and exit basic blocks.

beginDup
void beginDup(IrFunction* ir, CompilationContext* context)

Copies ir data to the end of IR buffer, to allow for modification

beginLir
void beginLir(IrFunction* ir, IrFunction* oldIr, CompilationContext* c)

Must be called before IR to LIR pass

definitionOf
IrIndex definitionOf(IrIndex someIndex)
Undocumented in source. Be warned that the author may not have intended to support it.
emitInstr
auto emitInstr(IrIndex blockIndex, IrIndex[] args)
auto emitInstr(IrIndex blockIndex, ExtraInstrArgs extra, IrIndex[] args)

Returns InstrWithResult (if instr has result) or IrIndex instruction otherwise Always returns InstrWithResult when instruction has variadic result in this case result can be null if no result is requested Inserts instruction at the end of blockIndex See: ExtraInstrArgs

emitInstr
auto emitInstr(ExtraInstrArgs extra, IrIndex[] args)

ditto Only creates instruction, doesn't add to basic block

emitInstrAfter
auto emitInstrAfter(IrIndex instrAfter, ExtraInstrArgs extra, IrIndex[] args)

ditto, but inserts after instruction instead of block

emitInstrBefore
auto emitInstrBefore(IrIndex instrBefore, ExtraInstrArgs extra, IrIndex[] args)

ditto, but inserts before instruction

finalizeIr
void finalizeIr()

perfoms GC of removed entities

forceAllocLabelBlock
void forceAllocLabelBlock(IrLabel label, int newPredecessors)
Undocumented in source. Be warned that the author may not have intended to support it.
free
void free()
Undocumented in source. Be warned that the author may not have intended to support it.
insertAfterInstr
void insertAfterInstr(IrIndex afterInstr, IrIndex instr)

Inserts 'instr' after 'afterInstr'

insertBeforeInstr
void insertBeforeInstr(IrIndex beforeInstr, IrIndex instr)

Inserts 'instr' before 'beforeInstr'

insertBeforeLastInstr
void insertBeforeLastInstr(IrIndex blockIndex, IrIndex instr)

Inserts 'instr' before lastInstr of basic block 'blockIndex'

newIrVarIndex
IrIndex newIrVarIndex(IrIndex varType)

Allocates new variable id for this function. It should be bound to a variable and used with writeVariable, readVariable functions

prependBlockInstr
void prependBlockInstr(IrIndex blockIndex, IrIndex instr)

Adds instruction to the start of basic block Doesn't set any instruction info except prevInstr, nextInstr index

readVariable
IrIndex readVariable(IrIndex blockIndex, IrIndex var)

Returns the value that currently defines var within blockIndex

redirectVregDefinitionTo
void redirectVregDefinitionTo(IrIndex vreg, IrIndex redirectTo)

Redirects vreg definition to point to redirectTo

redirectVregUsersTo
void redirectVregUsersTo(IrIndex vreg, IrIndex redirectTo)

Replaces all 'vreg' uses with redirectTo

removeVirtualRegister
void removeVirtualRegister(IrIndex virtRegIndex)
Undocumented in source. Be warned that the author may not have intended to support it.
sealBlock
void sealBlock(IrIndex basicBlockToSeal, bool force)

Basic block is sealed if no further predecessors will be added to the block. Sealed block is not necessarily filled. Ignores already sealed blocks. force ignores IrBasicBlock.preventSeal

setupEntryExitBlocks
void setupEntryExitBlocks()
Undocumented in source. Be warned that the author may not have intended to support it.
tryExtendArray
bool tryExtendArray(IrIndex offset, uint capacity)
Undocumented in source. Be warned that the author may not have intended to support it.
writeVariable
void writeVariable(IrIndex blockIndex, IrIndex var, IrIndex value)

Redefines variable with value. Is used for assignment to variable

Variables

context
CompilationContext* context;
Undocumented in source.
ir
IrFunction* ir;
Undocumented in source.

Meta