CodeRegion.xcc
Benoit Dupont de Dinechin (Benoit.Dupont-de-Dinechin@st.com).
Copyright 2002 - 2007 STMicroelectronics. Copyright 1995 - 1998 Commissariat a l'Energie Atomique.
This program is free software; you can redistribute it and/or modify it under the terms of either (at your option): the GNU General Public License (GPL) version 2; the GNU Lesser General Public License (LGPL) version 2.1; any later version of these licences as published by the Free Software Foundation.
CodeRegion— Code region inside a Procedure.
A CodeRegion provides a scope for partitioning the compilation of a Procedure.
struct CodeRegion_;
CodeRegion_procedure— This CodeRegion Procedure.
struct Procedure_ * CodeRegion_procedure(CodeRegion this);
CodeRegion_selector— This CodeRegion Selector.
Selector CodeRegion_selector(CodeRegion this);
CodeRegion_convention— This CodeRegion Convention.
Convention CodeRegion_convention(CodeRegion this);
CodeRegion_processor— This CodeRegion Processor.
Processor CodeRegion_processor(CodeRegion this);
CodeRegion_rootBlock— Root BasicBlock used to attach BasicBlock(s) to this CodeRegion.
The root BasicBlock is not linked to others by BasicBlock_next and BasicBlock_prev.
BasicBlock CodeRegion_rootBlock(CodeRegion this);
CodeRegion_FORENTER_BasicBlock— Enumerate the entering blocks of this CodeRegion.
#define CodeRegion_FORENTER_BasicBlock(this, basicBlock) { \ BasicBlock CodeRegion_ROOTBLOCK = CodeRegion_rootBlock(this); \ BasicBlock_LEAVE_FOREACH_BasicBlockEdge(CodeRegion_ROOTBLOCK, CodeRegion_SUCCESSOR) { \ BasicBlock basicBlock = BasicBlockEdge_destBlock(CodeRegion_SUCCESSOR); #define CodeRegion_ENDENTER_BasicBlock \ } BasicBlock_LEAVE_ENDEACH_BasicBlockEdge; \ }
CodeRegion_leaveFirst— For use by CodeRegion_FORLEAVE_BasicBlock.
BasicBlockEdge CodeRegion_leaveFirst(CodeRegion this);
CodeRegion_FORLEAVE_BasicBlock— Enumerate the leaving blocks of this CodeRegion.
#define CodeRegion_FORLEAVE_BasicBlock(this, basicBlock) { \ BasicBlockEdge CodeRegion_LEAVENEXT = NULL; \ BasicBlockEdge CodeRegion_LEAVEEDGE = CodeRegion_leaveFirst(this); \ for (; CodeRegion_LEAVEEDGE != NULL; CodeRegion_LEAVEEDGE = CodeRegion_LEAVENEXT) { \ BasicBlock basicBlock = BasicBlockEdge_ORIGBLOCK(CodeRegion_LEAVEEDGE); \ CodeRegion_LEAVENEXT = BasicBlockEdge_ENTERNEXT(CodeRegion_LEAVEEDGE); #define CodeRegion_ENDLEAVE_BasicBlock \ } \ }
CodeRegion_regionId— The identifier of this CodeRegion.
intptr_t CodeRegion_regionId(const_CodeRegion this);
CodeRegion_blockTableBase— Base of BasicBlock(s) mapping array.
const BasicBlock * CodeRegion_blockTableBase(const_CodeRegion this);
CodeRegion_blockCount— Number of BasicBlock(s) in this CodeRegion.
The count includes the CodeRegion_rootBlock.
int32_t CodeRegion_blockCount(const_CodeRegion this);
CodeRegion_firstBlock— For use by CodeRegion_FOREACH_BasicBlock.
BasicBlock CodeRegion_firstBlock(const_CodeRegion this);
CodeRegion_pastBlock— For use by CodeRegion_FOREACH_BasicBlock.
BasicBlock CodeRegion_pastBlock(const_CodeRegion this);
CodeRegion_FOREACH_BasicBlock— Iterate this CodeRegion BasicBlock(s).
Does not include the CodeRegion_rootBlock in iteration.
#define CodeRegion_FOREACH_BasicBlock(this, basicBlock) { \ BasicBlock CodeRegion_PASTBLOCK = CodeRegion_pastBlock(this); \ BasicBlock basicBlock = CodeRegion_firstBlock(this); \ for (; basicBlock != CodeRegion_PASTBLOCK; \ basicBlock = BasicBlock_next(basicBlock)) { \ Except_CHECK(BasicBlock_index(basicBlock) > 0); \ Except_CHECK(BasicBlock_index(basicBlock) < CodeRegion_blockCount(this)); \ { #define CodeRegion_ENDEACH_BasicBlock \ } \ } \ }
CodeRegion_globalTable— This CodeRegion GLOBALTABLE.
TemporaryTable CodeRegion_globalTable(CodeRegion this);
CodeRegion_variables— This CodeRegion VARIABLES.
IBList CodeRegion_variables(CodeRegion this);
CodeRegion_FOREACH_Variable -- Iterate this CodeRegion Variable(s).
Caution: also includes unused Variable(s) in iteration.
#define CodeRegion_FOREACH_Variable(this, variable) \ IBList_FOREACH(CodeRegion_variables(this), Variable_, variable) #define CodeRegion_ENDEACH_Variable \ IBList_ENDEACH;
CodeRegion_setLiveSets— Set this CodeRegion live-out sets.
void CodeRegion_setLiveSets(CodeRegion this, int32_t liveCount, TemporarySet_ *liveInSets, TemporarySet_ *liveOutSets, TemporarySet_ *phiInSets, TemporarySet_ *phiOutSets); #define CodeRegion_resetLiveSets(this) \ CodeRegion_setLiveSets(this, 0, NULL, NULL, NULL, NULL)
CodeRegion_ssaForm— This CodeRegion SSAForm.
struct SSAForm_ * CodeRegion_ssaForm(const_CodeRegion this);
CodeRegion_setSSAForm— Set this CodeRegion SSAForm.
void CodeRegion_setSSAForm(CodeRegion this, struct SSAForm_ *ssaForm); #define CodeRegion_resetSSAForm(this) \ CodeRegion_setSSAForm(this, NULL);
CodeRegion_regionFlow— This CodeRegion RegionFlow.
struct RegionFlow_ * CodeRegion_regionFlow(CodeRegion this);
CodeRegion_setRegionFlow— Set this CodeRegion RegionFlow.
void CodeRegion_setRegionFlow(CodeRegion this, struct RegionFlow_ *regionFlow);
CodeRegion_makeTraceId— Make a new traceId from this CodeRegion TRACECOUNTER.
intptr_t CodeRegion_makeTraceId(CodeRegion this);
CodeRegion_resetTraceCounter— Reset this CodeRegion TRACECOUNTER.
void CodeRegion_resetTraceCounter(CodeRegion this);
CodeRegion_optimize— This CodeRegion Optimize.
Optimize CodeRegion_optimize(CodeRegion this);
CodeRegion_configure— This CodeRegion Configure.
Configure CodeRegion_configure(CodeRegion this);
CodeRegion_makeBasicBlock— Make a BasicBlock inside this CodeRegion.
- Require
- Procedure_buildCodeRegions called and not a CodeRegion entry or exit.
BasicBlock CodeRegion_makeBasicBlock(CodeRegion this, float frequency);
CodeRegion_splitBasicBlock— Split a BasicBlock and return the second half.
BasicBlock CodeRegion_splitBasicBlock(CodeRegion this, BasicBlock basicBlock, int32_t count);
CodeRegion_splitBasicBlocks— Split the BasicBlock(s) of this CodeRegion.
int32_t CodeRegion_splitBasicBlocks(CodeRegion this, int32_t count);
CodeRegion_setEnterBlock— Set a BasicBlock as entering this CodeRegion.
void CodeRegion_setEnterBlock(CodeRegion this, BasicBlock basicBlock);
CodeRegion_setLeaveBlock— Set a BasicBlock as leaving this CodeRegion.
void CodeRegion_setLeaveBlock(CodeRegion this, BasicBlock basicBlock);
CodeRegion_expandGenerics— Walks every instruction in the region and expands all generics to their associated code sequences.
void CodeRegion_expandGenerics(CodeRegion this);
CodeRegion_makeGlobalTable— Make this CodeRegion GLOBALTABLE.
The GLOBALTABLE is a TemporaryTable that provides dense INDEXing of global
Temporary(ies) and is also useful as a ground set for TemporarySparse sets. In
particular, the GLOBALTABLE is the ground set used by Liveness and SSAConstruct. In
case a Temporary has a Register assigned, the representative dedicated Temporary is
used instead. This means that Temporary(ies) with an assigned Register are never
entered into the GLOBALTABLE. In addition, we only enter in the GLOBALTABLE whose flags
in flagsMask
match the value in flagsValue
. As a side-effect of this function, the
TemporaryFlag_Global
is cleared for each Temporary.
The GLOBALTABLE is filled using Briggs, Cooper, Simpson algorithm to compute non-locals given in "Practical Improvements to the Construction and Destruction of Static Single Assignment Form". The killed set of this algorithm is represented by combining the TemporaryStack killed and the TemporaryFlag_Killed. Using this flag prevents multiple pushes of the same Temporary and we check this flag by taking advantage of the existing test for matching flagsMask and flagsValue in Temporary_FLAGS.
The returned table may only include register temporaries (Temporary_hasRegFile()).
TemporaryTable CodeRegion_makeGlobalTable(CodeRegion this, TemporaryFlags flagsMask, TemporaryFlags flagsValue);
CodeRegion_makeVariableTemporary -- Make a new SSA variable Temporary.
The created Variable Temporary has same Temporary_INDEX as +origin+.
Temporary CodeRegion_makeVariableTemporary(CodeRegion this, Temporary origin);
CodeRegion_makeConsumers— Make the CONSUMERS for this CodeRegion Variable(s).
Get the Variable(s) from the TemporaryTable else from the CodeRegion.
void CodeRegion_makeConsumers(CodeRegion this, TemporaryTable table);
CodeRegion_addtoNativeStream— Add this CodeRegion to a NativeStream.
void CodeRegion_addtoNativeStream(CodeRegion this, NativeStream stream);
CodeRegion_computePressures— Compute register pressures.
void CodeRegion_computePressures(const_CodeRegion this, int *actual, int *virtual);
CodeRegion_pretty— Pretty-print this CodeRegion.
bool CodeRegion_pretty(CodeRegion this, FILE *file);
CodeRegion_prettyVCG— Print VCG graph of this code region.
bool CodeRegion_prettyVCG(CodeRegion this, FILE *file, const char *name);