MipsReginfo.cpp revision 249259
1//===-- MipsReginfo.cpp - Registerinfo handling --------------------------===// 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// .reginfo 9// Elf32_Word ri_gprmask 10// Elf32_Word ri_cprmask[4] 11// Elf32_Word ri_gp_value 12// 13// .MIPS.options - N64 14// Elf64_Byte kind (ODK_REGINFO) 15// Elf64_Byte size (40 bytes) 16// Elf64_Section section (0) 17// Elf64_Word info (unused) 18// Elf64_Word ri_gprmask () 19// Elf64_Word ri_pad () 20// Elf64_Word[4] ri_cprmask () 21// Elf64_Addr ri_gp_value () 22// 23// .MIPS.options - N32 24// Elf32_Byte kind (ODK_REGINFO) 25// Elf32_Byte size (36 bytes) 26// Elf32_Section section (0) 27// Elf32_Word info (unused) 28// Elf32_Word ri_gprmask () 29// Elf32_Word ri_pad () 30// Elf32_Word[4] ri_cprmask () 31// Elf32_Addr ri_gp_value () 32// 33//===----------------------------------------------------------------------===// 34#include "MCTargetDesc/MipsReginfo.h" 35#include "MipsSubtarget.h" 36#include "MipsTargetObjectFile.h" 37#include "llvm/MC/MCStreamer.h" 38 39using namespace llvm; 40 41// Integrated assembler version 42void 43MipsReginfo::emitMipsReginfoSectionCG(MCStreamer &OS, 44 const TargetLoweringObjectFile &TLOF, 45 const MipsSubtarget &MST) const 46{ 47 48 if (OS.hasRawTextSupport()) 49 return; 50 51 const MipsTargetObjectFile &TLOFELF = 52 static_cast<const MipsTargetObjectFile &>(TLOF); 53 OS.SwitchSection(TLOFELF.getReginfoSection()); 54 55 // .reginfo 56 if (MST.isABI_O32()) { 57 OS.EmitIntValue(0, 4); // ri_gprmask 58 OS.EmitIntValue(0, 4); // ri_cpr[0]mask 59 OS.EmitIntValue(0, 4); // ri_cpr[1]mask 60 OS.EmitIntValue(0, 4); // ri_cpr[2]mask 61 OS.EmitIntValue(0, 4); // ri_cpr[3]mask 62 OS.EmitIntValue(0, 4); // ri_gp_value 63 } 64 // .MIPS.options 65 else if (MST.isABI_N64()) { 66 OS.EmitIntValue(1, 1); // kind 67 OS.EmitIntValue(40, 1); // size 68 OS.EmitIntValue(0, 2); // section 69 OS.EmitIntValue(0, 4); // info 70 OS.EmitIntValue(0, 4); // ri_gprmask 71 OS.EmitIntValue(0, 4); // pad 72 OS.EmitIntValue(0, 4); // ri_cpr[0]mask 73 OS.EmitIntValue(0, 4); // ri_cpr[1]mask 74 OS.EmitIntValue(0, 4); // ri_cpr[2]mask 75 OS.EmitIntValue(0, 4); // ri_cpr[3]mask 76 OS.EmitIntValue(0, 8); // ri_gp_value 77 } 78 else llvm_unreachable("Unsupported abi for reginfo"); 79} 80 81