001/*
002 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 *  This file is licensed to You under the Eclipse Public License (EPL);
005 *  You may not use this file except in compliance with the License. You
006 *  may obtain a copy of the License at
007 *
008 *      http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 *  See the COPYRIGHT.txt file distributed with this work for information
011 *  regarding copyright ownership.
012 */
013package org.jikesrvm.compilers.opt.bc2ir;
014
015
016/**
017 * This class contains flags to control IR generation.
018 *
019 * @see BC2IR
020 */
021public final class IRGenOptions {
022  //////////////////////////////////////////
023  // Flags that control IR generation policies
024  //////////////////////////////////////////
025  /**
026   * Do we allow locals to live on the stack?
027   */
028  static final boolean LOCALS_ON_STACK = true;
029
030  /**
031   * Do we eliminate copies to local variables?
032   */
033  static final boolean ELIM_COPY_LOCALS = true;
034
035  /**
036   * Do we allow constants to live in local variables?
037   */
038  static final boolean CP_IN_LOCALS = true;
039
040  /**
041   * How many return addresses will we allow in the local variables of
042   * a basic block before we decide that we should bail out to prevent
043   * exponential blowup in code space & compile time?
044   */
045  static final int MAX_RETURN_ADDRESSES = 3;
046
047  /** Control on constant folding during IR generation */
048  static final boolean CF_TABLESWITCH = true;
049  /** Control on constant folding during IR generation */
050  static final boolean CF_LOOKUPSWITCH = true;
051  /** Control on constant folding during IR generation */
052  static final boolean CF_CHECKCAST = true;
053  /** Control on constant folding during IR generation */
054  static final boolean CF_CHECKSTORE = true;
055  /** Control on constant folding during IR generation */
056  static final boolean CF_INSTANCEOF = true;
057  /** Control on constant folding during IR generation */
058  static final boolean CF_INTIF = true;
059  /** Control on constant folding during IR generation */
060  static final boolean CF_INTIFCMP = true;
061  /** Control on constant folding during IR generation */
062  static final boolean CF_REFIF = true;
063  /** Control on constant folding during IR generation */
064  static final boolean CF_REFIFCMP = true;
065  /** Control on constant folding during IR generation */
066  static final boolean CF_LONGCMP = true;
067  /** Control on constant folding during IR generation */
068  static final boolean CF_FLOATCMP = true;
069  /** Control on constant folding during IR generation */
070  static final boolean CF_DOUBLECMP = true;
071
072  //////////////////////////////////////////
073  // Debugging support (messaging controls)
074  //////////////////////////////////////////
075  /**
076   * Master debug flag for IR gen. Turns on all other IR gen debug flags.
077   */
078  static final boolean DBG_ALL = false;
079
080  /**
081   * Debug flag: basic blocks
082   */
083  static final boolean DBG_BB = DBG_ALL || false;
084
085  /**
086   * Debug flag: bytecode parsing
087   */
088  static final boolean DBG_BCPARSE = DBG_ALL || false;
089
090  /**
091   * Debug flag: control flow
092   */
093  static final boolean DBG_CF = DBG_ALL || false;
094
095  /**
096   * Debug flag: print instructions as they are generated
097   */
098  static final boolean DBG_INSTR = DBG_ALL || false;
099
100  /**
101   * Debug flag: elim copy to locals
102   */
103  static final boolean DBG_ELIMCOPY = DBG_ALL || false;
104
105  /**
106   * Debug flag: elim null checks
107   */
108  static final boolean DBG_ELIMNULL = DBG_ALL || false;
109
110  /**
111   * Debug flag: stack rectification
112   */
113  static final boolean DBG_STACK = DBG_ALL || false;
114
115  /**
116   * Debug flag: local var rectification
117   */
118  static final boolean DBG_LOCAL = DBG_ALL || false;
119
120  /**
121   * Debug flag: block regeneration
122   */
123  static final boolean DBG_REGEN = DBG_ALL || false;
124
125  /**
126   * Debug flag: operand lattice functions
127   */
128  public static final boolean DBG_OPERAND_LATTICE = DBG_ALL || false;
129
130  /**
131   * Debug flag: cfg
132   */
133  static final boolean DBG_CFG = DBG_ALL || false;
134
135  /**
136   * Debug flag: flattening
137   */
138  static final boolean DBG_FLATTEN = DBG_ALL || false;
139
140  /**
141   * Debug flag: exception handlers
142   */
143  static final boolean DBG_EX = DBG_ALL || false;
144
145  /**
146   * Debug flag: basic block set operations
147   */
148  static final boolean DBG_BBSET = DBG_ALL || false;
149
150  /**
151   * Debug flag: type analysis
152   */
153  public static final boolean DBG_TYPE = DBG_ALL || false;
154
155  /**
156   * Debug flag: jsr inlining
157   */
158  static final boolean DBG_INLINE_JSR = DBG_ALL || false;
159
160  private IRGenOptions() {
161    // prevent instantiation
162  }
163
164}