803ab85657dcd553fdceb93e5345f154a2796b32
[oota-llvm.git] / lib / Target / Mips / MCTargetDesc / MipsELFStreamer.cpp
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
13 void MipsELFStreamer::EmitInstruction(const MCInst &Inst,
14                                       const MCSubtargetInfo &STI) {
15   MCELFStreamer::EmitInstruction(Inst, STI);
16
17   MCContext &Context = getContext();
18   const MCRegisterInfo *MCRegInfo = Context.getRegisterInfo();
19
20   for (unsigned OpIndex = 0; OpIndex < Inst.getNumOperands(); ++OpIndex) {
21     const MCOperand &Op = Inst.getOperand(OpIndex);
22
23     if (!Op.isReg())
24       continue;
25
26     unsigned Reg = Op.getReg();
27     RegInfoRecord->SetPhysRegUsed(Reg, MCRegInfo);
28   }
29 }
30
31 void MipsELFStreamer::EmitMipsOptionRecords() {
32   for (const auto &I : MipsOptionRecords)
33     I->EmitMipsOptionRecord();
34 }
35
36 namespace llvm {
37 MCELFStreamer *createMipsELFStreamer(MCContext &Context, MCAsmBackend &MAB,
38                                      raw_ostream &OS, MCCodeEmitter *Emitter,
39                                      const MCSubtargetInfo &STI, bool RelaxAll,
40                                      bool NoExecStack) {
41   return new MipsELFStreamer(Context, MAB, OS, Emitter, STI);
42 }
43 }