void MCObjectStreamer::EmitInstToFragment(const MCInst &Inst) { MCInstFragment *IF = new MCInstFragment(Inst, getCurrentSectionData()); SmallString<128> Code; raw_svector_ostream VecOS(Code); getAssembler().getEmitter().EncodeInstruction(Inst, VecOS, IF->getFixups()); VecOS.flush(); IF->getCode().append(Code.begin(), Code.end()); }
void WinCOFFStreamer::EmitInstruction(const MCInst &Instruction) { for (unsigned i = 0, e = Instruction.getNumOperands(); i != e; ++i) if (Instruction.getOperand(i).isExpr()) AddValueSymbols(Instruction.getOperand(i).getExpr()); getCurrentSectionData()->setHasInstructions(true); MCInstFragment *Fragment = new MCInstFragment(Instruction, getCurrentSectionData()); raw_svector_ostream VecOS(Fragment->getCode()); getAssembler().getEmitter().EncodeInstruction(Instruction, VecOS, Fragment->getFixups()); }
void MCPureStreamer::EmitInstToFragment(const MCInst &Inst) { MCInstFragment *IF = new MCInstFragment(Inst, getCurrentSectionData()); // Add the fixups and data. // // FIXME: Revisit this design decision when relaxation is done, we may be // able to get away with not storing any extra data in the MCInst. SmallVector<MCFixup, 4> Fixups; SmallString<256> Code; raw_svector_ostream VecOS(Code); getAssembler().getEmitter().EncodeInstruction(Inst, VecOS, Fixups); VecOS.flush(); IF->getCode() = Code; IF->getFixups() = Fixups; }
void MCObjectStreamer::EmitInstToFragment(const MCInst &Inst) { MCInstFragment *IF = new MCInstFragment(Inst, getCurrentSectionData()); raw_svector_ostream VecOS(IF->getCode()); getAssembler().getEmitter().EncodeInstruction(Inst, VecOS, IF->getFixups()); }