LLVM API Documentation

MipsELFStreamer.cpp
Go to the documentation of this file.
00001 //===-------- MipsELFStreamer.cpp - ELF Object Output ---------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #include "MipsELFStreamer.h"
00011 #include "llvm/MC/MCInst.h"
00012 using namespace llvm;
00013 
00014 void MipsELFStreamer::EmitInstruction(const MCInst &Inst,
00015                                       const MCSubtargetInfo &STI) {
00016   MCELFStreamer::EmitInstruction(Inst, STI);
00017 
00018   MCContext &Context = getContext();
00019   const MCRegisterInfo *MCRegInfo = Context.getRegisterInfo();
00020 
00021   for (unsigned OpIndex = 0; OpIndex < Inst.getNumOperands(); ++OpIndex) {
00022     const MCOperand &Op = Inst.getOperand(OpIndex);
00023 
00024     if (!Op.isReg())
00025       continue;
00026 
00027     unsigned Reg = Op.getReg();
00028     RegInfoRecord->SetPhysRegUsed(Reg, MCRegInfo);
00029   }
00030 }
00031 
00032 void MipsELFStreamer::EmitMipsOptionRecords() {
00033   for (const auto &I : MipsOptionRecords)
00034     I->EmitMipsOptionRecord();
00035 }
00036 
00037 namespace llvm {
00038 MCELFStreamer *createMipsELFStreamer(MCContext &Context, MCAsmBackend &MAB,
00039                                      raw_ostream &OS, MCCodeEmitter *Emitter,
00040                                      const MCSubtargetInfo &STI, bool RelaxAll,
00041                                      bool NoExecStack) {
00042   return new MipsELFStreamer(Context, MAB, OS, Emitter, STI);
00043 }
00044 }