Description
By default:
- Functions remain as separate hierarchy blocks in the RTL, or are decomposed (inlined) into higher-level functions.
- All instances of a function, at the same level of hierarchy, uses the same RTL implementation (block).
The set_directive_function_instantiate
command is used to create a unique RTL implementation for each instance of a function,
allowing each instance to be optimized around a specific argument or variable.
By default, the following code results in a single RTL implementation of
function func_sub
for all three instances, or if func_sub
is a small function it is inlined into function func
.
set_directive_inline off
option can be used to prevent this automatic
inlining.char func_sub(char inval, char incr)
{
return inval + incr;
}
void func(char inval1, char inval2, char inval3,
char *outval1, char *outval2, char * outval3)
{
*outval1 = func_sub(inval1, 1);
*outval2 = func_sub(inval2, 2);
*outval3 = func_sub(inval3, 3);
}
Using the directive as shown in the example section below results in three
versions of function func_sub
, each independently optimized
for variable incr
.
Syntax
set_directive_function_instantiate <location> <variable>
-
<location>
is the location (in the formatfunction[/region label]
) where the instances of a function are to be made unique. -
<variable>
specifies the function argument to be specified as a constant in the various function instantiations.
Options
This command has no options.
Examples
For the example code shown above, the following Tcl (or pragma placed in
function func_sub
) allows each instance of function func_sub
to be independently optimized with respect to input
incr
.
set_directive_inline -off func_sub
set_directive_function_instantiate func_sub incr