LLVM  8.0.1
MipsABIFlagsSection.cpp
Go to the documentation of this file.
1 //===- MipsABIFlagsSection.cpp - Mips ELF ABI Flags Section ---------------===//
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 
11 #include "llvm/ADT/StringRef.h"
12 #include "llvm/MC/MCStreamer.h"
15 
16 using namespace llvm;
17 
19  switch (FpABI) {
20  case FpABIKind::ANY:
22  case FpABIKind::SOFT:
24  case FpABIKind::XX:
26  case FpABIKind::S32:
28  case FpABIKind::S64:
29  if (Is32BitABI)
33  }
34 
35  llvm_unreachable("unexpected fp abi value");
36 }
37 
39  switch (Value) {
40  case FpABIKind::XX:
41  return "xx";
42  case FpABIKind::S32:
43  return "32";
44  case FpABIKind::S64:
45  return "64";
46  default:
47  llvm_unreachable("unsupported fp abi value");
48  }
49 }
50 
52  if (FpABI == FpABIKind::XX)
53  return (uint8_t)Mips::AFL_REG_32;
54  return (uint8_t)CPR1Size;
55 }
56 
57 namespace llvm {
58 
60  // Write out a Elf_Internal_ABIFlags_v0 struct
61  OS.EmitIntValue(ABIFlagsSection.getVersionValue(), 2); // version
62  OS.EmitIntValue(ABIFlagsSection.getISALevelValue(), 1); // isa_level
63  OS.EmitIntValue(ABIFlagsSection.getISARevisionValue(), 1); // isa_rev
64  OS.EmitIntValue(ABIFlagsSection.getGPRSizeValue(), 1); // gpr_size
65  OS.EmitIntValue(ABIFlagsSection.getCPR1SizeValue(), 1); // cpr1_size
66  OS.EmitIntValue(ABIFlagsSection.getCPR2SizeValue(), 1); // cpr2_size
67  OS.EmitIntValue(ABIFlagsSection.getFpABIValue(), 1); // fp_abi
68  OS.EmitIntValue(ABIFlagsSection.getISAExtensionValue(), 4); // isa_ext
69  OS.EmitIntValue(ABIFlagsSection.getASESetValue(), 4); // ases
70  OS.EmitIntValue(ABIFlagsSection.getFlags1Value(), 4); // flags1
71  OS.EmitIntValue(ABIFlagsSection.getFlags2Value(), 4); // flags2
72  return OS;
73 }
74 
75 } // end namespace llvm
This class represents lattice values for constants.
Definition: AllocatorList.h:24
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:124
Streaming machine code generation interface.
Definition: MCStreamer.h:189
StringRef getFpABIString(FpABIKind Value)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
Definition: APInt.h:2039
LLVM Value Representation.
Definition: Value.h:73
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49