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