Esempio n. 1
0
 /**
  * Build BURS trees for dependence graph <code>bb</code>, label the trees, and then generate MIR
  * instructions based on the labeling.
  *
  * @param bb The dependence graph. XXX Is this correct?
  */
 public void invoke(OPT_BasicBlock bb) {
   OPT_BURS_STATE burs = new OPT_BURS_STATE(this);
   for (OPT_InstructionEnumeration e = bb.forwardRealInstrEnumerator(); e.hasMoreElements(); ) {
     OPT_Instruction s = e.next();
     OPT_BURS_TreeNode tn = buildTree(s);
     burs.label(tn);
     burs.mark(tn, /* goalnt */ (byte) 1);
     generateTree(tn, burs);
   }
 }
Esempio n. 2
0
  /**
   * Is register r1 live at any def of register r2?
   *
   * <p><strong>PRECONDITION </strong> def-use chains must be computed and valid.
   * <strong>PRECONDITION </strong> instructions are numbered, with numbers stored in
   * OPT_Instruction.scratch
   *
   * <p>Note: this implementation is not efficient. The liveness data structures must be re-designed
   * to support this efficiently.
   */
  private static boolean isLiveAtDef(OPT_Register r1, OPT_Register r2, OPT_LiveAnalysis live) {

    for (Iterator e = live.iterateLiveIntervals(r1); e.hasNext(); ) {
      OPT_LiveIntervalElement elem = (OPT_LiveIntervalElement) e.next();
      OPT_BasicBlock bb = elem.getBasicBlock();
      OPT_Instruction begin = (elem.getBegin() == null) ? bb.firstInstruction() : elem.getBegin();
      OPT_Instruction end = (elem.getEnd() == null) ? bb.lastInstruction() : elem.getEnd();
      int low = begin.scratch;
      int high = end.scratch;
      for (Enumeration defs = OPT_DefUse.defs(r2); defs.hasMoreElements(); ) {
        OPT_Operand def = (OPT_Operand) defs.nextElement();
        int n = def.instruction.scratch;
        if (n >= low && n < high) {
          return true;
        }
      }
    }

    // no conflict was found.
    return false;
  }
Esempio n. 3
0
 /**
  * Is one basic block (the slave) dominated by another (the master)?
  *
  * @param slave the potential dominatee
  * @param master the potential dominator
  * @return true or false
  */
 static boolean isDominatedBy(OPT_BasicBlock slave, OPT_BasicBlock master) {
   return ((OPT_DominatorInfo) slave.scratchObject).dominators.get(master.getNumber());
 }
Esempio n. 4
0
 /**
  * Is the basic block represented by this structure dominated by another basic block?
  *
  * @param bb the basic block in question
  * @return true or false
  */
 boolean isDominatedBy(OPT_BasicBlock bb) {
   return dominators.get(bb.getNumber());
 }