MipsReginfo.cpp revision 249259
1249259Sdim//===-- MipsReginfo.cpp - Registerinfo handling --------------------------===// 2249259Sdim// 3249259Sdim// The LLVM Compiler Infrastructure 4249259Sdim// 5249259Sdim// This file is distributed under the University of Illinois Open Source 6249259Sdim// License. See LICENSE.TXT for details. 7249259Sdim// 8249259Sdim// .reginfo 9249259Sdim// Elf32_Word ri_gprmask 10249259Sdim// Elf32_Word ri_cprmask[4] 11249259Sdim// Elf32_Word ri_gp_value 12249259Sdim// 13249259Sdim// .MIPS.options - N64 14249259Sdim// Elf64_Byte kind (ODK_REGINFO) 15249259Sdim// Elf64_Byte size (40 bytes) 16249259Sdim// Elf64_Section section (0) 17249259Sdim// Elf64_Word info (unused) 18249259Sdim// Elf64_Word ri_gprmask () 19249259Sdim// Elf64_Word ri_pad () 20249259Sdim// Elf64_Word[4] ri_cprmask () 21249259Sdim// Elf64_Addr ri_gp_value () 22249259Sdim// 23249259Sdim// .MIPS.options - N32 24249259Sdim// Elf32_Byte kind (ODK_REGINFO) 25249259Sdim// Elf32_Byte size (36 bytes) 26249259Sdim// Elf32_Section section (0) 27249259Sdim// Elf32_Word info (unused) 28249259Sdim// Elf32_Word ri_gprmask () 29249259Sdim// Elf32_Word ri_pad () 30249259Sdim// Elf32_Word[4] ri_cprmask () 31249259Sdim// Elf32_Addr ri_gp_value () 32249259Sdim// 33249259Sdim//===----------------------------------------------------------------------===// 34249259Sdim#include "MCTargetDesc/MipsReginfo.h" 35249259Sdim#include "MipsSubtarget.h" 36249259Sdim#include "MipsTargetObjectFile.h" 37249259Sdim#include "llvm/MC/MCStreamer.h" 38249259Sdim 39249259Sdimusing namespace llvm; 40249259Sdim 41249259Sdim// Integrated assembler version 42249259Sdimvoid 43249259SdimMipsReginfo::emitMipsReginfoSectionCG(MCStreamer &OS, 44249259Sdim const TargetLoweringObjectFile &TLOF, 45249259Sdim const MipsSubtarget &MST) const 46249259Sdim{ 47249259Sdim 48249259Sdim if (OS.hasRawTextSupport()) 49249259Sdim return; 50249259Sdim 51249259Sdim const MipsTargetObjectFile &TLOFELF = 52249259Sdim static_cast<const MipsTargetObjectFile &>(TLOF); 53249259Sdim OS.SwitchSection(TLOFELF.getReginfoSection()); 54249259Sdim 55249259Sdim // .reginfo 56249259Sdim if (MST.isABI_O32()) { 57249259Sdim OS.EmitIntValue(0, 4); // ri_gprmask 58249259Sdim OS.EmitIntValue(0, 4); // ri_cpr[0]mask 59249259Sdim OS.EmitIntValue(0, 4); // ri_cpr[1]mask 60249259Sdim OS.EmitIntValue(0, 4); // ri_cpr[2]mask 61249259Sdim OS.EmitIntValue(0, 4); // ri_cpr[3]mask 62249259Sdim OS.EmitIntValue(0, 4); // ri_gp_value 63249259Sdim } 64249259Sdim // .MIPS.options 65249259Sdim else if (MST.isABI_N64()) { 66249259Sdim OS.EmitIntValue(1, 1); // kind 67249259Sdim OS.EmitIntValue(40, 1); // size 68249259Sdim OS.EmitIntValue(0, 2); // section 69249259Sdim OS.EmitIntValue(0, 4); // info 70249259Sdim OS.EmitIntValue(0, 4); // ri_gprmask 71249259Sdim OS.EmitIntValue(0, 4); // pad 72249259Sdim OS.EmitIntValue(0, 4); // ri_cpr[0]mask 73249259Sdim OS.EmitIntValue(0, 4); // ri_cpr[1]mask 74249259Sdim OS.EmitIntValue(0, 4); // ri_cpr[2]mask 75249259Sdim OS.EmitIntValue(0, 4); // ri_cpr[3]mask 76249259Sdim OS.EmitIntValue(0, 8); // ri_gp_value 77249259Sdim } 78249259Sdim else llvm_unreachable("Unsupported abi for reginfo"); 79249259Sdim} 80249259Sdim 81