llvm.org GIT mirror llvm / e9525d8
Mark jump tables in code sections with DataRegion directives. Even out-of-line jump tables can be in the code section, so mark them as data-regions for those targets which support the directives. rdar://12362871&12362974 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164571 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Grosbach 8 years ago
3 changed file(s) with 24 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
10811081
10821082 EmitAlignment(Log2_32(MJTI->getEntryAlignment(*TM.getTargetData())));
10831083
1084 // Jump tables in code sections are marked with a data_region directive
1085 // where that's supported.
1086 if (!JTInDiffSection)
1087 OutStreamer.EmitDataRegion(MCDR_DataRegionJT32);
1088
10841089 for (unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) {
10851090 const std::vector &JTBBs = JT[JTI].MBBs;
10861091
11211126 for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii)
11221127 EmitJumpTableEntry(MJTI, JTBBs[ii], JTI);
11231128 }
1129 if (!JTInDiffSection)
1130 OutStreamer.EmitDataRegion(MCDR_DataRegionEnd);
11241131 }
11251132
11261133 /// EmitJumpTableEntry - Emit a jump table entry for the specified MBB to the
3333 clEnumValN(Intel, "intel", "Emit Intel-style assembly"),
3434 clEnumValEnd));
3535
36 static cl::opt
37 MarkedJTDataRegions("mark-data-regions", cl::init(false),
38 cl::desc("Mark code section jump table data regions."),
39 cl::Hidden);
3640
3741 void X86MCAsmInfoDarwin::anchor() { }
3842
5862
5963 SupportsDebugInformation = true;
6064 DwarfUsesInlineInfoSection = true;
65 UseDataRegionDirectives = MarkedJTDataRegions;
6166
6267 // Exceptions handling
6368 ExceptionsType = ExceptionHandling::DwarfCFI;
0 ; RUN: llc < %s -relocation-model=pic -mtriple=i386-linux-gnu -asm-verbose=false \
11 ; RUN: | FileCheck %s --check-prefix=CHECK-LINUX
2 ; RUN: llc < %s -relocation-model=pic -mark-data-regions -mtriple=i686-apple-darwin -asm-verbose=false \
3 ; RUN: | FileCheck %s --check-prefix=CHECK-DATA
24 ; RUN: llc < %s -relocation-model=pic -mtriple=i686-apple-darwin -asm-verbose=false \
35 ; RUN: | FileCheck %s
46 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | not grep 'lJTI'
1517 ; CHECK: Ltmp0 = LJTI0_0-L0$pb
1618 ; CHECK-NEXT: addl Ltmp0(%eax,%ecx,4)
1719 ; CHECK-NEXT: jmpl *%eax
20
21 ;; When data-in-code markers are enabled, we should see them around the jump
22 ;; table.
23 ; CHECK-DATA: .data_region jt32
24 ; CHECK-DATA: LJTI0_0
25 ; CHECK-DATA: .end_data_region
26
27 ;; When they're not enabled, make sure we don't see them at all.
28 ; CHECK-NOT: .data_region
29 ; CHECK-LINUX-NOT: .data_region
1830 %Y_addr = alloca i32 ; [#uses=2]
1931 %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
2032 store i32 %Y, i32* %Y_addr