LLVM API Documentation

MipsOptionRecord.h
Go to the documentation of this file.
00001 //===-- MipsOptionRecord.h - Abstraction for storing information ----------===//
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 // MipsOptionRecord - Abstraction for storing arbitrary information in
00011 // ELF files. Arbitrary information (e.g. register usage) can be stored in Mips
00012 // specific ELF sections like .Mips.options. Specific records should subclass
00013 // MipsOptionRecord and provide an implementation to EmitMipsOptionRecord which
00014 // basically just dumps the information into an ELF section. More information
00015 // about .Mips.option can be found in the SysV ABI and the 64-bit ELF Object
00016 // specification.
00017 //
00018 //===----------------------------------------------------------------------===//
00019 
00020 #ifndef LLVM_LIB_TARGET_MIPS_MIPSOPTIONRECORD_H
00021 #define LLVM_LIB_TARGET_MIPS_MIPSOPTIONRECORD_H
00022 
00023 #include "MCTargetDesc/MipsMCTargetDesc.h"
00024 #include "llvm/MC/MCContext.h"
00025 #include "llvm/MC/MCRegisterInfo.h"
00026 
00027 namespace llvm {
00028 class MipsELFStreamer;
00029 class MCSubtargetInfo;
00030 
00031 class MipsOptionRecord {
00032 public:
00033   virtual ~MipsOptionRecord(){};
00034   virtual void EmitMipsOptionRecord() = 0;
00035 };
00036 
00037 class MipsRegInfoRecord : public MipsOptionRecord {
00038 public:
00039   MipsRegInfoRecord(MipsELFStreamer *S, MCContext &Context,
00040                     const MCSubtargetInfo &STI)
00041       : Streamer(S), Context(Context), STI(STI) {
00042     ri_gprmask = 0;
00043     ri_cprmask[0] = ri_cprmask[1] = ri_cprmask[2] = ri_cprmask[3] = 0;
00044     ri_gp_value = 0;
00045 
00046     const MCRegisterInfo *TRI = Context.getRegisterInfo();
00047     GPR32RegClass = &(TRI->getRegClass(Mips::GPR32RegClassID));
00048     GPR64RegClass = &(TRI->getRegClass(Mips::GPR64RegClassID));
00049     FGR32RegClass = &(TRI->getRegClass(Mips::FGR32RegClassID));
00050     FGR64RegClass = &(TRI->getRegClass(Mips::FGR64RegClassID));
00051     AFGR64RegClass = &(TRI->getRegClass(Mips::AFGR64RegClassID));
00052     MSA128BRegClass = &(TRI->getRegClass(Mips::MSA128BRegClassID));
00053     COP2RegClass = &(TRI->getRegClass(Mips::COP2RegClassID));
00054     COP3RegClass = &(TRI->getRegClass(Mips::COP3RegClassID));
00055   }
00056   ~MipsRegInfoRecord() {}
00057 
00058   void EmitMipsOptionRecord() override;
00059   void SetPhysRegUsed(unsigned Reg, const MCRegisterInfo *MCRegInfo);
00060 
00061 private:
00062   MipsELFStreamer *Streamer;
00063   MCContext &Context;
00064   const MCSubtargetInfo &STI;
00065   const MCRegisterClass *GPR32RegClass;
00066   const MCRegisterClass *GPR64RegClass;
00067   const MCRegisterClass *FGR32RegClass;
00068   const MCRegisterClass *FGR64RegClass;
00069   const MCRegisterClass *AFGR64RegClass;
00070   const MCRegisterClass *MSA128BRegClass;
00071   const MCRegisterClass *COP2RegClass;
00072   const MCRegisterClass *COP3RegClass;
00073   uint32_t ri_gprmask;
00074   uint32_t ri_cprmask[4];
00075   int64_t ri_gp_value;
00076 };
00077 } // namespace llvm
00078 #endif