Analog Devices Blackfin back-end.
[oota-llvm.git] / lib / Target / TargetAsmInfo.cpp
1 //===-- TargetAsmInfo.cpp - Asm Info ---------------------------------------==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // 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 #include <cctype>
17 #include <cstring>
18 using namespace llvm;
19
20 TargetAsmInfo::TargetAsmInfo() {
21   ZeroFillDirective = 0;
22   NonexecutableStackDirective = 0;
23   NeedsSet = false;
24   MaxInstLength = 4;
25   PCSymbol = "$";
26   SeparatorChar = ';';
27   CommentColumn = 60;
28   CommentString = "#";
29   FirstOperandColumn = 0;
30   MaxOperandLength = 0;
31   GlobalPrefix = "";
32   PrivateGlobalPrefix = ".";
33   LinkerPrivateGlobalPrefix = "";
34   JumpTableSpecialLabelPrefix = 0;
35   GlobalVarAddrPrefix = "";
36   GlobalVarAddrSuffix = "";
37   FunctionAddrPrefix = "";
38   FunctionAddrSuffix = "";
39   PersonalityPrefix = "";
40   PersonalitySuffix = "";
41   NeedsIndirectEncoding = false;
42   InlineAsmStart = "#APP";
43   InlineAsmEnd = "#NO_APP";
44   AssemblerDialect = 0;
45   AllowQuotesInName = false;
46   ZeroDirective = "\t.zero\t";
47   ZeroDirectiveSuffix = 0;
48   AsciiDirective = "\t.ascii\t";
49   AscizDirective = "\t.asciz\t";
50   Data8bitsDirective = "\t.byte\t";
51   Data16bitsDirective = "\t.short\t";
52   Data32bitsDirective = "\t.long\t";
53   Data64bitsDirective = "\t.quad\t";
54   AlignDirective = "\t.align\t";
55   AlignmentIsInBytes = true;
56   TextAlignFillValue = 0;
57   SwitchToSectionDirective = "\t.section\t";
58   TextSectionStartSuffix = "";
59   DataSectionStartSuffix = "";
60   SectionEndDirectiveSuffix = 0;
61   JumpTableDirective = 0;
62   GlobalDirective = "\t.globl\t";
63   SetDirective = 0;
64   LCOMMDirective = 0;
65   COMMDirective = "\t.comm\t";
66   COMMDirectiveTakesAlignment = true;
67   HasDotTypeDotSizeDirective = true;
68   HasSingleParameterDotFile = true;
69   UsedDirective = 0;
70   WeakRefDirective = 0;
71   WeakDefDirective = 0;
72   // FIXME: These are ELFish - move to ELFTAI.
73   HiddenDirective = "\t.hidden\t";
74   ProtectedDirective = "\t.protected\t";
75   AbsoluteDebugSectionOffsets = false;
76   AbsoluteEHSectionOffsets = false;
77   HasLEB128 = false;
78   HasDotLocAndDotFile = false;
79   SupportsDebugInformation = false;
80   SupportsExceptionHandling = false;
81   DwarfRequiresFrameSection = true;
82   DwarfUsesInlineInfoSection = false;
83   Is_EHSymbolPrivate = true;
84   GlobalEHDirective = 0;
85   SupportsWeakOmittedEHFrame = true;
86   DwarfSectionOffsetDirective = 0;
87
88   AsmTransCBE = 0;
89 }
90
91 TargetAsmInfo::~TargetAsmInfo() {
92 }
93
94
95 unsigned TargetAsmInfo::getULEB128Size(unsigned Value) {
96   unsigned Size = 0;
97   do {
98     Value >>= 7;
99     Size += sizeof(int8_t);
100   } while (Value);
101   return Size;
102 }
103
104 unsigned TargetAsmInfo::getSLEB128Size(int Value) {
105   unsigned Size = 0;
106   int Sign = Value >> (8 * sizeof(Value) - 1);
107   bool IsMore;
108
109   do {
110     unsigned Byte = Value & 0x7f;
111     Value >>= 7;
112     IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
113     Size += sizeof(int8_t);
114   } while (IsMore);
115   return Size;
116 }