FACTOID # 174: One in three Italian babies is born by caesarean section.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

FACTS & STATISTICS    Simple view

  1. Select countries to view: (hold down Control key and click to select several)

     

     

    Compare:

     

     

  1. Select fact or statistic: (* = graphable)

     

     

     

  2. (OPTIONAL) Compare to statistic: (both need to be graphable)

     

     

     

  3. View result as:

     

       
(OR) SEARCH ALL encyclopedia, stats & forums:   

Encyclopedia > Constant propagation

In computer science constant propagation (cprop) is an optimization performed by compilers.


After cprop is carried out, expressions that really can be calculated at compiletime will be, and are replaced by their values. That is, known functions of known constants are constants, and are recognised as such.


Constant propagation is also able to change conditional branches to unconditional ones. The following code in C can be simplified using cprop:

 int a(){ int b; int c; b=3; c=b*4; if(c>10){ c=c-10; } return c; } 

A good compiler will reduce this to:

 int a(){ return 2; } 


Constant propagation can easily be implemented on SSA form as published by Wegman and Zadeck in 1991.


Constant propagation is not to be confused with constant folding, which is implemented in the front-end.



See also: Control flow graph, Compiler optimization


  Results from FactBites:
 
Constant folding - Wikipedia, the free encyclopedia (607 words)
A more advanced form of constant propagation known as sparse conditional constant propagation may be utilized to simultaneously remove dead code and more accurately propagate constants.
Constant folding can be done in a compiler's front end on the IR tree that represents the high-level source language, before it is translated into three-address code, or in the back end, as an adjunct to constant propagation.
Constant propagation can also cause conditional branches to simplify to one or more unconditional statements, when the conditional expression can be evaluated to true or false at compile time to determine the only possible outcome.
Constant propagation - definition of Constant propagation in Encyclopedia (153 words)
That is, known functions of known constants are constants, and are recognised as such.
Constant propagation can easily be implemented on SSA form as published by Wegman and Zadeck in 1991.
Constant propagation is not to be confused with constant folding, which is implemented in the front-end.
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.