Beispiel #1
0
void
JSONSpewer::spewRanges(BacktrackingAllocator* regalloc)
{
    if (!fp_)
        return;

    beginObjectProperty("ranges");
    beginListProperty("blocks");

    for (size_t bno = 0; bno < regalloc->graph.numBlocks(); bno++) {
        beginObject();
        integerProperty("number", bno);
        beginListProperty("vregs");

        LBlock* lir = regalloc->graph.getBlock(bno);
        for (LInstructionIterator ins = lir->begin(); ins != lir->end(); ins++) {
            for (size_t k = 0; k < ins->numDefs(); k++) {
                uint32_t id = ins->getDef(k)->virtualRegister();
                VirtualRegister* vreg = &regalloc->vregs[id];

                beginObject();
                integerProperty("vreg", id);
                beginListProperty("ranges");

                for (LiveRange::RegisterLinkIterator iter = vreg->rangesBegin(); iter; iter++) {
                    LiveRange* range = LiveRange::get(*iter);

                    beginObject();
                    property("allocation");
                    fprintf(fp_, "\"%s\"", range->bundle()->allocation().toString());
                    integerProperty("start", range->from().bits());
                    integerProperty("end", range->to().bits());
                    endObject();
                }

                endList();
                endObject();
            }
        }

        endList();
        endObject();
    }

    endList();
    endObject();
}
Beispiel #2
0
void
C1Spewer::spewRanges(GenericPrinter& out, BacktrackingAllocator* regalloc, LNode* ins)
{
    for (size_t k = 0; k < ins->numDefs(); k++) {
        uint32_t id = ins->getDef(k)->virtualRegister();
        VirtualRegister* vreg = &regalloc->vregs[id];

        for (LiveRange::RegisterLinkIterator iter = vreg->rangesBegin(); iter; iter++) {
            LiveRange* range = LiveRange::get(*iter);
            out.printf("%d object \"", id);
            out.printf("%s", range->bundle()->allocation().toString().get());
            out.printf("\" %d -1", id);
            out.printf(" [%u, %u[", range->from().bits(), range->to().bits());
            for (UsePositionIterator usePos(range->usesBegin()); usePos; usePos++)
                out.printf(" %u M", usePos->pos.bits());
            out.printf(" \"\"\n");
        }
    }
}