• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..17-Apr-2020-

constprop01/H17-Apr-2020-193117

constprop02/H17-Apr-2020-162112

READMEH A D17-Apr-20201.7 KiB4634

README

1Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
2DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3
4This code is free software; you can redistribute it and/or modify it
5under the terms of the GNU General Public License version 2 only, as
6published by the Free Software Foundation.
7
8This code is distributed in the hope that it will be useful, but WITHOUT
9ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11version 2 for more details (a copy is included in the LICENSE file that
12accompanied this code).
13
14You should have received a copy of the GNU General Public License version
152 along with this work; if not, write to the Free Software Foundation,
16Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17
18Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19or visit www.oracle.com if you need additional information or have any
20questions.
21
22Constant Propagation
23--------------------
24Constant propagation is a code reduction technique in which values of variables
25which are determined to be constants can be passed to expressions which use
26these constants and can be computed at compile time.
27
28
29Example:
30
31Consider the following segment of an original source program:
32
33      x = 7;
34      y = 2 * x;
35      z = f (x, y);
36
37The value of variable x in the segment's last two lines is the constant number 7.
38This is always true, because of the assignment to x in the segment's first line.
39Therefore, the two instances of x can be substituted by the constant value 7
40(this value propagates through the next two lines). The reduced source program
41is the following:
42
43      x = 7;
44      y = 2 * 7;
45      z = f (7, y);
46