1 //===-- TargetAsmInfo.cpp - Asm Info ---------------------------------------==//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by James M. Laskey and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines target asm properties related what form asm statements
13 //===----------------------------------------------------------------------===//
15 #include "llvm/Target/TargetAsmInfo.h"
21 TargetAsmInfo::TargetAsmInfo() :
25 TLSDataSection("\t.section .tdata,\"awT\",@progbits"),
26 TLSBSSSection("\t.section .tbss,\"awT\",@nobits"),
35 PrivateGlobalPrefix("."),
36 JumpTableSpecialLabelPrefix(0),
37 GlobalVarAddrPrefix(""),
38 GlobalVarAddrSuffix(""),
39 FunctionAddrPrefix(""),
40 FunctionAddrSuffix(""),
41 InlineAsmStart("#APP"),
42 InlineAsmEnd("#NO_APP"),
44 ZeroDirective("\t.zero\t"),
45 ZeroDirectiveSuffix(0),
46 AsciiDirective("\t.ascii\t"),
47 AscizDirective("\t.asciz\t"),
48 Data8bitsDirective("\t.byte\t"),
49 Data16bitsDirective("\t.short\t"),
50 Data32bitsDirective("\t.long\t"),
51 Data64bitsDirective("\t.quad\t"),
52 AlignDirective("\t.align\t"),
53 AlignmentIsInBytes(true),
54 SwitchToSectionDirective("\t.section\t"),
55 TextSectionStartSuffix(""),
56 DataSectionStartSuffix(""),
57 SectionEndDirectiveSuffix(0),
58 ConstantPoolSection("\t.section .rodata\n"),
59 JumpTableDataSection("\t.section .rodata\n"),
60 JumpTableDirective(0),
62 StaticCtorsSection("\t.section .ctors,\"aw\",@progbits"),
63 StaticDtorsSection("\t.section .dtors,\"aw\",@progbits"),
64 FourByteConstantSection(0),
65 EightByteConstantSection(0),
66 SixteenByteConstantSection(0),
71 COMMDirective("\t.comm\t"),
72 COMMDirectiveTakesAlignment(true),
73 HasDotTypeDotSizeDirective(true),
76 HiddenDirective("\t.hidden\t"),
77 ProtectedDirective("\t.protected\t"),
78 AbsoluteSectionOffsets(false),
82 SupportsExceptionHandling(false),
83 DwarfRequiresFrameSection(true),
84 DwarfSectionOffsetDirective(0),
85 DwarfAbbrevSection(".debug_abbrev"),
86 DwarfInfoSection(".debug_info"),
87 DwarfLineSection(".debug_line"),
88 DwarfFrameSection(".debug_frame"),
89 DwarfPubNamesSection(".debug_pubnames"),
90 DwarfPubTypesSection(".debug_pubtypes"),
91 DwarfStrSection(".debug_str"),
92 DwarfLocSection(".debug_loc"),
93 DwarfARangesSection(".debug_aranges"),
94 DwarfRangesSection(".debug_ranges"),
95 DwarfMacInfoSection(".debug_macinfo"),
96 DwarfEHFrameSection(".eh_frame"),
97 DwarfExceptionSection(".gcc_except_table"),
101 TargetAsmInfo::~TargetAsmInfo() {
104 /// Measure the specified inline asm to determine an approximation of its
106 /// Comments (which run till the next SeparatorChar or newline) do not
107 /// count as an instruction.
108 /// Any other non-whitespace text is considered an instruction, with
109 /// multiple instructions separated by SeparatorChar or newlines.
110 /// Variable-length instructions are not handled here; this function
111 /// may be overloaded in the target code to do that.
112 unsigned TargetAsmInfo::getInlineAsmLength(const char *Str) const {
113 // Count the number of instructions in the asm.
114 bool atInsnStart = true;
116 for (; *Str; ++Str) {
117 if (*Str == '\n' || *Str == SeparatorChar)
119 if (atInsnStart && !isspace(*Str)) {
120 Length += MaxInstLength;
123 if (atInsnStart && strncmp(Str, CommentString, strlen(CommentString))==0)