LLVM  3.7.0
MipsABIFlagsSection.cpp
Go to the documentation of this file.
1 //===-- 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 
12 using namespace llvm;
13 
15  switch (FpABI) {
16  case FpABIKind::ANY:
18  case FpABIKind::SOFT:
20  case FpABIKind::XX:
22  case FpABIKind::S32:
24  case FpABIKind::S64:
25  if (Is32BitABI)
29  }
30 
31  llvm_unreachable("unexpected fp abi value");
32 }
33 
35  switch (Value) {
36  case FpABIKind::XX:
37  return "xx";
38  case FpABIKind::S32:
39  return "32";
40  case FpABIKind::S64:
41  return "64";
42  default:
43  llvm_unreachable("unsupported fp abi value");
44  }
45 }
46 
48  if (FpABI == FpABIKind::XX)
49  return (uint8_t)Mips::AFL_REG_32;
50  return (uint8_t)CPR1Size;
51 }
52 
53 namespace llvm {
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
67  return OS;
68 }
69 }
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:98
virtual void EmitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers...
Definition: MCStreamer.cpp:79
Streaming machine code generation interface.
Definition: MCStreamer.h:157
StringRef getFpABIString(FpABIKind Value)
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
Definition: APInt.h:1738
LLVM Value Representation.
Definition: Value.h:69
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40