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"
19 TargetAsmInfo::TargetAsmInfo() :
23 TLSDataSection("\t.section .tdata,\"awT\",@progbits"),
24 TLSBSSSection("\t.section .tbss,\"awT\",@nobits"),
33 PrivateGlobalPrefix("."),
34 JumpTableSpecialLabelPrefix(0),
35 GlobalVarAddrPrefix(""),
36 GlobalVarAddrSuffix(""),
37 FunctionAddrPrefix(""),
38 FunctionAddrSuffix(""),
39 InlineAsmStart("#APP"),
40 InlineAsmEnd("#NO_APP"),
42 ZeroDirective("\t.zero\t"),
43 ZeroDirectiveSuffix(0),
44 AsciiDirective("\t.ascii\t"),
45 AscizDirective("\t.asciz\t"),
46 Data8bitsDirective("\t.byte\t"),
47 Data16bitsDirective("\t.short\t"),
48 Data32bitsDirective("\t.long\t"),
49 Data64bitsDirective("\t.quad\t"),
50 AlignDirective("\t.align\t"),
51 AlignmentIsInBytes(true),
52 SwitchToSectionDirective("\t.section\t"),
53 TextSectionStartSuffix(""),
54 DataSectionStartSuffix(""),
55 SectionEndDirectiveSuffix(0),
56 ConstantPoolSection("\t.section .rodata\n"),
57 JumpTableDataSection("\t.section .rodata\n"),
58 JumpTableDirective(0),
60 StaticCtorsSection("\t.section .ctors,\"aw\",@progbits"),
61 StaticDtorsSection("\t.section .dtors,\"aw\",@progbits"),
62 FourByteConstantSection(0),
63 EightByteConstantSection(0),
64 SixteenByteConstantSection(0),
69 COMMDirective("\t.comm\t"),
70 COMMDirectiveTakesAlignment(true),
71 HasDotTypeDotSizeDirective(true),
74 HiddenDirective("\t.hidden\t"),
75 AbsoluteSectionOffsets(false),
79 SupportsExceptionHandling(false),
80 DwarfRequiresFrameSection(true),
81 DwarfSectionOffsetDirective(0),
82 DwarfAbbrevSection(".debug_abbrev"),
83 DwarfInfoSection(".debug_info"),
84 DwarfLineSection(".debug_line"),
85 DwarfFrameSection(".debug_frame"),
86 DwarfPubNamesSection(".debug_pubnames"),
87 DwarfPubTypesSection(".debug_pubtypes"),
88 DwarfStrSection(".debug_str"),
89 DwarfLocSection(".debug_loc"),
90 DwarfARangesSection(".debug_aranges"),
91 DwarfRangesSection(".debug_ranges"),
92 DwarfMacInfoSection(".debug_macinfo"),
93 DwarfEHFrameSection(".eh_frame"),
94 DwarfExceptionSection(".gcc_except_table"),
98 TargetAsmInfo::~TargetAsmInfo() {
101 /// Measure the specified inline asm to determine an approximation of its
103 unsigned TargetAsmInfo::getInlineAsmLength(const char *Str) const {
104 // Count the number of instructions in the asm.
105 unsigned NumInsts = 0;
106 for (; *Str; ++Str) {
107 if (*Str == '\n' || *Str == SeparatorChar)
111 // Multiply by the worst-case length for each instruction.
112 return NumInsts * MaxInstLength;