LLVM  9.0.0svn
MipsABIFlagsSection.cpp
Go to the documentation of this file.
1 //===- MipsABIFlagsSection.cpp - Mips ELF ABI Flags Section ---------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "llvm/ADT/StringRef.h"
11 #include "llvm/MC/MCStreamer.h"
14 
15 using namespace llvm;
16 
18  switch (FpABI) {
19  case FpABIKind::ANY:
21  case FpABIKind::SOFT:
23  case FpABIKind::XX:
25  case FpABIKind::S32:
27  case FpABIKind::S64:
28  if (Is32BitABI)
32  }
33 
34  llvm_unreachable("unexpected fp abi value");
35 }
36 
38  switch (Value) {
39  case FpABIKind::XX:
40  return "xx";
41  case FpABIKind::S32:
42  return "32";
43  case FpABIKind::S64:
44  return "64";
45  default:
46  llvm_unreachable("unsupported fp abi value");
47  }
48 }
49 
51  if (FpABI == FpABIKind::XX)
52  return (uint8_t)Mips::AFL_REG_32;
53  return (uint8_t)CPR1Size;
54 }
55 
56 namespace llvm {
57 
59  // Write out a Elf_Internal_ABIFlags_v0 struct
60  OS.EmitIntValue(ABIFlagsSection.getVersionValue(), 2); // version
61  OS.EmitIntValue(ABIFlagsSection.getISALevelValue(), 1); // isa_level
62  OS.EmitIntValue(ABIFlagsSection.getISARevisionValue(), 1); // isa_rev
63  OS.EmitIntValue(ABIFlagsSection.getGPRSizeValue(), 1); // gpr_size
64  OS.EmitIntValue(ABIFlagsSection.getCPR1SizeValue(), 1); // cpr1_size
65  OS.EmitIntValue(ABIFlagsSection.getCPR2SizeValue(), 1); // cpr2_size
66  OS.EmitIntValue(ABIFlagsSection.getFpABIValue(), 1); // fp_abi
67  OS.EmitIntValue(ABIFlagsSection.getISAExtensionValue(), 4); // isa_ext
68  OS.EmitIntValue(ABIFlagsSection.getASESetValue(), 4); // ases
69  OS.EmitIntValue(ABIFlagsSection.getFlags1Value(), 4); // flags1
70  OS.EmitIntValue(ABIFlagsSection.getFlags2Value(), 4); // flags2
71  return OS;
72 }
73 
74 } // end namespace llvm
This class represents lattice values for constants.
Definition: AllocatorList.h:23
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:123
Streaming machine code generation interface.
Definition: MCStreamer.h:188
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:2038
LLVM Value Representation.
Definition: Value.h:72
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48