コード例 #1
0
ファイル: owcoff.c プロジェクト: ABratovic/open-watcom-v2
void COFFFileEmit( owl_file_handle file ) {
//*****************************************

    prepareExportSection( file );
    prepareStringTable( file );
    calcNumSymbols( file );
    calcSectionOffsets( file );
    calcLineNumSymbolIndices( file );
    emitFileHeader( file );
    emitSectionHeaders( file );
    emitSectionData( file );
    emitSymbolTable( file );
    emitStringTable( file );
}
コード例 #2
0
ファイル: nv50_ir_target.cpp プロジェクト: Distrotech/Mesa
bool
Program::emitBinary(struct nv50_ir_prog_info *info)
{
   CodeEmitter *emit = target->getCodeEmitter(progType);

   emit->prepareEmission(this);

   if (dbgFlags & NV50_IR_DEBUG_BASIC)
      this->print();

   if (!binSize) {
      code = NULL;
      return false;
   }
   code = reinterpret_cast<uint32_t *>(MALLOC(binSize));
   if (!code)
      return false;
   emit->setCodeLocation(code, binSize);
   info->bin.instructions = 0;

   for (ArrayList::Iterator fi = allFuncs.iterator(); !fi.end(); fi.next()) {
      Function *fn = reinterpret_cast<Function *>(fi.get());

      assert(emit->getCodeSize() == fn->binPos);

      for (int b = 0; b < fn->bbCount; ++b) {
         for (Instruction *i = fn->bbArray[b]->getEntry(); i; i = i->next) {
            emit->emitInstruction(i);
            info->bin.instructions++;
            if (i->sType == TYPE_F64 || i->dType == TYPE_F64)
               info->io.fp64 = true;
         }
      }
   }
   info->bin.relocData = emit->getRelocInfo();
   info->bin.interpData = emit->getInterpInfo();

   emitSymbolTable(info);

   // the nvc0 driver will print the binary iself together with the header
   if ((dbgFlags & NV50_IR_DEBUG_BASIC) && getTarget()->getChipset() < 0xc0)
      emit->printBinary();

   delete emit;
   return true;
}