summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.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/MipsTargetStreamer.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/MipsTargetStreamer.cpp')
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp58
1 files changed, 9 insertions, 49 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
index a81849e2a38..5ebcbc8cb0f 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
@@ -211,50 +211,20 @@ void MipsTargetAsmStreamer::emitDirectiveCpsetup(unsigned RegNo,
setCanHaveModuleDir(false);
}
-void MipsTargetAsmStreamer::emitDirectiveModule(unsigned Value,
- bool is32BitAbi) {
+void MipsTargetAsmStreamer::emitDirectiveModuleFP(Val_GNU_MIPS_ABI Value,
+ bool Is32BitAbi) {
+ MipsTargetStreamer::emitDirectiveModuleFP(Value, Is32BitAbi);
+
StringRef ModuleValue;
OS << "\t.module\tfp=";
- switch (Value) {
- case Val_GNU_MIPS_ABI_FP_XX:
- ModuleValue = "xx";
- break;
- case Val_GNU_MIPS_ABI_FP_64:
- ModuleValue = "64";
- break;
- case Val_GNU_MIPS_ABI_FP_DOUBLE:
- if (is32BitAbi)
- ModuleValue = "32";
- else
- ModuleValue = "64";
- break;
- default:
- llvm_unreachable("unsupported .module value");
- }
- OS << ModuleValue << "\n";
+ OS << ABIFlagsSection.getFpABIString(Value, Is32BitAbi) << "\n";
}
-void MipsTargetAsmStreamer::emitDirectiveSetFp(unsigned Value,
- bool is32BitAbi) {
+void MipsTargetAsmStreamer::emitDirectiveSetFp(Val_GNU_MIPS_ABI Value,
+ bool Is32BitAbi) {
StringRef ModuleValue;
OS << "\t.set\tfp=";
- switch (Value) {
- case Val_GNU_MIPS_ABI_FP_XX:
- ModuleValue = "xx";
- break;
- case Val_GNU_MIPS_ABI_FP_64:
- ModuleValue = "64";
- break;
- case Val_GNU_MIPS_ABI_FP_DOUBLE:
- if (is32BitAbi)
- ModuleValue = "32";
- else
- ModuleValue = "64";
- break;
- default:
- llvm_unreachable("unsupported .set fp value");
- }
- OS << ModuleValue << "\n";
+ OS << ABIFlagsSection.getFpABIString(Value, Is32BitAbi) << "\n";
}
void MipsTargetAsmStreamer::emitMipsAbiFlags() {
@@ -661,15 +631,5 @@ void MipsTargetELFStreamer::emitMipsAbiFlags() {
ABIShndxSD.setAlignment(8);
OS.SwitchSection(Sec);
- OS.EmitIntValue(MipsABIFlags.version, 2); // version
- OS.EmitIntValue(MipsABIFlags.isa_level, 1); // isa_level
- OS.EmitIntValue(MipsABIFlags.isa_rev, 1); // isa_rev
- OS.EmitIntValue(MipsABIFlags.gpr_size, 1); // gpr_size
- OS.EmitIntValue(MipsABIFlags.cpr1_size, 1); // cpr1_size
- OS.EmitIntValue(MipsABIFlags.cpr2_size, 1); // cpr2_size
- OS.EmitIntValue(MipsABIFlags.fp_abi, 1); // fp_abi
- OS.EmitIntValue(MipsABIFlags.isa_ext, 4); // isa_ext
- OS.EmitIntValue(MipsABIFlags.ases, 4); // ases
- OS.EmitIntValue(MipsABIFlags.flags1, 4); // flags1
- OS.EmitIntValue(MipsABIFlags.flags2, 4); // flags2
+ OS << ABIFlagsSection;
}
OpenPOWER on IntegriCloud