Add support on x86 for having Legalize lower ISD::LOCATION to ISD::DEBUG_LOC
authorDan Gohman <gohman@apple.com>
Mon, 24 Sep 2007 21:54:14 +0000 (21:54 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 24 Sep 2007 21:54:14 +0000 (21:54 +0000)
instead of ISD::LABEL with a manual .debug_line entry when the assembler
supports .file and .loc directives.

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

lib/Target/X86/X86ISelLowering.cpp

index 1e5e478593fb27b412fe5d7d800a4739fc1683ce..5343361a9e125fd9e9017c343c3316f843223474 100644 (file)
@@ -32,6 +32,7 @@
 #include "llvm/CodeGen/SelectionDAG.h"
 #include "llvm/CodeGen/SSARegMap.h"
 #include "llvm/Support/MathExtras.h"
+#include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ParameterAttributes.h"
@@ -229,9 +230,13 @@ X86TargetLowering::X86TargetLowering(TargetMachine &TM)
   setOperationAction(ISD::MEMSET          , MVT::Other, Custom);
   setOperationAction(ISD::MEMCPY          , MVT::Other, Custom);
 
-  // We don't have line number support yet.
+  // Use the default ISD::LOCATION expansion, and tell Legalize it's
+  // ok to use DEBUG_LOC if we have an assembler that supports it.
   setOperationAction(ISD::LOCATION, MVT::Other, Expand);
-  setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand);
+  if (TM.getTargetAsmInfo()->hasDotLocAndDotFile())
+    setOperationAction(ISD::DEBUG_LOC, MVT::Other, Legal);
+  else
+    setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand);
   // FIXME - use subtarget debug flags
   if (!Subtarget->isTargetDarwin() &&
       !Subtarget->isTargetELF() &&