summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2014-07-08 10:11:38 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2014-07-08 10:11:38 +0000
commitc7dbc630e536470c2a10ef20c38d256832d8204f (patch)
tree08e4cad4fd5cc5752d89d0fcffc7938a8d5f4dfa /llvm/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp
parentb8a86c43c08f7678ccb4fc3ac54a01693f21559c (diff)
downloadbcm5719-llvm-c7dbc630e536470c2a10ef20c38d256832d8204f.tar.gz
bcm5719-llvm-c7dbc630e536470c2a10ef20c38d256832d8204f.zip
[mips] Improve encapsulation of the .MIPS.abiflags implementation and limit scope of related enums
Summary: Follow on to r212519 to improve the encapsulation and limit the scope of the enums. Also merged two very similar parser functions, fixed a bug where ASE's were not being reported, and marked CPR1's as being 128-bit when MSA is enabled. Differential Revision: http://reviews.llvm.org/D4384 llvm-svn: 212522
Diffstat (limited to 'llvm/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp')
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp
new file mode 100644
index 00000000000..a901af2df75
--- /dev/null
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp
@@ -0,0 +1,46 @@
+//===-- MipsABIFlagsSection.cpp - Mips ELF ABI Flags Section ---*- C++ -*--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "MipsABIFlagsSection.h"
+
+using namespace llvm;
+
+StringRef MipsABIFlagsSection::getFpABIString(Val_GNU_MIPS_ABI Value,
+ bool Is32BitAbi) {
+ switch (Value) {
+ case MipsABIFlagsSection::Val_GNU_MIPS_ABI_FP_XX:
+ return "xx";
+ case MipsABIFlagsSection::Val_GNU_MIPS_ABI_FP_64:
+ return "64";
+ case MipsABIFlagsSection::Val_GNU_MIPS_ABI_FP_DOUBLE:
+ if (Is32BitAbi)
+ return "32";
+ return "64";
+ default:
+ llvm_unreachable("unsupported fp abi value");
+ }
+}
+
+namespace llvm {
+MCStreamer &operator<<(MCStreamer &OS, MipsABIFlagsSection &ABIFlagsSection) {
+ // Write out a Elf_Internal_ABIFlags_v0 struct
+ OS.EmitIntValue(ABIFlagsSection.getVersion(), 2); // version
+ OS.EmitIntValue(ABIFlagsSection.getISALevel(), 1); // isa_level
+ OS.EmitIntValue(ABIFlagsSection.getISARevision(), 1); // isa_rev
+ OS.EmitIntValue(ABIFlagsSection.getGPRSize(), 1); // gpr_size
+ OS.EmitIntValue(ABIFlagsSection.getCPR1Size(), 1); // cpr1_size
+ OS.EmitIntValue(ABIFlagsSection.getCPR2Size(), 1); // cpr2_size
+ OS.EmitIntValue(ABIFlagsSection.getFpABI(), 1); // fp_abi
+ OS.EmitIntValue(ABIFlagsSection.getISAExtensionSet(), 4); // isa_ext
+ OS.EmitIntValue(ABIFlagsSection.getASESet(), 4); // ases
+ OS.EmitIntValue(ABIFlagsSection.getFlags1(), 4); // flags1
+ OS.EmitIntValue(ABIFlagsSection.getFlags2(), 4); // flags2
+ return OS;
+}
+}
OpenPOWER on IntegriCloud