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