Change getISAEncoding to use the target triple to determine
authorEric Christopher <echristo@gmail.com>
Sat, 21 Mar 2015 03:13:01 +0000 (03:13 +0000)
committerEric Christopher <echristo@gmail.com>
Sat, 21 Mar 2015 03:13:01 +0000 (03:13 +0000)
thumb-ness similar to the rest of the Module level asm printing
infrastructure as debug info finalization happens after the function
may be missing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232875 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/AsmPrinter.h
lib/CodeGen/AsmPrinter/DwarfUnit.cpp
lib/Target/ARM/ARMAsmPrinter.h

index 644d5f4cf05073ce9a53c7591de44169acfde532..d364012acf930ca371e6a153d7a8002d8f13542d 100644 (file)
@@ -422,7 +422,7 @@ public:
   void emitSectionOffset(const MCSymbol *Label) const;
 
   /// Get the value for DW_AT_APPLE_isa. Zero if no isa encoding specified.
-  virtual unsigned getISAEncoding(const Function *) { return 0; }
+  virtual unsigned getISAEncoding() { return 0; }
 
   /// EmitDwarfRegOp - Emit a dwarf register operation.
   virtual void EmitDwarfRegOp(ByteStreamer &BS,
index f1cd94b6e0a5e0c5ee4baf6c41658352d354fad2..f6af73fe20e5502ce8ad2f3c3069bd95585e9433 100644 (file)
@@ -1361,9 +1361,8 @@ void DwarfUnit::applySubprogramAttributes(DISubprogram SP, DIE &SPDie,
   if (SP.isOptimized())
     addFlag(SPDie, dwarf::DW_AT_APPLE_optimized);
 
-  if (unsigned isa = Asm->getISAEncoding(SP.getFunction())) {
+  if (unsigned isa = Asm->getISAEncoding())
     addUInt(SPDie, dwarf::DW_AT_APPLE_isa, dwarf::DW_FORM_flag, isa);
-  }
 
   if (SP.isLValueReference())
     addFlag(SPDie, dwarf::DW_AT_reference);
index 50cb95404119d63c9f45268f9c2eb2ec4339d669..e475ae43a6d3c0a6e47b5c04d0f47dc023feafec 100644 (file)
@@ -103,13 +103,16 @@ private:
                                    const MachineInstr *MI);
 
 public:
-  unsigned getISAEncoding(const Function *F) override {
+  unsigned getISAEncoding() override {
     // ARM/Darwin adds ISA to the DWARF info for each function.
     Triple TT(TM.getTargetTriple());
     if (!TT.isOSBinFormatMachO())
       return 0;
-    const ARMSubtarget &STI = TM.getSubtarget<ARMSubtarget>(*F);
-    return STI.isThumb() ? ARM::DW_ISA_ARM_thumb : ARM::DW_ISA_ARM_arm;
+    bool isThumb = TT.getArch() == Triple::thumb ||
+                   TT.getArch() == Triple::thumbeb ||
+                   TT.getSubArch() == Triple::ARMSubArch_v7m ||
+                   TT.getSubArch() == Triple::ARMSubArch_v6m;
+    return isThumb ? ARM::DW_ISA_ARM_thumb : ARM::DW_ISA_ARM_arm;
   }
 
 private: