Search in sources :

Example 1 with LiveIntervalElement

use of org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement in project JikesRVM by JikesRVM.

the class LiveAnalysis method getLiveRegistersOnEntry.

/**
 * @param bb the basic block we're interested in
 * @return the set of registers that are live across a basic block, and who
 * are live before the basic block entry.
 */
HashSet<Register> getLiveRegistersOnEntry(BasicBlock bb) {
    HashSet<Register> result = new HashSet<Register>(10);
    for (Enumeration<LiveIntervalElement> e = liveIntervals.enumerateLiveIntervals(bb); e.hasMoreElements(); ) {
        LiveIntervalElement lie = e.nextElement();
        Instruction begin = lie.getBegin();
        if (begin == null)
            result.add(lie.getRegister());
    }
    return result;
}
Also used : Register(org.jikesrvm.compilers.opt.ir.Register) LiveIntervalElement(org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement) Instruction(org.jikesrvm.compilers.opt.ir.Instruction) HashSet(java.util.HashSet)

Example 2 with LiveIntervalElement

use of org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement in project JikesRVM by JikesRVM.

the class LiveAnalysis method getLiveRegistersOnExit.

/**
 * @param bb the basic block we're interested in
 * @return the set of registers that are live across a basic block, and who
 * are live after the basic block exit.
 */
HashSet<Register> getLiveRegistersOnExit(BasicBlock bb) {
    HashSet<Register> result = new HashSet<Register>(10);
    for (Enumeration<LiveIntervalElement> e = liveIntervals.enumerateLiveIntervals(bb); e.hasMoreElements(); ) {
        LiveIntervalElement lie = e.nextElement();
        Instruction end = lie.getEnd();
        if (end == null)
            result.add(lie.getRegister());
    }
    return result;
}
Also used : Register(org.jikesrvm.compilers.opt.ir.Register) LiveIntervalElement(org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement) Instruction(org.jikesrvm.compilers.opt.ir.Instruction) HashSet(java.util.HashSet)

Example 3 with LiveIntervalElement

use of org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement in project JikesRVM by JikesRVM.

the class LiveAnalysis method merge.

/**
 * Update the data structures to reflect that all live intervals for r2
 * are now intervals for r1.
 *
 * @param r1 old register
 * @param r2 new register
 */
public void merge(Register r1, Register r2) {
    Iterator<LiveIntervalElement> i = iterateLiveIntervals(r2);
    while (i.hasNext()) {
        LiveIntervalElement interval = i.next();
        interval.setRegister(r1);
        addToRegisterMap(r1, interval);
        i.remove();
    }
}
Also used : LiveIntervalElement(org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement)

Example 4 with LiveIntervalElement

use of org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement in project JikesRVM by JikesRVM.

the class LiveInterval method containsUnresolvedElement.

/**
 * Check to see if an unresolved LiveIntervalElement node for the register
 * passed exists for the basic block passed.
 *
 * @param block the block
 * @param reg   the register of interest
 * @return <code>true</code> if it does or <code>false</code>
 *         if it does not
 */
private boolean containsUnresolvedElement(BasicBlock block, Register reg) {
    if (DEBUG) {
        System.out.println("containsUnresolvedElement called, block: " + block + " register: " + reg);
        printLiveIntervalList(block);
    }
    for (LiveIntervalElement elem = getFirstLiveIntervalElement(block); elem != null; elem = elem.getNext()) {
        // if we got an element, down case it to LiveIntervalElement
        if (elem.getRegister() == reg && elem.getBegin() == null) {
            return true;
        }
    }
    return false;
}
Also used : LiveIntervalElement(org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement)

Example 5 with LiveIntervalElement

use of org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement in project JikesRVM by JikesRVM.

the class LiveInterval method moveUpwardExposedRegsToFront.

/**
 * This method finds any LiveInterval node that does not have a start
 * instruction (it is null) and moves this node to the front of the list.
 *
 * @param block the basic block of interest
 */
public void moveUpwardExposedRegsToFront(BasicBlock block) {
    LiveIntervalElement prev = getFirstLiveIntervalElement(block);
    if (prev == null) {
        return;
    }
    // The first element is already at the front, so move on to the next one
    LiveIntervalElement elem = prev.getNext();
    while (elem != null) {
        if (elem.getBegin() == null) {
            // remove elem from current position
            prev.setNext(elem.getNext());
            // add it to the begining, se
            prependLiveIntervalElement(block, elem);
            // the next victum is the *new* one after prev
            elem = prev.getNext();
        } else {
            prev = elem;
            elem = elem.getNext();
        }
    }
}
Also used : LiveIntervalElement(org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement)

Aggregations

LiveIntervalElement (org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement)11 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)3 HashSet (java.util.HashSet)2 Register (org.jikesrvm.compilers.opt.ir.Register)2 BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)1 ExceptionHandlerBasicBlock (org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock)1 OsrPoint (org.jikesrvm.compilers.opt.ir.OsrPoint)1 MemoryOperand (org.jikesrvm.compilers.opt.ir.operand.MemoryOperand)1 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)1 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)1 BURSManagedFPROperand (org.jikesrvm.compilers.opt.ir.operand.ia32.BURSManagedFPROperand)1