Пример #1
0
boolean doTypeOfTermRow(struct hash *ra, char *org)
// print one typeOfTerm row
{
char *term = (char *)hashMustFindVal(ra, CV_TERM);

if (sameString(term,cvTypeNormalized(CV_TERM_CELL)))
    term = CV_TERM_CELL;
else if (sameString(term,cvTypeNormalized(CV_TERM_ANTIBODY)))
    term = CV_TERM_ANTIBODY;

puts("<TR>");
printf("  <TD><A HREF='hgEncodeVocab?type=%s' title='%s details' "
        "TARGET=ucscVocabChild>%s</a></TD>\n", term, term, term);
printDescription(ra,NULL,2);
printLabel(ra,term);
puts("</TR>");
if (sameString(term,CV_TERM_CELL))
    {
    puts("<TR>");
    printf("  <TD><A HREF='hgEncodeVocab?type=%s&organism=Mouse' title='Mouse %s details' "
            "TARGET=ucscVocabChild>%s</a> <em>(for mouse)</em></TD>\n", term, term, term);
    char *s = getDescription(ra,NULL);
    printf("  <TD colspan=%d>%s <em>(for mouse)</em></TD>\n",
            TABLE_COLS_AVAILABLE(2), s?s:"&nbsp;");
    freeMem(s);
    printLabel(ra,term);
    puts("</TR>");
    }

return TRUE;
}
Пример #2
0
/**
 * Print a select instruction.
 * 
 * @param cond      the condition
 * @param trueVal   the return value of the instruction if the condition is
 *                  non-zero
 * @param falseVal  the return value of the instruction if the condition is
 *                  zero
 */
void JVMWriter::printSelectInstruction(const Value *cond,
                                       const Value *trueVal,
                                       const Value *falseVal) {
    std::string labelname = "select" + utostr(getUID());
    printValueLoad(cond);
    printSimpleInstruction("ifeq", labelname + "a");
    printValueLoad(trueVal);
    printSimpleInstruction("goto", labelname + "b");
    printLabel(labelname + "a");
    printValueLoad(falseVal);
    printLabel(labelname + "b");
}
Пример #3
0
boolean doTypeRow(struct hash *ra, char *org)
{
char *type = (char *)cvTermNormalized(hashMustFindVal(ra, CV_TYPE));

if (sameWord(type,CV_TOT))
    return doTypeOfTermRow(ra,org);
else if (sameWord(type,CV_TERM_CELL))
    return doCellRow(ra,org);
else if (sameWord(type,CV_TERM_ANTIBODY))
    return doAntibodyRow(ra,org);
else if (sameWord(type,CV_TERM_LAB))
    {
    puts("<TR>");
    char *term = printTerm(ra);
    printDescription(ra,"labInst",5);
    printSetting(ra,"labPiFull");
    printSetting(ra,"grantPi");
    printSetting(ra,"organism");
    printLabel(ra,term);
    puts("</TR>");
    }
else if (sameWord(type,CV_TERM_GRANT))
    {
    puts("<TR>");
    char *term = printTerm(ra);
    printDescription(ra,"grantInst",2);
    printLabel(ra,term);
    puts("</TR>");
    }
else if (sameWord(type,CV_TERM_LOCALIZATION))
    {
    puts("<TR>");
    char *term = printTerm(ra);
    printDescription(ra,NULL,3);
    printSettingsWithUrls(ra,"termUrl","termId",NULL);
    printLabel(ra,term);
    puts("</TR>");
    }
else  // generic term: term, description, label
    {
    puts("<TR>");
    char *term = printTerm(ra);
    printDescription(ra,NULL,2);
    printLabel(ra,term);
    puts("</TR>");
    }
return TRUE;
}
Пример #4
0
/**
 * Print a conditional branch instruction.
 * 
 * @param curBlock    the current block
 * @param trueBlock   the destination block if the value on top of the stack is
 *                    non-zero
 * @param falseBlock  the destination block if the value on top of the stack is
 *                    zero
 */
void JVMWriter::printBranchInstruction(const BasicBlock *curBlock,
                                       const BasicBlock *trueBlock,
                                       const BasicBlock *falseBlock) {
    if(trueBlock == falseBlock) {
        printSimpleInstruction("pop");
        printBranchInstruction(curBlock, trueBlock);
    } else if(!falseBlock) {
        printPHICopy(curBlock, trueBlock);
        printSimpleInstruction("ifne", getLabelName(trueBlock));
    } else {
        std::string labelname = getLabelName(trueBlock);
        if(isa<PHINode>(trueBlock->begin()))
            labelname += "$phi" + utostr(getUID());
        printSimpleInstruction("ifne", labelname);
        
        if(isa<PHINode>(falseBlock->begin()))
            printPHICopy(curBlock, falseBlock);
        printSimpleInstruction("goto", getLabelName(falseBlock));
        
        if(isa<PHINode>(trueBlock->begin())) {
            printLabel(labelname);
            printPHICopy(curBlock, trueBlock);
            printSimpleInstruction("goto", getLabelName(trueBlock));
        }
    }
}
Пример #5
0
void print(std::ostream& ostream, const IRInstruction* inst,
           const RegAllocInfo* regs, const LifetimeInfo* lifetime) {
  if (inst->op() == Marker) {
    auto* marker = inst->extra<Marker>();
    ostream << color(ANSI_COLOR_BLUE)
            << marker->show()
            << color(ANSI_COLOR_END);
    return;
  }

  if (!inst->isTransient()) {
    ostream << color(ANSI_COLOR_YELLOW);
    if (!lifetime || !lifetime->linear[inst]) {
      ostream << folly::format("({:02d}) ", inst->id());
    } else {
      ostream << folly::format("({:02d}@{:02d}) ", inst->id(),
                               lifetime->linear[inst]);
    }
    ostream << color(ANSI_COLOR_END);
  }
  printDst(ostream, inst, regs, lifetime);
  printOpcode(ostream, inst);
  printSrcs(ostream, inst, regs, lifetime);

  if (Block* taken = inst->taken()) {
    ostream << punc(" -> ");
    printLabel(ostream, taken);
  }
}
/*!
  \see printLabel()
*/
void wndInventoryControl::printLabelCurrent( void )
{
    // Verify an item is selected to print for
    if ( _pUI->tblInventory->currentIndex().isValid() )
    {
        // Find the row the currently selected cell is in
        printLabel( QVector<int>( _pUI->tblInventory->currentIndex().row() ) );
    }
}
/*!
  \see printLabel()
*/
void wndInventoryControl::printLabelAll( void )
{
    QVector<int> itemRows;
    for ( int i = 0; i < _pUI->tblInventory->model()->rowCount(); i++ )
    {
        itemRows.push_back( i );
    }
    printLabel( itemRows );
}
Пример #8
0
void setStatusBar(struct stCommandsBar *stCommandsBarSettings,enum CONSOLE_FONT_COLORS BGCOLOR,enum CONSOLE_FONT_COLORS FONT_COLOR,enum CONSOLE_FONT_WEIGHTS FONT_WEIGHT,const char *strFormatText,...) {
va_list pArguments;
static char strStatusText[256];
struct stConsoleCursorLocation stConcatLabelLocation;
    if (stCommandsBarSettings->stStatusBarLocation.intRow!=-1) {
        va_start(pArguments,strFormatText);
        vsnprintf(strStatusText,sizeof(strStatusText),strFormatText,pArguments);
        va_end(pArguments);
        printLabel(stCommandsBarSettings->stStatusBarLocation.intRow,stCommandsBarSettings->stStatusBarLocation.intColumn,BGCOLOR,FONT_COLOR,FONT_WEIGHT,getConsoleColumnsCount()-1,&stConcatLabelLocation,"%s",strStatusText);
    }
}
Пример #9
0
void SBookWidget::menuFilePrintLabel2()
{
    Entry *ent = selectedEntry();

    if(ent){
	QString addr = ent->addressN(1);

	if(addr.length()){
	    printLabel(addr);
	}
    }
}
Пример #10
0
void print(std::ostream& ostream, const IRInstruction* inst,
           const RegAllocInfo* regs, const GuardConstraints* guards) {
  if (!inst->isTransient()) {
    ostream << color(ANSI_COLOR_YELLOW);
    ostream << folly::format("({:02d}) ", inst->id());
    ostream << color(ANSI_COLOR_END);
  }
  printInstr(ostream, inst, regs, guards);
  if (Block* taken = inst->taken()) {
    ostream << punc(" -> ");
    printLabel(ostream, taken);
  }
}
Пример #11
0
void print(std::ostream& ostream, const IRInstruction* inst,
           const RegAllocInfo* regs, const LifetimeInfo* lifetime) {
  if (inst->op() == Marker) {
    auto* marker = inst->getExtra<Marker>();
    ostream << color(ANSI_COLOR_BLUE)
            << folly::format("--- bc {}, spOff {} ({})",
                             marker->bcOff,
                             marker->stackOff,
                             marker->func->fullName()->data())
            << color(ANSI_COLOR_END);
    return;
  }

  if (!inst->isTransient()) {
    ostream << color(ANSI_COLOR_YELLOW);
    if (!lifetime || !lifetime->linear[inst]) {
      ostream << folly::format("({:02d}) ", inst->getId());
    } else {
      ostream << folly::format("({:02d}@{:02d}) ", inst->getId(),
                               lifetime->linear[inst]);
    }
    ostream << color(ANSI_COLOR_END);
  }
  printDst(ostream, inst, regs, lifetime);
  printOpcode(ostream, inst);
  printSrcs(ostream, inst, regs, lifetime);

  if (Block* taken = inst->getTaken()) {
    ostream << punc(" -> ");
    printLabel(ostream, taken);
  }

  if (TCA tca = inst->getTCA()) {
    ostream << punc(", ");
    if (tca == kIRDirectJccJmpActive) {
      ostream << "JccJmp_Exit ";
    }
    else if (tca == kIRDirectJccActive) {
      ostream << "Jcc_Exit ";
    }
    else if (tca == kIRDirectGuardActive) {
      ostream << "Guard_Exit ";
    }
    else {
      ostream << (void*)tca;
    }
  }
}
Пример #12
0
/**
 * Print a loop.
 * 
 * @param l  the loop
 */
void JVMWriter::printLoop(const Loop *l) {
    printLabel(getLabelName(l->getHeader()));
    for(Loop::block_iterator i = l->block_begin(),
                             e = l->block_end(); i != e; i++) {
        const BasicBlock *block = *i;
        Loop *blockLoop = getAnalysis<LoopInfo>().getLoopFor(block);
        if(l == blockLoop)
            // the loop is the innermost parent of this block
            printBasicBlock(block);
        else if(block == blockLoop->getHeader()
                 && l == blockLoop->getParentLoop())
            // this block is the header of its innermost parent loop,
            // and the loop is the parent of that loop
            printLoop(blockLoop);
    }
    printSimpleInstruction("goto", getLabelName(l->getHeader()));
}
Пример #13
0
/**
 * Print the given basic block.
 * 
 * @param block  the basic block
 */
void JVMWriter::printBasicBlock(const BasicBlock *block) {
    printLabel(getLabelName(block));
    if (trace) {
        if (block->hasName()) {
            std::string n = block->getName();
            printTrc(n + ":");
        }
    }
    for(BasicBlock::const_iterator i = block->begin(), e = block->end();
        i != e; i++) {
        instNum++;
        
        if (trace)
            printSimpleInstruction(".line", utostr(trcLineNum+1));
        else if(debug >= 1)
            printSimpleInstruction(".line", utostr(instNum));
            
        if(debug >= 3 || trace) {
            // print current instruction as comment
            // note that this block of code significantly increases
            // code generation time
            std::string str;
            raw_string_ostream ss(str); ss << *i;
            ss.flush();
            if (trace)
                printTrc(str);
            if (debug >= 3) {
                std::string::size_type pos = 0;
                while((pos = str.find("\n", pos)) != std::string::npos)
                    str.replace(pos++, 1, "\n;");
                out << ';' << str << '\n';
            }
        }
        
        if(i->getOpcode() == Instruction::PHI)
            // don't handle phi instruction in current block
            continue;
        printInstruction(i);
        if(i->getType() != Type::getVoidTy(block->getContext())
        && i->getOpcode() != Instruction::Invoke)
            // instruction doesn't return anything, or is an invoke instruction
            // which handles storing the return value itself
            printValueStore(i);
    }
}
Пример #14
0
void updateProgressBar(struct stProgressBar *stProgressBarSettings,enum CONSOLE_FONT_COLORS FONT_BGCOLOR,enum CONSOLE_FONT_COLORS FONT_FGCOLOR,enum CONSOLE_FONT_WEIGHTS FONT_WEIGHT,const char *strFormatProgressBarText,...) {
static char strProgressBarText[256];
struct stConsoleCursorLocation stTexteLocation;
va_list pArguments;
    if (stProgressBarSettings->intValue<stProgressBarSettings->intOperationsCount) {
        saveCursorPosition();
        stProgressBarSettings->intValue=stProgressBarSettings->intValue+1;
        setCursorPosition(stProgressBarSettings->stProgressBarLocation.intRow,stProgressBarSettings->stProgressBarLocation.intColumn);
        setFontBgColor(stProgressBarSettings->PROGRESSBAR_COLOR);
        printf("%*s",(unsigned int) getRoundNumber((double)stProgressBarSettings->intValue*(double) stProgressBarSettings->chProgressBarSize/(double) stProgressBarSettings->intOperationsCount),"");
        resetPreviousBgColor();
        resetSavedCursorPosition();
        va_start(pArguments,strFormatProgressBarText);
        vsnprintf(strProgressBarText,stProgressBarSettings->chProgressBarTextSize+1,strFormatProgressBarText,pArguments);
        va_end(pArguments);
        printLabel(stProgressBarSettings->stProgressBarTextLocation.intRow,stProgressBarSettings->stProgressBarTextLocation.intColumn,FONT_BGCOLOR,FONT_FGCOLOR,FONT_WEIGHT,stProgressBarSettings->chProgressBarTextSize,&stTexteLocation,"%s",strProgressBarText);
    }
}
Пример #15
0
boolean doAntibodyRow(struct hash *ra, char *org)
// print one antibody row
{
puts("<TR>");
char *term = printTerm(ra);
printDescription(ra,"antibodyDescription",9);
printSetting(ra,"target");                  // target is NOT first but still is major sort order
printSetting(ra,"targetDescription");
printSettingsWithUrls(ra,"orderUrl","vendorName","vendorId");
printSetting(ra,"lab");
printDocumentLink(ra,term,"validation","/ENCODE/validation/antibodies/",NULL,FALSE);
printSetting(ra,"lots");
printSettingsWithUrls(ra,"targetUrl","targetId",NULL);
printLabel(ra,term);
puts("</TR>");

return TRUE;
}
Пример #16
0
MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(printLabel()));
    QDate day = QDate::currentDate();
    ui->spinBoxMonth->setValue(day.month());
    ui->spinBoxYear->setValue(day.year());

    ui->buttonBox->setFocus();


    QPoint center = qApp->desktop()->screenGeometry(this).center();

    QRect r = rect();
    r.moveCenter(center);
    move(r.topLeft());

}
Пример #17
0
static int
WorkerBee(struct cmd_syndesc *as, void *arock)
{
    char *tapedev;
    struct tapeLabel *label;
    struct fileMark *fmark;
    afs_int32 fmtype;
    struct blockMark *bmark;
    afs_int32 isheader, isdatablock;
    char *data;
    char *tblock;
    afs_int32 code;
    struct volumeHeader *volheaderPtr = NULL;
    int eod = 1;
    int rc;
    char *nextblock;		/* We cycle through three tape blocks so we  */
    char *lastblock;		/* can trim off the volume trailer from the  */
    char *lastblock2;		/* end of each volume without having to back */
    char *tapeblock1;		/* up the output stream.                     */
    char *tapeblock2;
    char *tapeblock3;

    tapedev = as->parms[0].items->data;	/* -tape     */
    nrestore =
	(as->parms[1].items ? atol(as->parms[1].items->data) : 0x7fffffff);
    nskip = (as->parms[2].items ? atol(as->parms[2].items->data) : 0);
    if (as->parms[4].items)
	nskip = 0x7fffffff;	/* -scan     */
    outfile = (as->parms[3].items ? as->parms[3].items->data : 0);
    ask = (as->parms[5].items ? 0 : 1);	/* -noask    */
    printlabels = (as->parms[6].items ? 1 : 0);	/* -label    */
    printheaders = (as->parms[7].items ? 1 : 0);	/* -vheaders */
    verbose = (as->parms[8].items ? 1 : 0);	/* -verbose  */

    /* Open the tape device */
    rc = usd_Open(tapedev, USD_OPEN_RDONLY, 0, &fd);
    if (rc != 0) {
	printf("Failed to open tape device %s. Code = %d\n", tapedev, rc);
	exit(1);
    }

    /*
     * Initialize the tape block buffers
     */
    tapeblock1 = (char *)malloc(3 * 16384);
    if (tapeblock1 == NULL) {
	printf("Failed to allocate I/O buffers.\n");
	exit(1);
    }
    tapeblock2 = tapeblock1 + 16384;
    tapeblock3 = tapeblock2 + 16384;

    nextblock = tapeblock1;
    lastblock = NULL;
    lastblock2 = NULL;

    /* Read each tape block deciding what to do with it */
    do {			/* while ((nskip!=0) && (nrestore!=0)) */
	code = readblock(nextblock);
	if (code) {
	    if (!eod)
		fprintf(stderr, "Tape device read error: %d\n", code);
	    break;
	}
	isdatablock = 0;

	/* A data block can be either a volume header, volume trailer,
	 * or actual data from a dump.
	 */
	bmark = (struct blockMark *)nextblock;
	label = (struct tapeLabel *)nextblock;
	fmark = (struct fileMark *)nextblock;
	if (ntohl(bmark->magic) == BLOCK_MAGIC) {
	    if (verbose)
		printf("Data block\n");
	    isdatablock = 1;
	    isheader = 0;
	    data = &nextblock[sizeof(struct blockMark)];
	    if (strncmp(data, "H++NAME#", 8) == 0) {
		volheaderPtr = (struct volumeHeader *)data;
		printHeader(volheaderPtr, &isheader);
	    }
	    if (isheader) {
		code = openOutFile(volheaderPtr);
		nextblock = tapeblock1;
		lastblock = NULL;
		lastblock2 = NULL;
	    } else {
		if (lastblock2 != NULL) {
		    data = &lastblock2[sizeof(struct blockMark)];
		    bmark = (struct blockMark *)lastblock2;
		    writeData(data, ntohl(bmark->count));
		    tblock = lastblock2;
		} else if (lastblock != NULL) {
		    tblock = tapeblock2;
		} else {
		    tblock = tapeblock3;
		}
		lastblock2 = lastblock;
		lastblock = nextblock;
		nextblock = tblock;
	    }
	}

	/* Filemarks come in 3 forms: BEGIN, END, and EOD.
	 * There is no information stored in filemarks.
	 */
	else if (ntohl(fmark->magic) == FILE_MAGIC) {
	    fmtype = ntohl(fmark->nBytes);
	    if (fmtype == FILE_BEGIN) {
		if (verbose)
		    fprintf(stderr, "File mark volume begin\n");
	    } else if (fmtype == FILE_END) {
		if (verbose)
		    fprintf(stderr, "File mark volume end\n");
	    } else if (fmtype == FILE_EOD) {
		if (verbose)
		    fprintf(stderr, "File mark end-of-dump\n");
		eod = 1;
	    }
	}

	/* A dump label */
	else if (ntohl(label->magic) == TAPE_MAGIC) {
	    if (verbose)
		fprintf(stderr, "Dump label\n");
	    printLabel(label);
	    eod = 0;
	}

	else {
	    if (verbose) {
		fprintf(stderr, "Unrecognized tape block - end\n");
	    }
	}

	/* Anything other than a data block closes the out file.
	 * At this point nextblock contains the end of tape file mark,
	 * lastblock contains the last data block for the current volume,
	 * and lastblock2 contains the second to last block for the current
	 * volume. If the volume fits in a single block, lastblock2 will
	 * be NULL. Call writeLastBlocks to strip off the dump trailer before
	 * writing the last of the volume data to the dump file. The dump
	 * trailer may span block boundaries.
	 */
	if (!isdatablock && lastblock) {
	    writeLastBlocks(lastblock, lastblock2);
	    closeOutFile();
	    nextblock = tapeblock1;
	    lastblock = NULL;
	    lastblock2 = NULL;
	}
    } while ((nskip != 0) || (nrestore != 0));

    free(tapeblock1);

    return 0;
}
Пример #18
0
 void print(std::ostream& out, IVocabulary const* vocab) const {
   printLabel(out, vocab);
   printWeight(out);
 }
Пример #19
0
 void print(std::ostream& out) const {
   printLabel(out);
   printWeight(out);
 }
Пример #20
0
void print(std::ostream& os, const Block* block, AreaIndex area,
           const AsmInfo* asmInfo, const GuardConstraints* guards,
           BCMarker* markerPtr) {
    BCMarker dummy;
    BCMarker& curMarker = markerPtr ? *markerPtr : dummy;

    TcaRange blockRange = asmInfo ? asmInfo->blockRangesForArea(area)[block]
                          : TcaRange { nullptr, nullptr };

    os << '\n' << std::string(kIndent - 3, ' ');
    printLabel(os, block);
    os << punc(":");
    auto& preds = block->preds();
    if (!preds.empty()) {
        os << " (preds";
        for (auto const& edge : preds) {
            os << " B" << edge.from()->id();
        }
        os << ')';
    }
    os << "\n";

    if (block->empty()) {
        os << std::string(kIndent, ' ') << "empty block\n";
        return;
    }

    const char* markerEndl = "";
    for (auto it = block->begin(); it != block->end();) {
        auto& inst = *it;
        ++it;

        if (inst.marker() != curMarker) {
            std::ostringstream mStr;
            auto const& newMarker = inst.marker();
            if (!newMarker.hasFunc()) {
                os << color(ANSI_COLOR_BLUE)
                   << std::string(kIndent, ' ')
                   << "--- invalid marker"
                   << color(ANSI_COLOR_END)
                   << '\n';
            } else {
                auto func = newMarker.func();
                if (!curMarker.hasFunc() || func != curMarker.func()) {
                    func->prettyPrint(mStr, Func::PrintOpts().noFpi());
                }
                mStr << std::string(kIndent, ' ')
                     << newMarker.show()
                     << '\n';

                auto bcOffset = newMarker.bcOff();
                func->unit()->prettyPrint(
                    mStr, Unit::PrintOpts()
                    .range(bcOffset, bcOffset+1)
                    .noLineNumbers()
                    .noFuncs()
                    .indent(0));
                std::vector<std::string> vec;
                folly::split('\n', mStr.str(), vec);
                os << markerEndl;
                markerEndl = "\n";
                for (auto& s : vec) {
                    if (s.empty()) continue;
                    os << color(ANSI_COLOR_BLUE) << s << color(ANSI_COLOR_END) << '\n';
                }
            }

            curMarker = newMarker;
        }

        if (inst.op() == DefLabel) {
            // print phi pseudo-instructions
            for (unsigned i = 0, n = inst.numDsts(); i < n; ++i) {
                os << std::string(kIndent +
                                  folly::format("({}) ", inst.id()).str().size(),
                                  ' ');
                auto dst = inst.dst(i);
                jit::print(os, dst);
                os << punc(" = ") << color(ANSI_COLOR_CYAN) << "phi "
                   << color(ANSI_COLOR_END);
                bool first = true;
                inst.block()->forEachSrc(i, [&](IRInstruction* jmp, SSATmp*) {
                    if (!first) os << punc(", ");
                    first = false;
                    printSrc(os, jmp, i);
                    os << punc("@");
                    printLabel(os, jmp->block());
                });
                os << '\n';
            }
        }

        os << std::string(kIndent, ' ');
        jit::print(os, &inst, guards);
        os << '\n';

        if (asmInfo) {
            // There can be asm ranges in areas other than the one this blocks claims
            // to be in so we have to iterate all the areas to be sure to get
            // everything.
            for (auto i = 0; i < kNumAreas; ++i) {
                AreaIndex currentArea = static_cast<AreaIndex>(i);
                TcaRange instRange = asmInfo->instRangesForArea(currentArea)[inst];
                if (!instRange.empty()) {
                    os << std::string(kIndent + 4, ' ') << areaAsString(currentArea);
                    os << ":\n";
                    disasmRange(os, instRange.begin(), instRange.end());
                    os << '\n';
                    if (currentArea == area) {
                        // FIXME: this used to be an assertion
                        auto things_are_ok =
                            instRange.end() >= blockRange.start() &&
                            instRange.end() <= blockRange.end();
                        if (things_are_ok) {
                            blockRange = TcaRange(instRange.end(), blockRange.end());
                        } else {
                            // Don't crash; do something broken instead.
                            os << "<note: print range is probably incorrect right now>\n";
                        }
                    }
                }
            }
        }
    }

    if (asmInfo) {
        // Print code associated with the block that isn't tied to any instruction.
        if (!blockRange.empty()) {
            os << std::string(kIndent, ' ') << punc("A:") << "\n";
            disasmRange(os, blockRange.start(), blockRange.end());
            os << '\n';
        }
    }

    os << std::string(kIndent - 2, ' ');
    auto next = block->empty() ? nullptr : block->next();
    if (next) {
        os << punc("-> ");
        printLabel(os, next);
        os << '\n';
    } else {
        os << "no fallthrough\n";
    }
}
Пример #21
0
void print(std::ostream& os, const Block* block,
           const RegAllocInfo* regs, const AsmInfo* asmInfo,
           const GuardConstraints* guards, BCMarker* markerPtr) {
  BCMarker dummy;
  BCMarker& curMarker = markerPtr ? *markerPtr : dummy;

  TcaRange blockRange = asmInfo ? asmInfo->asmRanges[block] :
    TcaRange(nullptr, nullptr);

  os << '\n' << std::string(kIndent - 3, ' ');
  printLabel(os, block);
  os << punc(":");
  auto& preds = block->preds();
  if (!preds.empty()) {
    os << " (preds";
    for (auto const& edge : preds) {
      os << " B" << edge.from()->id();
    }
    os << ')';
  }
  os << "\n";

  if (block->empty()) {
    os << std::string(kIndent, ' ') << "empty block\n";
    return;
  }

  const char* markerEndl = "";
  for (auto it = block->begin(); it != block->end();) {
    auto& inst = *it; ++it;

    if (inst.marker() != curMarker) {
      std::ostringstream mStr;
      auto const& newMarker = inst.marker();
      if (!newMarker.hasFunc()) {
        os << color(ANSI_COLOR_BLUE)
           << std::string(kIndent, ' ')
           << "--- invalid marker"
           << color(ANSI_COLOR_END)
           << '\n';
      } else {
        auto func = newMarker.func();
        if (!curMarker.hasFunc() || func != curMarker.func()) {
          func->prettyPrint(mStr, Func::PrintOpts().noFpi());
        }
        mStr << std::string(kIndent, ' ')
             << newMarker.show()
             << '\n';

        auto bcOffset = newMarker.bcOff();
        func->unit()->prettyPrint(
          mStr, Unit::PrintOpts()
          .range(bcOffset, bcOffset+1)
          .noLineNumbers()
          .noFuncs()
          .indent(0));
        std::vector<std::string> vec;
        folly::split('\n', mStr.str(), vec);
        os << markerEndl;
        markerEndl = "\n";
        for (auto& s : vec) {
          if (s.empty()) continue;
          os << color(ANSI_COLOR_BLUE) << s << color(ANSI_COLOR_END) << '\n';
        }
      }

      curMarker = newMarker;
    }

    if (inst.op() == DefLabel) {
      // print phi pseudo-instructions
      for (unsigned i = 0, n = inst.numDsts(); i < n; ++i) {
        os << std::string(kIndent +
                          folly::format("({}) ", inst.id()).str().size(),
                          ' ');
        auto dst = inst.dst(i);
        jit::print(os, dst, dstLoc(regs, &inst, i));
        os << punc(" = ") << color(ANSI_COLOR_CYAN) << "phi "
           << color(ANSI_COLOR_END);
        bool first = true;
        inst.block()->forEachSrc(i, [&](IRInstruction* jmp, SSATmp*) {
            if (!first) os << punc(", ");
            first = false;
            printSrc(os, jmp, i, regs);
            os << punc("@");
            printLabel(os, jmp->block());
          });
        os << '\n';
      }
    }

    os << std::string(kIndent, ' ');
    jit::print(os, &inst, regs, guards);
    os << '\n';

    if (asmInfo) {
      TcaRange instRange = asmInfo->instRanges[inst];
      if (!instRange.empty()) {
        disasmRange(os, instRange.begin(), instRange.end());
        os << '\n';
        assert(instRange.end() >= blockRange.start() &&
               instRange.end() <= blockRange.end());
        blockRange = TcaRange(instRange.end(), blockRange.end());
      }
    }
  }

  if (asmInfo) {
    // print code associated with this block that isn't tied to any
    // instruction.  This includes code after the last isntruction (e.g.
    // jmp to next block), and ACold or AFrozen code.
    if (!blockRange.empty()) {
      os << std::string(kIndent, ' ') << punc("A:") << "\n";
      disasmRange(os, blockRange.start(), blockRange.end());
    }
    auto acoldRange = asmInfo->acoldRanges[block];
    if (!acoldRange.empty()) {
      os << std::string(kIndent, ' ') << punc("ACold:") << "\n";
      disasmRange(os, acoldRange.start(), acoldRange.end());
    }
    auto afrozenRange = asmInfo->afrozenRanges[block];
    if (!afrozenRange.empty()) {
      os << std::string(kIndent, ' ') << punc("AFrozen:") << "\n";
      disasmRange(os, afrozenRange.start(), afrozenRange.end());
    }
    if (!blockRange.empty() || !acoldRange.empty() || !afrozenRange.empty()) {
      os << '\n';
    }
  }

  os << std::string(kIndent - 2, ' ');
  auto next = block->empty() ? nullptr : block->next();
  if (next) {
    os << punc("-> ");
    printLabel(os, next);
    os << '\n';
  } else {
    os << "no fallthrough\n";
  }
}
Пример #22
0
boolean doCellRow(struct hash *ra, char *org)
// print one cell row
{
char *s;

s = hashFindVal(ra, ORGANISM);
if (s != NULL)
    {
    char *cellOrg = cloneString(s);
    strLower(cellOrg);
    if (differentString(cellOrg, org))
        return FALSE;
    }

// pathBuffer for new protocols not in human
char pathBuffer[PATH_LEN];
safef(pathBuffer, sizeof(pathBuffer), "/ENCODE/protocols/cell/%s/",org);

if (sameWord(org, ORG_HUMAN))
    {
    if (cgiOptionalInt("tier",0))
        {
        if (hashFindVal(ra,"tier") == NULL)
            return FALSE;
        if (atoi(hashFindVal(ra,"tier"))!=cgiOptionalInt("tier",0))
            return FALSE;
        }
    if (cgiOptionalString("tiers"))
        {
        if (hashFindVal(ra,"tier") == NULL)
            return FALSE;
        boolean found=FALSE;
        char *tiers=cloneString(cgiOptionalString("tiers"));
        char *tier;
        (void)strSwapChar(tiers,',',' ');
        while ((tier=nextWord(&tiers)))
            {
            if (atoi(hashFindVal(ra,"tier"))==atoi(tier))
                {
                found=TRUE;
                break;
                }
            }
        if (!found)
            return FALSE;
        }
    puts("<TR>");
    char *term = printTerm(ra);

    printSetting(ra, "tier");
    printDescription(ra,NULL,-1);
    printSetting(ra,"lineage");
    printSetting(ra,"tissue");
    printSetting(ra,"karyotype");
    printSetting(ra,"sex");
    printDocumentLink(ra,term,"protocol",pathBuffer,NULL,TRUE);
    printSettingsWithUrls(ra,"orderUrl","vendorName","vendorId");
    printSettingsWithUrls(ra,"termUrl","termId",NULL);
    printLabel(ra,term);
    puts("</TR>");
    }
else        // non-human cell type
    {
    puts("<TR>");
    char *term = printTerm(ra);

    printDescription(ra,NULL,8);
    printSetting(ra,"category");
    printSetting(ra,"tissue");
    printSetting(ra,"sex");
    //printSetting(ra,"karyotype");
    printDocumentLink(ra,term,"protocol",pathBuffer,NULL,TRUE);
    printSettingsWithUrls(ra,"orderUrl","vendorName","vendorId");
    printSettingsWithUrls(ra,"termUrl","termId",NULL);
    printLabel(ra,term);
    puts("</TR>");

    }
return TRUE;
}