blob: a901af2df75d13e53a3e8627e3ff40988829e731 [file] [log] [blame]
Daniel Sandersc7dbc632014-07-08 10:11:38 +00001//===-- MipsABIFlagsSection.cpp - Mips ELF ABI Flags Section ---*- C++ -*--===//
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 "MipsABIFlagsSection.h"
11
12using namespace llvm;
13
14StringRef MipsABIFlagsSection::getFpABIString(Val_GNU_MIPS_ABI Value,
15 bool Is32BitAbi) {
16 switch (Value) {
17 case MipsABIFlagsSection::Val_GNU_MIPS_ABI_FP_XX:
18 return "xx";
19 case MipsABIFlagsSection::Val_GNU_MIPS_ABI_FP_64:
20 return "64";
21 case MipsABIFlagsSection::Val_GNU_MIPS_ABI_FP_DOUBLE:
22 if (Is32BitAbi)
23 return "32";
24 return "64";
25 default:
26 llvm_unreachable("unsupported fp abi value");
27 }
28}
29
30namespace llvm {
31MCStreamer &operator<<(MCStreamer &OS, MipsABIFlagsSection &ABIFlagsSection) {
32 // Write out a Elf_Internal_ABIFlags_v0 struct
33 OS.EmitIntValue(ABIFlagsSection.getVersion(), 2); // version
34 OS.EmitIntValue(ABIFlagsSection.getISALevel(), 1); // isa_level
35 OS.EmitIntValue(ABIFlagsSection.getISARevision(), 1); // isa_rev
36 OS.EmitIntValue(ABIFlagsSection.getGPRSize(), 1); // gpr_size
37 OS.EmitIntValue(ABIFlagsSection.getCPR1Size(), 1); // cpr1_size
38 OS.EmitIntValue(ABIFlagsSection.getCPR2Size(), 1); // cpr2_size
39 OS.EmitIntValue(ABIFlagsSection.getFpABI(), 1); // fp_abi
40 OS.EmitIntValue(ABIFlagsSection.getISAExtensionSet(), 4); // isa_ext
41 OS.EmitIntValue(ABIFlagsSection.getASESet(), 4); // ases
42 OS.EmitIntValue(ABIFlagsSection.getFlags1(), 4); // flags1
43 OS.EmitIntValue(ABIFlagsSection.getFlags2(), 4); // flags2
44 return OS;
45}
46}