[llvm-commits] [llvm] r103985 - in /llvm/trunk: include/llvm/CodeGen/TargetLoweringObjectFileImpl.h include/llvm/MC/MCSectionMachO.h lib/CodeGen/TargetLoweringObjectFileImpl.cpp lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/directive_tbss.s test/MC/AsmParser/directive_tdata.s test/MC/AsmParser/directive_thread_init_func.s test/MC/AsmParser/directive_tlv.s

Eric Christopher echristo at apple.com
Mon May 17 15:53:55 PDT 2010


Author: echristo
Date: Mon May 17 17:53:55 2010
New Revision: 103985

URL: http://llvm.org/viewvc/llvm-project?rev=103985&view=rev
Log:
More data/parsing support for tls directives.  Add a few more testcases
and cleanup comments as well.

Added:
    llvm/trunk/test/MC/AsmParser/directive_tdata.s
    llvm/trunk/test/MC/AsmParser/directive_thread_init_func.s
    llvm/trunk/test/MC/AsmParser/directive_tlv.s
Modified:
    llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
    llvm/trunk/include/llvm/MC/MCSectionMachO.h
    llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    llvm/trunk/lib/MC/MCParser/AsmParser.cpp
    llvm/trunk/test/MC/AsmParser/directive_tbss.s

Modified: llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h?rev=103985&r1=103984&r2=103985&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h (original)
+++ llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h Mon May 17 17:53:55 2010
@@ -84,19 +84,23 @@
 
 
 class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
-  /// TLSDataSection - Section directive for Thread Local data.
+  /// TLSDataSection - Section for thread local data.
   ///
   const MCSection *TLSDataSection;        // Defaults to ".tdata".
 
-  /// TLSBSSSection - Section directive for Thread Local uninitialized data.
+  /// TLSBSSSection - Section for thread local uninitialized data.
   ///
   const MCSection *TLSBSSSection;         // Defaults to ".tbss".
   
-  /// TLSTLVSection - Section directive for Thread Local structure infomation.
+  /// TLSTLVSection - Section for thread local structure infomation.
   /// Contains the source code name of the variable, visibility and a pointer
   /// to the initial value (.tdata or .tbss).
   const MCSection *TLSTLVSection;         // Defaults to ".tlv".
   
+  /// TLSThreadInitSection - Section for thread local data initialization
+  /// functions.
+  const MCSection *TLSThreadInitSection;  // Defaults to ".thread_init_func".
+  
   const MCSection *CStringSection;
   const MCSection *UStringSection;
   const MCSection *TextCoalSection;

Modified: llvm/trunk/include/llvm/MC/MCSectionMachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionMachO.h?rev=103985&r1=103984&r2=103985&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionMachO.h (original)
+++ llvm/trunk/include/llvm/MC/MCSectionMachO.h Mon May 17 17:53:55 2010
@@ -98,7 +98,7 @@
     S_THREAD_LOCAL_VARIABLE_POINTERS = 0x14U,
     /// S_THREAD_LOCAL_INIT_FUNCTION_POINTERS - Section with thread local
     /// variable initialization pointers to functions.
-    S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x15,
+    S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x15U,
 
     LAST_KNOWN_SECTION_TYPE = S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
     

Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=103985&r1=103984&r2=103985&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Mon May 17 17:53:55 2010
@@ -475,6 +475,12 @@
     = getContext().getMachOSection("__DATA", "__thread_vars",
                                    MCSectionMachO::S_THREAD_LOCAL_VARIABLES,
                                    SectionKind::getDataRel());
+                                   
+  TLSThreadInitSection
+    = getContext().getMachOSection("__DATA", "__thread_init",
+                          MCSectionMachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
+                          SectionKind::getDataRel());
+                                   
   CStringSection // .cstring
     = getContext().getMachOSection("__TEXT", "__cstring", 
                                    MCSectionMachO::S_CSTRING_LITERALS,

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=103985&r1=103984&r2=103985&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Mon May 17 17:53:55 2010
@@ -623,6 +623,16 @@
       return ParseDirectiveSectionSwitch("__OBJC", "__selector_strs",
                                          MCSectionMachO::S_CSTRING_LITERALS);
     
+    if (IDVal == ".tdata")
+      return ParseDirectiveSectionSwitch("__DATA", "__thread_data",
+                                        MCSectionMachO::S_THREAD_LOCAL_REGULAR);
+    if (IDVal == ".tlv")
+      return ParseDirectiveSectionSwitch("__DATA", "__thread_vars",
+                                      MCSectionMachO::S_THREAD_LOCAL_VARIABLES);
+    if (IDVal == ".thread_init_func")
+      return ParseDirectiveSectionSwitch("__DATA", "__thread_init",
+                        MCSectionMachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS);
+    
     // Assembler features
     if (IDVal == ".set")
       return ParseDirectiveSet();

Modified: llvm/trunk/test/MC/AsmParser/directive_tbss.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_tbss.s?rev=103985&r1=103984&r2=103985&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_tbss.s (original)
+++ llvm/trunk/test/MC/AsmParser/directive_tbss.s Mon May 17 17:53:55 2010
@@ -1,4 +1,4 @@
-# RUN: llvm-mc -triple i386-unknown-darwin %s | FileCheck %s
+# RUN: llvm-mc -triple x86_64-unknown-darwin %s | FileCheck %s
 
 # CHECK: .tbss _a$tlv$init, 4
 # CHECK: .tbss _b$tlv$init, 4, 3

Added: llvm/trunk/test/MC/AsmParser/directive_tdata.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_tdata.s?rev=103985&view=auto
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_tdata.s (added)
+++ llvm/trunk/test/MC/AsmParser/directive_tdata.s Mon May 17 17:53:55 2010
@@ -0,0 +1,9 @@
+# RUN: llvm-mc -triple x86_64-unknown-darwin %s | FileCheck %s
+
+# CHECK:	__DATA,__thread_data,thread_local_regular
+# CHECK:	_a$tlv$init:
+# CHECK:	.quad 4
+
+	.tdata
+_a$tlv$init:
+	.quad 4

Added: llvm/trunk/test/MC/AsmParser/directive_thread_init_func.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_thread_init_func.s?rev=103985&view=auto
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_thread_init_func.s (added)
+++ llvm/trunk/test/MC/AsmParser/directive_thread_init_func.s Mon May 17 17:53:55 2010
@@ -0,0 +1,7 @@
+# RUN: llvm-mc -triple x86_64-unknown-darwin %s | FileCheck %s
+
+# CHECK: __DATA,__thread_init,thread_local_init_function_pointers
+# CHECK: .quad 0
+
+.thread_init_func
+	.quad 0

Added: llvm/trunk/test/MC/AsmParser/directive_tlv.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_tlv.s?rev=103985&view=auto
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_tlv.s (added)
+++ llvm/trunk/test/MC/AsmParser/directive_tlv.s Mon May 17 17:53:55 2010
@@ -0,0 +1,13 @@
+# RUN: llvm-mc -triple x86_64-unknown-darwin %s | FileCheck %s
+
+# CHECK:	__DATA,__thread_vars,thread_local_variables
+# CHECK:	.globl _a
+# CHECK:	_a:
+# CHECK:	.quad 0
+
+	.tlv
+.globl _a
+_a:
+	.quad 0
+	.quad 0
+	.quad 0





More information about the llvm-commits mailing list