Add TAI field for exception table section.
[oota-llvm.git] / lib / Target / TargetAsmInfo.cpp
1 //===-- TargetAsmInfo.cpp - Asm Info ---------------------------------------==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
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.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines target asm properties related what form asm statements
11 // should take.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #include "llvm/Target/TargetAsmInfo.h"
16
17 using namespace llvm;
18
19 TargetAsmInfo::TargetAsmInfo() :
20   TextSection(".text"),
21   DataSection(".data"),
22   BSSSection(".bss"),
23   ZeroFillDirective(0),
24   AddressSize(4),
25   NeedsSet(false),
26   MaxInstLength(4),
27   PCSymbol("$"),
28   SeparatorChar(';'),
29   CommentString("#"),
30   GlobalPrefix(""),
31   PrivateGlobalPrefix("."),
32   JumpTableSpecialLabelPrefix(0),
33   GlobalVarAddrPrefix(""),
34   GlobalVarAddrSuffix(""),
35   FunctionAddrPrefix(""),
36   FunctionAddrSuffix(""),
37   InlineAsmStart("#APP"),
38   InlineAsmEnd("#NO_APP"),
39   AssemblerDialect(0),
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),
57   CStringSection(0),
58   StaticCtorsSection("\t.section .ctors,\"aw\",@progbits"),
59   StaticDtorsSection("\t.section .dtors,\"aw\",@progbits"),
60   FourByteConstantSection(0),
61   EightByteConstantSection(0),
62   SixteenByteConstantSection(0),
63   GlobalDirective(0),
64   SetDirective(0),
65   LCOMMDirective(0),
66   COMMDirective("\t.comm\t"),
67   COMMDirectiveTakesAlignment(true),
68   HasDotTypeDotSizeDirective(true),
69   UsedDirective(0),
70   WeakRefDirective(0),
71   HiddenDirective("\t.hidden\t"),
72   HasLEB128(false),
73   HasDotLoc(false),
74   HasDotFile(false),
75   SupportsExceptionHandling(false),
76   DwarfRequiresFrameSection(true),
77   DwarfAbbrevSection(".debug_abbrev"),
78   DwarfInfoSection(".debug_info"),
79   DwarfLineSection(".debug_line"),
80   DwarfFrameSection(".debug_frame"),
81   DwarfPubNamesSection(".debug_pubnames"),
82   DwarfPubTypesSection(".debug_pubtypes"),
83   DwarfStrSection(".debug_str"),
84   DwarfLocSection(".debug_loc"),
85   DwarfARangesSection(".debug_aranges"),
86   DwarfRangesSection(".debug_ranges"),
87   DwarfMacInfoSection(".debug_macinfo"),
88   DwarfEHFrameSection(".eh_frame"),
89   DwarfExceptionSection(".gcc_except_table"),
90   AsmTransCBE(0) {
91 }
92
93 TargetAsmInfo::~TargetAsmInfo() {
94 }
95
96 /// Measure the specified inline asm to determine an approximation of its
97 /// length.
98 unsigned TargetAsmInfo::getInlineAsmLength(const char *Str) const {
99   // Count the number of instructions in the asm.
100   unsigned NumInsts = 0;
101   for (; *Str; ++Str) {
102     if (*Str == '\n' || *Str == SeparatorChar)
103       ++NumInsts;
104   }
105
106   // Multiply by the worst-case length for each instruction.
107   return NumInsts * MaxInstLength;
108 }