| Index: lib/Target/ARM/ARMAsmPrinter.cpp
|
| ===================================================================
|
| --- lib/Target/ARM/ARMAsmPrinter.cpp (revision 115580)
|
| +++ lib/Target/ARM/ARMAsmPrinter.cpp (working copy)
|
| @@ -107,6 +107,12 @@
|
| void EmitStartOfAsmFile(Module &M);
|
| void EmitEndOfAsmFile(Module &M);
|
|
|
| + private:
|
| + // Two helpers for EmitStartOfAsmFile() and EmitEndOfAsmFile()
|
| + void emitAsmAttributes(Module &M);
|
| + void emitELFAttributes(Module &M);
|
| + public:
|
| +
|
| void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
|
|
|
| MachineLocation getDebugValueLocation(const MachineInstr *MI) const {
|
| @@ -422,45 +428,8 @@
|
|
|
| // Emit ARM Build Attributes
|
| if (Subtarget->isTargetELF()) {
|
| - // CPU Type
|
| - std::string CPUString = Subtarget->getCPUString();
|
| - if (CPUString != "generic")
|
| - OutStreamer.EmitRawText("\t.cpu " + Twine(CPUString));
|
|
|
| - // FIXME: Emit FPU type
|
| - if (Subtarget->hasVFP2())
|
| - OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| - Twine(ARMBuildAttrs::VFP_arch) + ", 2");
|
| -
|
| - // Signal various FP modes.
|
| - if (!UnsafeFPMath) {
|
| - OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| - Twine(ARMBuildAttrs::ABI_FP_denormal) + ", 1");
|
| - OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| - Twine(ARMBuildAttrs::ABI_FP_exceptions) + ", 1");
|
| - }
|
| -
|
| - if (NoInfsFPMath && NoNaNsFPMath)
|
| - OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| - Twine(ARMBuildAttrs::ABI_FP_number_model)+ ", 1");
|
| - else
|
| - OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| - Twine(ARMBuildAttrs::ABI_FP_number_model)+ ", 3");
|
| -
|
| - // 8-bytes alignment stuff.
|
| - OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| - Twine(ARMBuildAttrs::ABI_align8_needed) + ", 1");
|
| - OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| - Twine(ARMBuildAttrs::ABI_align8_preserved) + ", 1");
|
| -
|
| - // Hard float. Use both S and D registers and conform to AAPCS-VFP.
|
| - if (Subtarget->isAAPCS_ABI() && FloatABIType == FloatABI::Hard) {
|
| - OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| - Twine(ARMBuildAttrs::ABI_HardFP_use) + ", 3");
|
| - OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| - Twine(ARMBuildAttrs::ABI_VFP_args) + ", 1");
|
| - }
|
| - // FIXME: Should we signal R9 usage?
|
| + emitAsmAttributes(M);
|
| }
|
| }
|
|
|
| @@ -533,8 +502,67 @@
|
| }
|
| }
|
|
|
| +
|
| //===----------------------------------------------------------------------===//
|
| +// Helper routines for EmitStartOfAsmFile() and EmitEndOfAsmFile()
|
| +// FIXME:
|
| +// The following seem like one-off assembler flags, but they actually need
|
| +// to appear in the .ARM.attributes section in ELF. This is the reason why
|
| +// having a common interface to emit these for both the MC/.s and
|
| +// MC/ELF/obj emission is complicated.
|
| +// Instead of subclassing the MCELFStreamer, we do the work here.
|
|
|
| +void ARMAsmPrinter::emitAsmAttributes(Module &M) {
|
| + if (!OutStreamer.hasRawTextSupport())
|
| + return;
|
| +
|
| + // CPU Type
|
| + std::string CPUString = Subtarget->getCPUString();
|
| + if (CPUString != "generic")
|
| + OutStreamer.EmitRawText("\t.cpu " + Twine(CPUString));
|
| +
|
| + // FIXME: Emit FPU type
|
| + if (Subtarget->hasVFP2())
|
| + OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| + Twine(ARMBuildAttrs::VFP_arch) + ", 2");
|
| +
|
| + // Signal various FP modes.
|
| + if (!UnsafeFPMath) {
|
| + OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| + Twine(ARMBuildAttrs::ABI_FP_denormal) + ", 1");
|
| + OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| + Twine(ARMBuildAttrs::ABI_FP_exceptions) + ", 1");
|
| + }
|
| +
|
| + if (NoInfsFPMath && NoNaNsFPMath)
|
| + OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| + Twine(ARMBuildAttrs::ABI_FP_number_model)+ ", 1");
|
| + else
|
| + OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| + Twine(ARMBuildAttrs::ABI_FP_number_model)+ ", 3");
|
| +
|
| + // 8-bytes alignment stuff.
|
| + OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| + Twine(ARMBuildAttrs::ABI_align8_needed) + ", 1");
|
| + OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| + Twine(ARMBuildAttrs::ABI_align8_preserved) + ", 1");
|
| +
|
| + // Hard float. Use both S and D registers and conform to AAPCS-VFP.
|
| + if (Subtarget->isAAPCS_ABI() && FloatABIType == FloatABI::Hard) {
|
| + OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| + Twine(ARMBuildAttrs::ABI_HardFP_use) + ", 3");
|
| + OutStreamer.EmitRawText("\t.eabi_attribute " +
|
| + Twine(ARMBuildAttrs::ABI_VFP_args) + ", 1");
|
| + }
|
| + // FIXME: Should we signal R9 usage?
|
| +}
|
| +
|
| +void ARMAsmPrinter::emitELFAttributes(Module &M) {
|
| + // FIXME:
|
| +}
|
| +
|
| +//===----------------------------------------------------------------------===//
|
| +
|
| static MCSymbol *getPICLabel(const char *Prefix, unsigned FunctionNumber,
|
| unsigned LabelId, MCContext &Ctx) {
|
|
|
|
|