Otawa
0.10
|
This module addresses the problem of the use of flow facts in OTAWA. More...
Classes | |
class | otawa::FlowFactLoader |
This class is an abstract class to monitor the load of flow facts. More... | |
Functions | |
Identifier< Path > | otawa::FLOW_FACTS_PATH ("otawa::FLOW_FACTS_PATH","") |
This property may be used in the configuration of a code processor to pass the path of an flow fact file containing flow facts. More... | |
Identifier< xom::Element * > | otawa::FLOW_FACTS_NODES ("otawa::FLOW_FACTS_NODES") |
This property may be used in the configuration of a code processor to directly pass an xml element containing flow facts in Flow Fact XML format format. More... | |
Feature< FlowFactLoader > | otawa::FLOW_FACTS_FEATURE ("otawa::FLOW_FACTS_FEATURE") |
This feature ensures that the flow facts has been loaded. More... | |
Identifier< bool > | otawa::IS_RETURN ("otawa::IS_RETURN", false) |
Put on a control flow instruction, this shows that this instruction is equivalent to a function return. More... | |
Identifier< bool > | otawa::NO_RETURN ("otawa::NO_RETURN", false) |
This annotation is put on the first instruction of functions that does not never return. More... | |
Identifier< int > | otawa::MAX_ITERATION ("otawa::MAX_ITERATION",-1) |
Put on the first instruction of a loop, it gives the maximum number of iteration of this loop. More... | |
Identifier< bool > | otawa::FLOW_FACTS_MANDATORY ("otawa::FLOW_FACTS_MANDATORY", false) |
In configuration of the FlowFactLoader, makes it fail if no flow fact fail is available. More... | |
Identifier< bool > | otawa::NO_CALL ("otawa::NO_CALL", false) |
Put on the first instruction of a function that must be no called. More... | |
Identifier< bool > | otawa::NO_INLINE ("otawa::NO_INLINE") |
Put on the first instruction of a function to indicate whether it should be inlined or not during virtualization. More... | |
Identifier< bool > | otawa::INLINING_POLICY ("otawa::INLINING_POLICY") |
Put on the first instruction of a function to set default inlining behavior during its virtualization. More... | |
Identifier< bool > | otawa::IGNORE_CONTROL ("otawa::IGNORE_CONTROL", false) |
Put on a control instruction to prevent it to be interpreted as is. More... | |
Identifier< bool > | otawa::IGNORE_SEQ ("otawa::IGNORE_SEQ", false) |
Put on a control instruction to prevent to pass in sequence. More... | |
Identifier< Address > | otawa::BRANCH_TARGET ("otawa::BRANCH_TARGET", Address()) |
Put on instruction that may branch to several targets or whose target computation cannot computed. More... | |
Identifier< Address > | otawa::CALL_TARGET ("otawa::CALL_TARGET", Address()) |
Put on instruction that may call to several targets or whose target computation cannot computed. More... | |
Identifier< bool > | otawa::PRESERVED ("otawa::PRESERVED", false) |
Put on instruction that must preserved from the mkff special flow-fact detection. More... | |
Identifier< int > | otawa::MIN_ITERATION ("otawa::MIN_ITERATION",-1) |
Put on the first instruction of a loop, it gives the minimal number of iterations. More... | |
Identifier< int > | otawa::TOTAL_ITERATION ("otawa::TOTAL_ITERATION",-1) |
Put on the first instruction of a loop, it gives the total number of iterations during the whole execution of the program. More... | |
Identifier< bool > | otawa::IGNORE_ENTRY ("otawa::IGNORE_ENTRY", false) |
Put on function symbol that must be ignored as function entry. More... | |
Identifier< Pair< Address, Address > > | otawa::ACCESS_RANGE ("otawa::ACCESS_RANGE") |
Put on a memory access instruction, provides a range of possible accesses. More... | |
Variables | |
Identifier< Path > | otawa::FLOW_FACTS_PATH |
This property may be used in the configuration of a code processor to pass the path of an flow fact file containing flow facts. More... | |
Identifier< xom::Element * > | otawa::FLOW_FACTS_NODES |
This property may be used in the configuration of a code processor to directly pass an xml element containing flow facts in Flow Fact XML format format. More... | |
Feature< FlowFactLoader > | otawa::FLOW_FACTS_FEATURE |
This feature ensures that the flow facts has been loaded. More... | |
Identifier< bool > | otawa::IS_RETURN |
Put on a control flow instruction, this shows that this instruction is equivalent to a function return. More... | |
Identifier< bool > | otawa::NO_RETURN |
This annotation is put on the first instruction of functions that does not never return. More... | |
Identifier< int > | otawa::MAX_ITERATION |
Put on the first instruction of a loop, it gives the maximum number of iteration of this loop. More... | |
Identifier< bool > | otawa::FLOW_FACTS_MANDATORY |
In configuration of the FlowFactLoader, makes it fail if no flow fact fail is available. More... | |
Identifier< bool > | otawa::NO_CALL |
Put on the first instruction of a function that must be no called. More... | |
Identifier< bool > | otawa::NO_INLINE |
Put on the first instruction of a function to indicate whether it should be inlined or not during virtualization. More... | |
Identifier< bool > | otawa::INLINING_POLICY |
Put on the first instruction of a function to set default inlining behavior during its virtualization. More... | |
Identifier< bool > | otawa::IGNORE_CONTROL |
Put on a control instruction to prevent it to be interpreted as is. More... | |
Identifier< bool > | otawa::IGNORE_SEQ |
Put on a control instruction to prevent to pass in sequence. More... | |
Identifier< Address > | otawa::BRANCH_TARGET |
Put on instruction that may branch to several targets or whose target computation cannot computed. More... | |
Identifier< Address > | otawa::CALL_TARGET |
Put on instruction that may call to several targets or whose target computation cannot computed. More... | |
Identifier< bool > | otawa::PRESERVED |
Put on instruction that must preserved from the mkff special flow-fact detection. More... | |
Identifier< int > | otawa::MIN_ITERATION |
Put on the first instruction of a loop, it gives the minimal number of iterations. More... | |
Identifier< int > | otawa::TOTAL_ITERATION |
Put on the first instruction of a loop, it gives the total number of iterations during the whole execution of the program. More... | |
Identifier< bool > | otawa::IGNORE_ENTRY |
Put on function symbol that must be ignored as function entry. More... | |
Identifier< Pair< Address, Address > > | otawa::ACCESS_RANGE |
Put on a memory access instruction, provides a range of possible accesses. More... | |
This module addresses the problem of the use of flow facts in OTAWA.
As this kind of information may be provided by the user or external tools, OTAWA accepts several formats of input :
During the work of OTAWA, the load of this file is performed using a special code processor: otawa::util::FlowFactLoader.
Flow facts are usually hooked as properties to the program part they apply to. Below is the list of properties set as flow facts.
{.ffx}, provide the expressivity of XML applied to the expression of flow facts.The top level element must be
{flowfacts}:The different element of this XML flow fact description usually designs some location in the program code. There are is different ways to describe code locations (as shown below) and the syntax, based on attributes of the elements, is shared by most flow fact elements.In the following location forms, the used integers may have the following forms:
This is the simplest way to design a code piece just by its address. This address represents an integer coded as above. As this way is not very human compliant, you may prefer one of the following form.
This form provide a bit more portability and usability as the previous one. The address is represented as a label found in the code (usually a function label) and a signed integer offset to add to or substract from the label address. This location may be useful for symbol found in libraries. As the actual address is not known before program linkage, the location may be used and remains valid after linkage.
This form provides a way to define a memory area in a single step. The defined memory area begins by the address of symbol
and its size is size
of it is defined or the size of the symbol
.
This is the most advanced to locate code using the source file name and the line of the designed program part. Yet, according to the way the code is written (many source constructor on one line or use of macros) and to the performed optimization, this method may be imprecise as a a source line may match different parts in the code.In the remaining of the document, the location defines above are identified by the keyword LOCATION
in the element attributes.
Inside the flowfacts
elements, the FFX format accepts the following components.
This flow fact inform that the located function never return. This may be helpful for function as the C library "_exit".
When OTAWA encounters a call to the located function, it will be ignored.
When virtualizing, calls to the located function will be inlined.
When virtualizing, calls to the located function will not be inlined.
When virtualizing the located function, default policy will be set to true.
memory access INST_ADDRESS1 LOW_ADDRESS .. HIGH_ADDRESS [in STEP1 / STEP2 / ...] ;
memory TYPE ADDRESS = VALUE ;
When virtualizing the located function, default policy will be set to false.
This flow fact informs that the CONTENT elements are applied to the located function. This element is mainly used to build function call contextual flow fact.
This element allows to put iteration limits on bounds. The LOCATION designs the header of the loop. maxcount
gives the maximal number of iteration per loop start and totalcount
gives the total number of loop iteration for the whole program execution. At least one of them must be given.
In some executable files, symbols are marked as function entries but are not, possibly causing problems in instruction decoding. This problem may be avoided by marking such symbols with this directive.
The instruction at the given location is considered as a return. This element may be useful with languages where control management and computation is melted. For example, the ARM allows to store the return address of a function call out of the usual link register and move of a register value in the PC may as well be considered as an indirect call as a return.
The function
element content may be either loop
elements as given above or call
elements.
This element represents a function call inside an existing function. The LOCATION gives the address of the called function. The content is the same as of a function
, that is, loop
and call
elements. The embedding of calls allows to build function call contexts to make the loop bounds context aware and tighten the WCET.
This element is used to resolve a complex control to several targets (case of indirect branch found in switch compilation using tables). The first LOCATION is the control instruction itself and the target child elements locations represents the different possible targets.
This element is used to resolve a complex control to several targets (case of function pointer calls). The first LOCATION is the call instruction itself and the target child elements locations represents the different possible targets.
This element is used to ignore the control effect of the instruction at LOCATION.
This element is used to force instruction at LOCATION to be considered as an unconditional branch. Can only be put on a conditional branch instruction.
Top-level element support also the following extension elements (not included in the FFX format):
Allow to bound the accessed addresses of a memory instruction. When multiple areas are defined, they are joined to a single continuous area! Mainly useful to help data cache analysis.
Set the value of a register. name is the name of the register.
Set the value of a kind of memory. The LOCATION attributes gives the address of the accessed memory and type defines the type of data among int8, int16, int32, int64, uint8, uint16, uint32 and uint64.VALUE may be one of:
Declare a simple integer value or an address.
A range of integer or of addresses.
Declare a CLP (b, d, n) of base the location attributes, step and count and denotes the set { b + k d / 0 <= j <= n }.
F4 is a simple plain text format. It may contain comments a-la C++, that is, one line comments prefixed by "//" or enclosed comments between "/ *" and "* /"." Spaces and line format are not meaningful for other commands. In the following description, upper case words represents variable part of the command, i.e. sub-rules of grammar. If such a token is prefixed by a name followed by ":", this name is used to identify the token in subsequent description.
loop ADDRESS COUNT ;
loop ADDRESS ... in STEP1 / STEP2 / ...;
loop ADDRESS [max MAX] [total TOTAL] [in ...]
loop
allows also to select the TOTAL number of iterations for the whole task run.checksum VALUE ;
return ADDRESS ;
noreturn FUNCTION_ADDRESS ;
ignorecontrol ADDRESS ;
ignoreseq ADDRESS ;
multibranch ADDRESS to ADDRESS, ADDRESS, ... ;
multicall ADDRESS to ADDRESS, ADDRESS, ... ;
nocall FUNCTION_ADDRESS ;
doinline FUNCTION_ADDRESS ;
noinline FUNCTION_ADDRESS ;
inlining-on FUNCTION_ADDRESS ;
inlining-off FUNCTION_ADDRESS ;
preserve ADDRESS ;
ignore entry STRING;
library;
FUNCTION_ADDRESS may have one of the following form:
STEP may have one of the following form:
ADDRESS may have one of the following form:
+
INTEGER: address relative to a label, -
INTEGER: address back-relative to a label.INTEGER may have one of the following form:
0
{OCTAL_DIGIT}+: octal integer 0x
{HEXADECIMAL_DIGIT}+: hexadecimal integer 0b
{BINARY_DIGIT}+: binary integerThis example shows a program composed of two function, "main" and "ludcmp" containing nested loops.
memory access iaddr: ADDRESS .. lo: ADDRESS .. hi: ADDRESS ;
reg NAME = DATA ;
Allows to assign a value to a register. This value may be a simple integer or an address.mem [TYPE] ADDRESS = DATA ; Assign a value in memory.TYPE may be one int8
, uint8
, int816
, uint16
, int32
, uint32
, int64
, uint64
, float32
or float64
. DATA supports several forms described below.
DATA a bit complex but allows a lot of flexibility:
ADDRESS – the easier form, a simple integer or an address,
[ ADDRESS .. ADDRESS ] – an integer or address interval,
( ADDRESS, INTEGER, INTEGER ) – a CLP triple (b, d, n) representing the integer set { b + k d / 0 <= k <= n }.
Identifier<Pair<Address, Address> > otawa::ACCESS_RANGE | ( | "otawa::ACCESS_RANGE" | ) |
Put on a memory access instruction, provides a range of possible accesses.
Identifier<Address> otawa::BRANCH_TARGET | ( | "otawa::BRANCH_TARGET" | , |
Address() | |||
) |
Put on instruction that may branch to several targets or whose target computation cannot computed.
There is one property with this identifier for each branched target.
Identifier<Address> otawa::CALL_TARGET | ( | "otawa::CALL_TARGET" | , |
Address() | |||
) |
Put on instruction that may call to several targets or whose target computation cannot computed.
There is one property with this identifier for each called target.
Feature<FlowFactLoader> otawa::FLOW_FACTS_FEATURE | ( | "otawa::FLOW_FACTS_FEATURE" | ) |
This feature ensures that the flow facts has been loaded.
Currrently, only the otawa::util::FlowFactLoader provides this kind of information from F4 files.
Identifier<bool> otawa::FLOW_FACTS_MANDATORY | ( | "otawa::FLOW_FACTS_MANDATORY" | , |
false | |||
) |
In configuration of the FlowFactLoader, makes it fail if no flow fact fail is available.
Identifier<xom::Element *> otawa::FLOW_FACTS_NODES | ( | "otawa::FLOW_FACTS_NODES" | ) |
This property may be used in the configuration of a code processor to directly pass an xml element containing flow facts in Flow Fact XML format format.
Several properties with this identifier may be passed.
Identifier<Path> otawa::FLOW_FACTS_PATH | ( | "otawa::FLOW_FACTS_PATH" | , |
"" | |||
) |
This property may be used in the configuration of a code processor to pass the path of an flow fact file containing flow facts.
Several properties with this identifier may be passed.
Identifier<bool> otawa::IGNORE_CONTROL | ( | "otawa::IGNORE_CONTROL" | , |
false | |||
) |
Put on a control instruction to prevent it to be interpreted as is.
Identifier<bool> otawa::IGNORE_ENTRY | ( | "otawa::IGNORE_ENTRY" | , |
false | |||
) |
Put on function symbol that must be ignored as function entry.
It mainly used to avoid problems with executable files containing symbols marked as function that are in fact data.
Identifier<bool> otawa::IGNORE_SEQ | ( | "otawa::IGNORE_SEQ" | , |
false | |||
) |
Identifier<bool> otawa::INLINING_POLICY | ( | "otawa::INLINING_POLICY" | ) |
Put on the first instruction of a function to set default inlining behavior during its virtualization.
This overrides VIRTUAL_INLINING default policy of Virtualizer.
Identifier<bool> otawa::IS_RETURN | ( | "otawa::IS_RETURN" | , |
false | |||
) |
Put on a control flow instruction, this shows that this instruction is equivalent to a function return.
It may be useful with assembly providing very complex ways to express a function return.
Identifier<int> otawa::MAX_ITERATION | ( | "otawa::MAX_ITERATION" | , |
- | 1 | ||
) |
Put on the first instruction of a loop, it gives the maximum number of iteration of this loop.
Identifier<int> otawa::MIN_ITERATION | ( | "otawa::MIN_ITERATION" | , |
- | 1 | ||
) |
Put on the first instruction of a loop, it gives the minimal number of iterations.
Identifier<bool> otawa::NO_CALL | ( | "otawa::NO_CALL" | , |
false | |||
) |
Put on the first instruction of a function that must be no called.
Identifier<bool> otawa::NO_INLINE | ( | "otawa::NO_INLINE" | ) |
Put on the first instruction of a function to indicate whether it should be inlined or not during virtualization.
This overrides VIRTUAL_INLINING default policy of Virtualizer and INLINING_POLICY of the caller CFG.
Identifier<bool> otawa::NO_RETURN | ( | "otawa::NO_RETURN" | , |
false | |||
) |
This annotation is put on the first instruction of functions that does not never return.
It is usually put on the C library "_exit" function.
Identifier<bool> otawa::PRESERVED | ( | "otawa::PRESERVED" | , |
false | |||
) |
Put on instruction that must preserved from the mkff special flow-fact detection.
Identifier<int> otawa::TOTAL_ITERATION | ( | "otawa::TOTAL_ITERATION" | , |
- | 1 | ||
) |
Put on the first instruction of a loop, it gives the total number of iterations during the whole execution of the program.
Identifier<Pair<Address, Address> > otawa::ACCESS_RANGE("otawa::ACCESS_RANGE") |
Put on a memory access instruction, provides a range of possible accesses.
Referenced by otawa::FlowFactLoader::onMemoryAccess().
Identifier<Address> otawa::BRANCH_TARGET("otawa::BRANCH_TARGET", Address()) |
Put on instruction that may branch to several targets or whose target computation cannot computed.
There is one property with this identifier for each branched target.
Referenced by otawa::PFGBuilder::addFunction(), otawa::CFGBuilder::buildCFG(), otawa::PFGBuilder::finalizeBB(), otawa::FlowFactLoader::onMultiBranch(), and otawa::VarTextDecoder::processEntry().
Identifier<Address> otawa::CALL_TARGET("otawa::CALL_TARGET", Address()) |
Put on instruction that may call to several targets or whose target computation cannot computed.
There is one property with this identifier for each called target.
Referenced by otawa::CFGBuilder::buildCFG(), otawa::FlowFactLoader::onMultiCall(), and otawa::VarTextDecoder::processEntry().
Feature<FlowFactLoader> otawa::FLOW_FACTS_FEATURE("otawa::FLOW_FACTS_FEATURE") |
This feature ensures that the flow facts has been loaded.
Currrently, only the otawa::util::FlowFactLoader provides this kind of information from F4 files.
Referenced by otawa::TextDecoder::TextDecoder().
Identifier<bool> otawa::FLOW_FACTS_MANDATORY("otawa::FLOW_FACTS_MANDATORY", false) |
In configuration of the FlowFactLoader, makes it fail if no flow fact fail is available.
Referenced by otawa::FlowFactLoader::configure().
Identifier<xom::Element *> otawa::FLOW_FACTS_NODES("otawa::FLOW_FACTS_NODES") |
This property may be used in the configuration of a code processor to directly pass an xml element containing flow facts in Flow Fact XML format format.
Several properties with this identifier may be passed.
Referenced by otawa::FlowFactLoader::configure(), and otawa::script::Script::work().
Identifier<Path> otawa::FLOW_FACTS_PATH("otawa::FLOW_FACTS_PATH","") |
This property may be used in the configuration of a code processor to pass the path of an flow fact file containing flow facts.
Several properties with this identifier may be passed.
Referenced by otawa::FlowFactLoader::configure(), and otawa::Application::run().
Identifier<bool> otawa::IGNORE_CONTROL("otawa::IGNORE_CONTROL", false) |
Put on a control instruction to prevent it to be interpreted as is.
Referenced by otawa::CFGBuilder::buildCFG(), and otawa::FlowFactLoader::onIgnoreControl().
Identifier<bool> otawa::IGNORE_ENTRY("otawa::IGNORE_ENTRY", false) |
Put on function symbol that must be ignored as function entry.
It mainly used to avoid problems with executable files containing symbols marked as function that are in fact data.
Referenced by otawa::FlowFactLoader::onIgnoreEntry(), and otawa::VarTextDecoder::processWorkSpace().
Identifier<bool> otawa::IGNORE_SEQ("otawa::IGNORE_SEQ", false) |
Put on a control instruction to prevent to pass in sequence.
Referenced by otawa::CFGBuilder::buildCFG(), and otawa::FlowFactLoader::onIgnoreSeq().
Identifier<bool> otawa::INLINING_POLICY("otawa::INLINING_POLICY") |
Put on the first instruction of a function to set default inlining behavior during its virtualization.
This overrides VIRTUAL_INLINING default policy of Virtualizer.
Referenced by otawa::FlowFactLoader::onSetInlining(), and otawa::Virtualizer::virtualize().
Identifier<bool> otawa::IS_RETURN("otawa::IS_RETURN", false) |
Put on a control flow instruction, this shows that this instruction is equivalent to a function return.
It may be useful with assembly providing very complex ways to express a function return.
Referenced by otawa::CFGBuilder::buildCFG(), otawa::FlowFactLoader::onReturn(), and otawa::VarTextDecoder::processEntry().
Identifier<int> otawa::MAX_ITERATION("otawa::MAX_ITERATION",-1) |
Put on the first instruction of a loop, it gives the maximum number of iteration of this loop.
Referenced by otawa::FlowFactLoader::onLoop(), otawa::ets::FlowFactLoader::processAST(), otawa::ipet::FlowFactConstraintBuilder::processBB(), and otawa::ipet::FlowFactLoader::transfer().
Identifier<int> otawa::MIN_ITERATION("otawa::MIN_ITERATION",-1) |
Put on the first instruction of a loop, it gives the minimal number of iterations.
Referenced by otawa::ipet::FlowFactConstraintBuilder::processBB(), and otawa::ipet::FlowFactLoader::transfer().
Identifier<bool> otawa::NO_CALL("otawa::NO_CALL", false) |
Put on the first instruction of a function that must be no called.
Referenced by otawa::CFGBuilder::buildCFG(), otawa::FlowFactLoader::onNoCall(), and otawa::VarTextDecoder::processEntry().
Identifier<bool> otawa::NO_INLINE("otawa::NO_INLINE") |
Put on the first instruction of a function to indicate whether it should be inlined or not during virtualization.
This overrides VIRTUAL_INLINING default policy of Virtualizer and INLINING_POLICY of the caller CFG.
Referenced by otawa::Virtualizer::isInlined(), otawa::FlowFactLoader::onNoInline(), and otawa::VirtualCFG::virtualize().
Identifier<bool> otawa::NO_RETURN("otawa::NO_RETURN", false) |
This annotation is put on the first instruction of functions that does not never return.
It is usually put on the C library "_exit" function.
Referenced by otawa::CFGBuilder::buildCFG(), otawa::FlowFactLoader::onNoReturn(), otawa::VarTextDecoder::processEntry(), and otawa::Symbol::setNoReturn().
Identifier<bool> otawa::PRESERVED("otawa::PRESERVED", false) |
Put on instruction that must preserved from the mkff special flow-fact detection.
Referenced by otawa::FlowFactLoader::onPreserve().
Identifier<int> otawa::TOTAL_ITERATION("otawa::TOTAL_ITERATION",-1) |
Put on the first instruction of a loop, it gives the total number of iterations during the whole execution of the program.
Referenced by otawa::FlowFactLoader::onLoop(), otawa::ipet::FlowFactConstraintBuilder::processBB(), and otawa::ipet::FlowFactLoader::transfer().