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