llvm.org GIT mirror llvm / 3b50389
[mips] [IAS] Refactor the emitDirectiveModuleFP() functions. NFC. Summary: Simplify emitDirectiveModuleFP() by having it just print the current information from MipsABIFlagsSection and doing an updateABIInfo() before such calls. This prevents us from forgetting to update the STI.FeatureBits, because updateABIInfo() uses those to update the MipsABIFlagsSection object, and also makes sure we use the update mechanism from MipsABIFlagsSection. Reviewers: dsanders Reviewed By: dsanders Subscribers: llvm-commits, mpf Differential Revision: http://reviews.llvm.org/D10642 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240637 91177308-0d34-0410-b5e6-96231b3b80d8 Toma Tabacu 4 years ago
3 changed file(s) with 25 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
46534653 return false;
46544654 }
46554655
4656 // Emit appropriate flags.
4657 getTargetStreamer().emitDirectiveModuleFP(FpABI, isABI_O32());
4656 // Synchronize the abiflags information with the FeatureBits information we
4657 // changed above.
4658 getTargetStreamer().updateABIInfo(*this);
4659
4660 // If printing assembly, use the recently updated abiflags information.
4661 // If generating ELF, don't do anything (the .MIPS.abiflags section gets
4662 // emitted at the end).
4663 getTargetStreamer().emitDirectiveModuleFP();
4664
46584665 Parser.Lex(); // Consume the EndOfStatement.
46594666 return false;
46604667 }
46794686 }
46804687
46814688 FpABI = MipsABIFlagsSection::FpABIKind::XX;
4689 setFeatureBits(Mips::FeatureFPXX, "fpxx");
4690 clearFeatureBits(Mips::FeatureFP64Bit, "fp64");
46824691 return true;
46834692 }
46844693
46984707 }
46994708
47004709 FpABI = MipsABIFlagsSection::FpABIKind::S32;
4701 } else
4710 clearFeatureBits(Mips::FeatureFPXX, "fpxx");
4711 clearFeatureBits(Mips::FeatureFP64Bit, "fp64");
4712 } else {
47024713 FpABI = MipsABIFlagsSection::FpABIKind::S64;
4714 clearFeatureBits(Mips::FeatureFPXX, "fpxx");
4715 setFeatureBits(Mips::FeatureFP64Bit, "fp64");
4716 }
47034717
47044718 return true;
47054719 }
9292 const MCSymbol &Sym, bool IsReg) {
9393 }
9494
95 void
96 MipsTargetStreamer::emitDirectiveModuleFP(MipsABIFlagsSection::FpABIKind Value,
97 bool Is32BitABI) {
98 ABIFlagsSection.setFpABI(Value, Is32BitABI);
99 }
100
101 void MipsTargetStreamer::emitDirectiveModuleFP() {
102 emitDirectiveModuleFP(ABIFlagsSection.getFpABI(), ABIFlagsSection.Is32BitABI);
103 }
95 void MipsTargetStreamer::emitDirectiveModuleFP() {}
10496
10597 void MipsTargetStreamer::emitDirectiveModuleOddSPReg() {
10698 if (!ABIFlagsSection.OddSPReg && !ABIFlagsSection.Is32BitABI)
378370 forbidModuleDirective();
379371 }
380372
381 void MipsTargetAsmStreamer::emitDirectiveModuleFP(
382 MipsABIFlagsSection::FpABIKind Value, bool Is32BitABI) {
383 MipsTargetStreamer::emitDirectiveModuleFP(Value, Is32BitABI);
384
373 void MipsTargetAsmStreamer::emitDirectiveModuleFP() {
385374 OS << "\t.module\tfp=";
386 OS << ABIFlagsSection.getFpABIString(Value) << "\n";
375 OS << ABIFlagsSection.getFpABIString(ABIFlagsSection.getFpABI()) << "\n";
387376 }
388377
389378 void MipsTargetAsmStreamer::emitDirectiveSetFp(
7979 virtual void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
8080 const MCSymbol &Sym, bool IsReg);
8181
82 /// Emit a '.module fp=value' directive using the given values.
83 /// Updates the .MIPS.abiflags section
84 virtual void emitDirectiveModuleFP(MipsABIFlagsSection::FpABIKind Value,
85 bool Is32BitABI);
86 /// Emit a '.module fp=value' directive using the current values of the
87 /// .MIPS.abiflags section.
88 void emitDirectiveModuleFP();
89
82 // FP abiflags directives
83 virtual void emitDirectiveModuleFP();
9084 virtual void emitDirectiveModuleOddSPReg();
9185 virtual void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value);
86
9287 void forbidModuleDirective() { ModuleDirectiveAllowed = false; }
9388 void reallowModuleDirective() { ModuleDirectiveAllowed = true; }
9489 bool isModuleDirectiveAllowed() { return ModuleDirectiveAllowed; }
191186 void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
192187 const MCSymbol &Sym, bool IsReg) override;
193188
194 // ABI Flags
195 void emitDirectiveModuleFP(MipsABIFlagsSection::FpABIKind Value,
196 bool Is32BitABI) override;
189 // FP abiflags directives
190 void emitDirectiveModuleFP() override;
197191 void emitDirectiveModuleOddSPReg() override;
198192 void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value) override;
199193 };