Omit private_extern declarations of extern symbols; followup to
[oota-llvm.git] / lib / MC / MCAsmInfo.cpp
1 //===-- MCAsmInfo.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/MC/MCAsmInfo.h"
16 #include "llvm/Support/DataTypes.h"
17 #include <cctype>
18 #include <cstring>
19 using namespace llvm;
20
21 MCAsmInfo::MCAsmInfo() {
22   HasSubsectionsViaSymbols = false;
23   HasMachoZeroFillDirective = false;
24   HasMachoTBSSDirective = false;
25   HasStaticCtorDtorReferenceInStaticMode = false;
26   LinkerRequiresNonEmptyDwarfLines = false;
27   MaxInstLength = 4;
28   PCSymbol = "$";
29   SeparatorChar = ';';
30   CommentColumn = 40;
31   CommentString = "#";
32   LabelSuffix = ":";
33   GlobalPrefix = "";
34   PrivateGlobalPrefix = ".";
35   LinkerPrivateGlobalPrefix = "";
36   InlineAsmStart = "APP";
37   InlineAsmEnd = "NO_APP";
38   AssemblerDialect = 0;
39   AllowQuotesInName = false;
40   AllowNameToStartWithDigit = false;
41   AllowPeriodsInName = true;
42   ZeroDirective = "\t.zero\t";
43   AsciiDirective = "\t.ascii\t";
44   AscizDirective = "\t.asciz\t";
45   Data8bitsDirective = "\t.byte\t";
46   Data16bitsDirective = "\t.short\t";
47   Data32bitsDirective = "\t.long\t";
48   Data64bitsDirective = "\t.quad\t";
49   SunStyleELFSectionSwitchSyntax = false;
50   UsesELFSectionDirectiveForBSS = false;
51   AlignDirective = "\t.align\t";
52   AlignmentIsInBytes = true;
53   TextAlignFillValue = 0;
54   GPRel32Directive = 0;
55   GlobalDirective = "\t.globl\t";
56   HasSetDirective = true;
57   HasAggressiveSymbolFolding = true;
58   HasLCOMMDirective = false;
59   COMMDirectiveAlignmentIsInBytes = true;
60   HasDotTypeDotSizeDirective = true;
61   HasSingleParameterDotFile = true;
62   HasNoDeadStrip = false;
63   HasSymbolResolver = false;
64   WeakRefDirective = 0;
65   WeakDefDirective = 0;
66   LinkOnceDirective = 0;
67   HiddenVisibilityAttr = MCSA_Hidden;
68   HiddenDeclarationVisibilityAttr = MCSA_Hidden;
69   ProtectedVisibilityAttr = MCSA_Protected;
70   HasLEB128 = false;
71   SupportsDebugInformation = false;
72   ExceptionsType = ExceptionHandling::None;
73   DwarfRequiresFrameSection = true;
74   DwarfUsesInlineInfoSection = false;
75   DwarfUsesAbsoluteLabelForStmtList = true;
76   DwarfSectionOffsetDirective = 0;
77   DwarfUsesLabelOffsetForRanges = true;
78   HasMicrosoftFastStdCallMangling = false;
79
80   AsmTransCBE = 0;
81 }
82
83 MCAsmInfo::~MCAsmInfo() {
84 }
85
86
87 unsigned MCAsmInfo::getULEB128Size(unsigned Value) {
88   unsigned Size = 0;
89   do {
90     Value >>= 7;
91     Size += sizeof(int8_t);
92   } while (Value);
93   return Size;
94 }
95
96 unsigned MCAsmInfo::getSLEB128Size(int Value) {
97   unsigned Size = 0;
98   int Sign = Value >> (8 * sizeof(Value) - 1);
99   bool IsMore;
100
101   do {
102     unsigned Byte = Value & 0x7f;
103     Value >>= 7;
104     IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
105     Size += sizeof(int8_t);
106   } while (IsMore);
107   return Size;
108 }