Fix mmx paddq, add support for the 'y' register class, though it isn't tested.
[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   ReadOnlySection(0),
64   GlobalDirective(0),
65   SetDirective(0),
66   LCOMMDirective(0),
67   COMMDirective("\t.comm\t"),
68   COMMDirectiveTakesAlignment(true),
69   HasDotTypeDotSizeDirective(true),
70   UsedDirective(0),
71   WeakRefDirective(0),
72   HiddenDirective("\t.hidden\t"),
73   AbsoluteSectionOffsets(false),
74   HasLEB128(false),
75   HasDotLoc(false),
76   HasDotFile(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"),
93   AsmTransCBE(0) {
94 }
95
96 TargetAsmInfo::~TargetAsmInfo() {
97 }
98
99 /// Measure the specified inline asm to determine an approximation of its
100 /// length.
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)
106       ++NumInsts;
107   }
108
109   // Multiply by the worst-case length for each instruction.
110   return NumInsts * MaxInstLength;
111 }
112