Constant Propagation Transformation: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 19: Line 19:
|-
|-
|<syntaxhighlight lang="c">
|<syntaxhighlight lang="c">
// The following code tests ConstPropagation applied to main function.
// In the given example, variables a, b and c are known.
// They are propagated to the rest of the body of main.
#pragma EMX_TRANSFORMATION ConstPropagation
#pragma EMX_TRANSFORMATION ConstPropagation
int main(void) {
int main(void) {
Line 31: Line 34:
}
}
</syntaxhighlight>
</syntaxhighlight>
|<pre>int main(void) {
|<syntaxhighlight lang="c">
// The following code is the generated code after the transformation has been applied.
 
int main(void) {
int a = 2;
int a = 2;
int b = a;
int b = a;
Line 40: Line 46:


return 0;
return 0;
}
}
</pre>
</syntaxhighlight>
|-
|-
|
|
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu