KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > options > LCMOptions


1
2 /* Soot - a J*va Optimization Framework
3  * Copyright (C) 2003 Ondrej Lhotak
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */

20
21 /* THIS FILE IS AUTO-GENERATED FROM soot_options.xml. DO NOT MODIFY. */
22
23 package soot.options;
24 import java.util.*;
25
26 /** Option parser for Lazy Code Motion. */
27 public class LCMOptions
28 {
29     private Map options;
30
31     public LCMOptions( Map options ) {
32         this.options = options;
33     }
34     
35     /** Enabled --
36     
37      * .
38     
39      *
40      */

41     public boolean enabled() {
42         return soot.PhaseOptions.getBoolean( options, "enabled" );
43     }
44     
45     /** Unroll --
46     
47      * .
48     
49      * If true, perform loop inversion before doing the
50      * transformation.
51      */

52     public boolean unroll() {
53         return soot.PhaseOptions.getBoolean( options, "unroll" );
54     }
55     
56     /** Naive Side Effect Tester --
57     
58      * Use a naive side effect analysis even if interprocedural
59      * information is available.
60     
61      * If Naive Side Effect Tester is set to true, Lazy Code Motion
62      * uses the conservative side effect information provided by the
63      * NaiveSideEffectTester class, even if interprocedural information
64      * about side effects is available. The naive side effect analysis
65      * is based solely on the information available locally about a
66      * statement. It assumes, for example, that any method call has the
67      * potential to write and read all instance and static fields in
68      * the program. If Naive Side Effect Tester is set to false and
69      * Soot is in whole program mode, then Lazy Code Motion uses the
70      * side effect information provided by the PASideEffectTester
71      * class. PASideEffectTester uses a points-to analysis to determine
72      * which fields and statics may be written or read by a given
73      * statement. If whole program analysis is not performed, naive
74      * side effect information is used regardless of the setting of
75      * Naive Side Effect Tester.
76      */

77     public boolean naive_side_effect() {
78         return soot.PhaseOptions.getBoolean( options, "naive-side-effect" );
79     }
80     
81     public static final int safety_safe = 1;
82     public static final int safety_medium = 2;
83     public static final int safety_unsafe = 3;
84     /** Safety --
85     
86      * .
87     
88      * This option controls which fields and statements are candidates
89      * for code motion.
90      */

91     public int safety() {
92         String JavaDoc s = soot.PhaseOptions.getString( options, "safety" );
93         
94         if( s.equalsIgnoreCase( "safe" ) )
95             return safety_safe;
96         
97         if( s.equalsIgnoreCase( "medium" ) )
98             return safety_medium;
99         
100         if( s.equalsIgnoreCase( "unsafe" ) )
101             return safety_unsafe;
102         
103         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option safety" );
104     }
105     
106 }
107         
Popular Tags