1 //===-------- MipsELFStreamer.cpp - ELF Object Output ---------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "MipsELFStreamer.h" 11 #include "llvm/MC/MCInst.h" 12 using namespace llvm; 13 14 void MipsELFStreamer::EmitInstruction(const MCInst &Inst, 15 const MCSubtargetInfo &STI) { 16 MCELFStreamer::EmitInstruction(Inst, STI); 17 18 MCContext &Context = getContext(); 19 const MCRegisterInfo *MCRegInfo = Context.getRegisterInfo(); 20 21 for (unsigned OpIndex = 0; OpIndex < Inst.getNumOperands(); ++OpIndex) { 22 const MCOperand &Op = Inst.getOperand(OpIndex); 23 24 if (!Op.isReg()) 25 continue; 26 27 unsigned Reg = Op.getReg(); 28 RegInfoRecord->SetPhysRegUsed(Reg, MCRegInfo); 29 } 30 } 31 32 void MipsELFStreamer::EmitMipsOptionRecords() { 33 for (const auto &I : MipsOptionRecords) 34 I->EmitMipsOptionRecord(); 35 } 36 37 namespace llvm { 38 MCELFStreamer *createMipsELFStreamer(MCContext &Context, MCAsmBackend &MAB, 39 raw_ostream &OS, MCCodeEmitter *Emitter, 40 const MCSubtargetInfo &STI, 41 bool RelaxAll) { 42 return new MipsELFStreamer(Context, MAB, OS, Emitter, STI); 43 } 44 } 45