[llvm-commits] [llvm] r127028 - in /llvm/trunk: lib/MC/ test/CodeGen/ARM/ test/CodeGen/Blackfin/ test/CodeGen/CellSPU/ test/CodeGen/Mips/ test/CodeGen/PowerPC/ test/CodeGen/X86/ test/CodeGen/XCore/ test/MC/ELF/

Joerg Sonnenberger joerg at bec.de
Fri Mar 4 12:03:15 PST 2011


Author: joerg
Date: Fri Mar  4 14:03:14 2011
New Revision: 127028

URL: http://llvm.org/viewvc/llvm-project?rev=127028&view=rev
Log:
Be nice to Xcore and the XMOS assembler and avoid quoting section names
that contain only letters, digits and the characters "_" and ".".

Modified:
    llvm/trunk/lib/MC/MCSectionELF.cpp
    llvm/trunk/test/CodeGen/ARM/ctors_dtors.ll
    llvm/trunk/test/CodeGen/ARM/section.ll
    llvm/trunk/test/CodeGen/Blackfin/jumptable.ll
    llvm/trunk/test/CodeGen/CellSPU/bss.ll
    llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll
    llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll
    llvm/trunk/test/CodeGen/PowerPC/sections.ll
    llvm/trunk/test/CodeGen/X86/attribute-sections.ll
    llvm/trunk/test/CodeGen/X86/bss_pagealigned.ll
    llvm/trunk/test/CodeGen/X86/global-sections-tls.ll
    llvm/trunk/test/CodeGen/X86/global-sections.ll
    llvm/trunk/test/CodeGen/X86/pic_jumptable.ll
    llvm/trunk/test/CodeGen/XCore/constants.ll
    llvm/trunk/test/CodeGen/XCore/globals.ll
    llvm/trunk/test/CodeGen/XCore/tls.ll
    llvm/trunk/test/MC/ELF/section-quoting.s

Modified: llvm/trunk/lib/MC/MCSectionELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionELF.cpp?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSectionELF.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionELF.cpp Fri Mar  4 14:03:14 2011
@@ -40,20 +40,26 @@
   }
 
   StringRef name = getSectionName();
-  OS << "\t.section\t\"";
-  for (const char *b = name.begin(), *e = name.end(); b < e; ++b) {
-    if (*b == '"') // Unquoted "
-      OS << "\\\"";
-    else if (*b != '\\') // Neither " or backslash
-      OS << *b;
-    else if (b + 1 == e) // Trailing backslash
-      OS << "\\\\";
-    else {
-      OS << b[0] << b[1]; // Quoted character
-      ++b;
+  if (name.find_first_not_of("0123456789_."
+                             "abcdefghijklmnopqrstuvwxyz"
+                             "ABCDEFGHIJKLMNOPQRSTUVWXYZ") == name.npos) {
+    OS << "\t.section\t" << name;
+  } else {
+    OS << "\t.section\t\"";
+    for (const char *b = name.begin(), *e = name.end(); b < e; ++b) {
+      if (*b == '"') // Unquoted "
+        OS << "\\\"";
+      else if (*b != '\\') // Neither " or backslash
+        OS << *b;
+      else if (b + 1 == e) // Trailing backslash
+        OS << "\\\\";
+      else {
+        OS << b[0] << b[1]; // Quoted character
+        ++b;
+      }
     }
+    OS << '"';
   }
-  OS << '"';
 
   // Handle the weird solaris syntax if desired.
   if (MAI.usesSunStyleELFSectionSwitchSyntax() && 

Modified: llvm/trunk/test/CodeGen/ARM/ctors_dtors.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ctors_dtors.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/ctors_dtors.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/ctors_dtors.ll Fri Mar  4 14:03:14 2011
@@ -5,11 +5,11 @@
 ; DARWIN: .section	__DATA,__mod_init_func,mod_init_funcs
 ; DARWIN: .section	__DATA,__mod_term_func,mod_term_funcs
 
-; ELF: .section ".ctors","aw",%progbits
-; ELF: .section ".dtors","aw",%progbits
+; ELF: .section .ctors,"aw",%progbits
+; ELF: .section .dtors,"aw",%progbits
 
-; GNUEABI: .section ".init_array","aw",%init_array
-; GNUEABI: .section ".fini_array","aw",%fini_array
+; GNUEABI: .section .init_array,"aw",%init_array
+; GNUEABI: .section .fini_array,"aw",%fini_array
 
 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @__mf_init } ]                ; <[1 x { i32, void ()* }]*> [#uses=0]
 @llvm.global_dtors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @__mf_fini } ]                ; <[1 x { i32, void ()* }]*> [#uses=0]

Modified: llvm/trunk/test/CodeGen/ARM/section.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/section.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/section.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/section.ll Fri Mar  4 14:03:14 2011
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -mtriple=arm-linux | \
 ; RUN:   grep {__DTOR_END__:}
 ; RUN: llc < %s -mtriple=arm-linux | \
-; RUN:   grep {\\.section."\\.dtors","aw",.progbits}
+; RUN:   grep {\\.section.\\.dtors,"aw",.progbits}
 
 @__DTOR_END__ = internal global [1 x i32] zeroinitializer, section ".dtors"       ; <[1 x i32]*> [#uses=0]
 

Modified: llvm/trunk/test/CodeGen/Blackfin/jumptable.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Blackfin/jumptable.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Blackfin/jumptable.ll (original)
+++ llvm/trunk/test/CodeGen/Blackfin/jumptable.ll Fri Mar  4 14:03:14 2011
@@ -1,6 +1,6 @@
 ; RUN: llc < %s -march=bfin -verify-machineinstrs | FileCheck %s
 
-; CHECK: .section ".rodata"
+; CHECK: .section .rodata
 ; CHECK: JTI0_0:
 ; CHECK: .long .BB0_1
 

Modified: llvm/trunk/test/CodeGen/CellSPU/bss.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CellSPU/bss.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/CellSPU/bss.ll (original)
+++ llvm/trunk/test/CodeGen/CellSPU/bss.ll Fri Mar  4 14:03:14 2011
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -march=cellspu | FileCheck %s
 
 @bssVar = global i32 zeroinitializer
-; CHECK: .section ".bss"
+; CHECK: .section .bss
 ; CHECK-NEXT: .globl
 
 @localVar= internal global i32 zeroinitializer

Modified: llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/2008-07-15-InternalConstant.ll Fri Mar  4 14:03:14 2011
@@ -1,6 +1,6 @@
 ; RUN: llc < %s -march=mips -o %t
-; RUN: grep {rodata.str1.4","aMS", at progbits}  %t | count 1
-; RUN: grep {r.data",}  %t | count 1
+; RUN: grep {rodata.str1.4,"aMS", at progbits}  %t | count 1
+; RUN: grep {r.data,}  %t | count 1
 ; RUN: grep {\%hi} %t | count 2
 ; RUN: grep {\%lo} %t | count 2
 ; RUN: not grep {gp_rel} %t

Modified: llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/2008-07-22-Cstpool.ll Fri Mar  4 14:03:14 2011
@@ -1,6 +1,6 @@
 ; RUN: llc < %s -march=mips -o %t
 ; RUN: grep {CPI\[01\]_\[01\]:} %t | count 2
-; RUN: grep {".rodata.cst4","aM", at progbits} %t | count 1
+; RUN: grep {.rodata.cst4,"aM", at progbits} %t | count 1
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"
 target triple = "mipsallegrexel-unknown-psp-elf"
 

Modified: llvm/trunk/test/CodeGen/PowerPC/sections.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/sections.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/sections.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/sections.ll Fri Mar  4 14:03:14 2011
@@ -3,6 +3,6 @@
 
 @A = global i32 0
 
-; CHECK:  .section  ".bss","aw", at nobits
+; CHECK:  .section  .bss,"aw", at nobits
 ; CHECK:  .globl A
 

Modified: llvm/trunk/test/CodeGen/X86/attribute-sections.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/attribute-sections.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/attribute-sections.ll (original)
+++ llvm/trunk/test/CodeGen/X86/attribute-sections.ll Fri Mar  4 14:03:14 2011
@@ -3,16 +3,16 @@
 declare i32 @foo()
 @G0 = global i32 ()* @foo, section ".init_array"
 
-; LINUX:  .section  ".init_array","aw"
+; LINUX:  .section  .init_array,"aw"
 ; LINUX:  .globl G0
 
 @G1 = global i32 ()* @foo, section ".fini_array"
 
-; LINUX:  .section  ".fini_array","aw"
+; LINUX:  .section  .fini_array,"aw"
 ; LINUX:  .globl G1
 
 @G2 = global i32 ()* @foo, section ".preinit_array"
 
-; LINUX:  .section ".preinit_array","aw"
+; LINUX:  .section .preinit_array,"aw"
 ; LINUX:  .globl G2
 

Modified: llvm/trunk/test/CodeGen/X86/bss_pagealigned.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/bss_pagealigned.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/bss_pagealigned.ll (original)
+++ llvm/trunk/test/CodeGen/X86/bss_pagealigned.ll Fri Mar  4 14:03:14 2011
@@ -14,7 +14,7 @@
   ret void
 }
 @bm_pte = internal global [512 x %struct.kmem_cache_order_objects] zeroinitializer, section ".bss.page_aligned", align 4096
-; CHECK: .section        ".bss.page_aligned","aw", at nobits
+; CHECK: .section        .bss.page_aligned,"aw", at nobits
 ; CHECK-NEXT: .align  4096
 ; CHECK-NEXT: bm_pte:
 ; CHECK-NEXT: .zero   4096

Modified: llvm/trunk/test/CodeGen/X86/global-sections-tls.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections-tls.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/global-sections-tls.ll (original)
+++ llvm/trunk/test/CodeGen/X86/global-sections-tls.ll Fri Mar  4 14:03:14 2011
@@ -2,7 +2,7 @@
 
 ; PR4639
 @G1 = internal thread_local global i32 0		; <i32*> [#uses=1]
-; LINUX: .section	".tbss","awT", at nobits
+; LINUX: .section	.tbss,"awT", at nobits
 ; LINUX: G1:
 
 

Modified: llvm/trunk/test/CodeGen/X86/global-sections.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/global-sections.ll (original)
+++ llvm/trunk/test/CodeGen/X86/global-sections.ll Fri Mar  4 14:03:14 2011
@@ -33,10 +33,10 @@
 ; DARWIN: _G3:
 ; DARWIN:     .long _G1
 
-; LINUX:   .section        ".rodata","a", at progbits
+; LINUX:   .section        .rodata,"a", at progbits
 ; LINUX:   .globl  G3
 
-; LINUX-SECTIONS: .section        ".rodata.G3","a", at progbits
+; LINUX-SECTIONS: .section        .rodata.G3,"a", at progbits
 ; LINUX-SECTIONS: .globl  G3
 
 
@@ -66,7 +66,7 @@
 @"foo bar" = linkonce global i32 42
 
 ; LINUX: .type	foo_20_bar, at object
-; LINUX: .section ".data.foo_20_bar","aGw", at progbits,foo_20_bar,comdat
+; LINUX: .section .data.foo_20_bar,"aGw", at progbits,foo_20_bar,comdat
 ; LINUX: .weak	foo_20_bar
 ; LINUX: foo_20_bar:
 
@@ -79,7 +79,7 @@
 @G6 = weak_odr unnamed_addr constant [1 x i8] c"\01"
 
 ; LINUX:   .type	G6, at object
-; LINUX:   .section	".rodata.G6","aG", at progbits,G6,comdat
+; LINUX:   .section	.rodata.G6,"aG", at progbits,G6,comdat
 ; LINUX:   .weak	G6
 ; LINUX: G6:
 ; LINUX:   .byte	1
@@ -99,12 +99,12 @@
 ; DARWIN: _G7:
 ; DARWIN:	.asciz	"abcdefghi"
 
-; LINUX:	.section	".rodata.str1.1","aMS", at progbits,1
+; LINUX:	.section	.rodata.str1.1,"aMS", at progbits,1
 ; LINUX:	.globl G7
 ; LINUX: G7:
 ; LINUX:	.asciz	"abcdefghi"
 
-; LINUX-SECTIONS: .section        ".rodata.G7","aMS", at progbits,1
+; LINUX-SECTIONS: .section        .rodata.G7,"aMS", at progbits,1
 ; LINUX-SECTIONS:	.globl G7
 
 
@@ -114,7 +114,7 @@
 ; DARWIN:	.globl _G8
 ; DARWIN: _G8:
 
-; LINUX:	.section	".rodata.str2.2","aMS", at progbits,2
+; LINUX:	.section	.rodata.str2.2,"aMS", at progbits,2
 ; LINUX:	.globl G8
 ; LINUX:G8:
 
@@ -123,7 +123,7 @@
 ; DARWIN:	.globl _G9
 ; DARWIN: _G9:
 
-; LINUX:	.section	".rodata.str4.4","aMS", at progbits,4
+; LINUX:	.section	.rodata.str4.4,"aMS", at progbits,4
 ; LINUX:	.globl G9
 ; LINUX:G9
 

Modified: llvm/trunk/test/CodeGen/X86/pic_jumptable.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pic_jumptable.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pic_jumptable.ll (original)
+++ llvm/trunk/test/CodeGen/X86/pic_jumptable.ll Fri Mar  4 14:03:14 2011
@@ -1,4 +1,4 @@
-; RUN: llc < %s -relocation-model=pic -mtriple=i386-linux-gnu -asm-verbose=false | grep -F .text._Z3fooILi1EEvi","axG", at progbits,_Z3fooILi1EEvi,comdat
+; RUN: llc < %s -relocation-model=pic -mtriple=i386-linux-gnu -asm-verbose=false | grep -F .text._Z3fooILi1EEvi,"axG", at progbits,_Z3fooILi1EEvi,comdat
 ; RUN: llc < %s -relocation-model=pic -mtriple=i686-apple-darwin -asm-verbose=false | FileCheck %s
 ; RUN: llc < %s                       -mtriple=x86_64-apple-darwin | not grep 'lJTI'
 ; rdar://6971437

Modified: llvm/trunk/test/CodeGen/XCore/constants.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/constants.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/XCore/constants.ll (original)
+++ llvm/trunk/test/CodeGen/XCore/constants.ll Fri Mar  4 14:03:14 2011
@@ -1,6 +1,6 @@
 ; RUN: llc < %s -march=xcore -mcpu=xs1b-generic | FileCheck %s
 
-; CHECK: .section ".cp.rodata.cst4","aMc", at progbits,4
+; CHECK: .section .cp.rodata.cst4,"aMc", at progbits,4
 ; CHECK: .LCPI0_0:
 ; CHECK: .long 12345678
 ; CHECK: f:

Modified: llvm/trunk/test/CodeGen/XCore/globals.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/globals.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/XCore/globals.ll (original)
+++ llvm/trunk/test/CodeGen/XCore/globals.ll Fri Mar  4 14:03:14 2011
@@ -60,33 +60,33 @@
 }
 
 @G1 = global i32 4712
-; CHECK: .section ".dp.data","awd", at progbits
+; CHECK: .section .dp.data,"awd", at progbits
 ; CHECK: G1:
 
 @G2 = global i32 0
-; CHECK: .section ".dp.bss","awd", at nobits
+; CHECK: .section .dp.bss,"awd", at nobits
 ; CHECK: G2:
 
 @G3 = unnamed_addr constant i32 9401
-; CHECK: .section ".cp.rodata.cst4","aMc", at progbits,4
+; CHECK: .section .cp.rodata.cst4,"aMc", at progbits,4
 ; CHECK: G3:
 
 @G4 = global i32* @G1
-; CHECK: .section ".dp.data","awd", at progbits
+; CHECK: .section .dp.data,"awd", at progbits
 ; CHECK: G4:
 
 @G5 = unnamed_addr constant i32* @G1
-; CHECK: .section ".cp.rodata","ac", at progbits
+; CHECK: .section .cp.rodata,"ac", at progbits
 ; CHECK: G5:
 
 @G6 = global i32* @G8
-; CHECK: .section ".dp.data","awd", at progbits
+; CHECK: .section .dp.data,"awd", at progbits
 ; CHECK: G6:
 
 @G7 = unnamed_addr constant i32* @G8
-; CHECK: .section ".cp.rodata","ac", at progbits
+; CHECK: .section .cp.rodata,"ac", at progbits
 ; CHECK: G7:
 
 @G8 = internal global i32 9312
-; CHECK: .section ".dp.data","awd", at progbits
+; CHECK: .section .dp.data,"awd", at progbits
 ; CHECK: G8:

Modified: llvm/trunk/test/CodeGen/XCore/tls.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/tls.ll?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/XCore/tls.ll (original)
+++ llvm/trunk/test/CodeGen/XCore/tls.ll Fri Mar  4 14:03:14 2011
@@ -8,7 +8,7 @@
 }
 
 @G = thread_local global i32 15
-; CHECK: .section ".dp.data","awd", at progbits
+; CHECK: .section .dp.data,"awd", at progbits
 ; CHECK: G:
 ; CHECK: .long 15
 ; CHECK: .long 15

Modified: llvm/trunk/test/MC/ELF/section-quoting.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/section-quoting.s?rev=127028&r1=127027&r2=127028&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/section-quoting.s (original)
+++ llvm/trunk/test/MC/ELF/section-quoting.s Fri Mar  4 14:03:14 2011
@@ -6,5 +6,5 @@
 .section "foo bar"
 
 // CHECK: .section "bar-\"foo\""
-// CHECK: .section "foo"
+// CHECK: .section foo
 // CHECK: .section "foo bar"





More information about the llvm-commits mailing list