LLVM 20.0.0git
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
15using 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
56namespace 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
raw_pwrite_stream & OS
Streaming machine code generation interface.
Definition: MCStreamer.h:213
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
LLVM Value Representation.
Definition: Value.h:74
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ Val_GNU_MIPS_ABI_FP_SOFT
Definition: MipsABIFlags.h:88
@ Val_GNU_MIPS_ABI_FP_DOUBLE
Definition: MipsABIFlags.h:86
@ Val_GNU_MIPS_ABI_FP_XX
Definition: MipsABIFlags.h:90
@ Val_GNU_MIPS_ABI_FP_ANY
Definition: MipsABIFlags.h:85
@ Val_GNU_MIPS_ABI_FP_64A
Definition: MipsABIFlags.h:92
@ Val_GNU_MIPS_ABI_FP_64
Definition: MipsABIFlags.h:91
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:293
StringRef getFpABIString(FpABIKind Value)