1 //===-- MipsABIFlagsSection.cpp - Mips ELF ABI Flags Section ---*- C++ -*--===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "MipsABIFlagsSection.h"
14 uint8_t MipsABIFlagsSection::getFpABIValue() {
17 return Mips::Val_GNU_MIPS_ABI_FP_ANY;
19 return Mips::Val_GNU_MIPS_ABI_FP_SOFT;
21 return Mips::Val_GNU_MIPS_ABI_FP_XX;
23 return Mips::Val_GNU_MIPS_ABI_FP_DOUBLE;
26 return OddSPReg ? Mips::Val_GNU_MIPS_ABI_FP_64
27 : Mips::Val_GNU_MIPS_ABI_FP_64A;
28 return Mips::Val_GNU_MIPS_ABI_FP_DOUBLE;
31 llvm_unreachable("unexpected fp abi value");
34 StringRef MipsABIFlagsSection::getFpABIString(FpABIKind Value) {
43 llvm_unreachable("unsupported fp abi value");
47 uint8_t MipsABIFlagsSection::getCPR1SizeValue() {
48 if (FpABI == FpABIKind::XX)
49 return (uint8_t)Mips::AFL_REG_32;
50 return (uint8_t)CPR1Size;
54 MCStreamer &operator<<(MCStreamer &OS, MipsABIFlagsSection &ABIFlagsSection) {
55 // Write out a Elf_Internal_ABIFlags_v0 struct
56 OS.EmitIntValue(ABIFlagsSection.getVersionValue(), 2); // version
57 OS.EmitIntValue(ABIFlagsSection.getISALevelValue(), 1); // isa_level
58 OS.EmitIntValue(ABIFlagsSection.getISARevisionValue(), 1); // isa_rev
59 OS.EmitIntValue(ABIFlagsSection.getGPRSizeValue(), 1); // gpr_size
60 OS.EmitIntValue(ABIFlagsSection.getCPR1SizeValue(), 1); // cpr1_size
61 OS.EmitIntValue(ABIFlagsSection.getCPR2SizeValue(), 1); // cpr2_size
62 OS.EmitIntValue(ABIFlagsSection.getFpABIValue(), 1); // fp_abi
63 OS.EmitIntValue(ABIFlagsSection.getISAExtensionSetValue(), 4); // isa_ext
64 OS.EmitIntValue(ABIFlagsSection.getASESetValue(), 4); // ases
65 OS.EmitIntValue(ABIFlagsSection.getFlags1Value(), 4); // flags1
66 OS.EmitIntValue(ABIFlagsSection.getFlags2Value(), 4); // flags2