Constant folding

Constant folding

Le constant folding est une des premières optimisations effectuée lors de la compilation d'un programme. Elle consiste à remplacer une expression constante par sa valeur, calculée statiquement par le compilateur.

Par exemple, le code suivant en C:

int i = 1 + 2;

sera compilé comme s'il s'agissait du code suivant:

int i = 3;

Le constant folding est semblable à la propagation de constantes, à la différence près que le constant folding doit être effectué avant que le langage haut niveau ne soit traduit en code intermédiaire à trois adresses (qui a pour structure globale A = B op C, où A, B et C sont des noms, des constantes ou des noms temporaires ; op peut être n'importe quel opérateur) pour faire en sorte que des codes comme ceux donnés en exemple ci-dessus fonctionnent. La propagation de constante est appliquée sur le code intermédiaire.

Liens externes


Wikimedia Foundation. 2010.

Contenu soumis à la licence CC-BY-SA. Source : Article Constant folding de Wikipédia en français (auteurs)

Игры ⚽ Поможем написать реферат

Regardez d'autres dictionnaires:

  • Constant folding — and constant propagation are related compiler optimizations used by many modern compilers. An advanced form of constant propagation known as sparse conditional constant propagation can more accurately propagate constants and simultaneously remove …   Wikipedia

  • Constant Folding — Le constant folding est l optimisation faite par les compilateurs au premier stade de la compilation d un programme. En C, c est l optimisation qui donne la possibilité d avoir des expressions constantes dans les declarations dans l en tête,… …   Wikipédia en Français

  • Protein folding — Protein thermodynamics redirects here. For the thermodynamics of reactions catalyzed by proteins, see Enzyme. Protein before and after folding. Protein folding is the process by which a protein structure assumes its functional shape or… …   Wikipedia

  • Compiler optimization — is the process of tuning the output of a compiler to minimize or maximize some attributes of an executable computer program. The most common requirement is to minimize the time taken to execute a program; a less common one is to minimize the… …   Wikipedia

  • IP Pascal — is an implementation of the Pascal programming language using the IP portability platform, a multiple machine, operating system and language implementation system. Overview IP Pascal implements the language Pascaline (named after Blaise Pascal s… …   Wikipedia

  • Свёртка констант — (англ. constant folding) и распространение констант (так же продвижение констант, дублирование констант, англ. constant propagation)  часто используемые в современных компиляторах оптимизации, уменьшающие избыточные вычисления,… …   Википедия

  • Control flow graph — Simplified control flowgraphs[1] A control flow graph (CFG) in computer science is a representation, using graph notation, of all paths that might be traversed through a program during its execution …   Wikipedia

  • Peephole optimization — In compiler theory, peephole optimization is a kind of optimization performed over a very small set of instructions in a segment of generated code. The set is called a peephole or a window . It works by recognising sets of instructions that don t …   Wikipedia

  • Sun Studio (software) — infobox software name = Sun Studio developer = Sun Microsystems latest release version = Sun Studio 12 latest release date = June 04, 2007 latest preview version = [http://developers.sun.com/sunstudio/downloads/express/index.jsp Sun Studio… …   Wikipedia

  • Program optimization — For algorithms to solve other optimization problems, see Optimization (mathematics). In computer science, program optimization or software optimization is the process of modifying a software system to make some aspect of it work more efficiently… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”