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