revert 93934, removing the MCAsmInfo endianness bit. I can't
[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/System/DataTypes.h"
17 #include <cctype>
18 #include <cstring>
19 using namespace llvm;
20
21 MCAsmInfo::MCAsmInfo() {
22   HasMachoZeroFillDirective = false;
23   HasStaticCtorDtorReferenceInStaticMode = false;
24   NonexecutableStackDirective = 0;
25   NeedsSet = false;
26   MaxInstLength = 4;
27   PCSymbol = "$";
28   SeparatorChar = ';';
29   CommentColumn = 60;
30   CommentString = "#";
31   GlobalPrefix = "";
32   PrivateGlobalPrefix = ".";
33   LinkerPrivateGlobalPrefix = "";
34   InlineAsmStart = "APP";
35   InlineAsmEnd = "NO_APP";
36   AssemblerDialect = 0;
37   AllowQuotesInName = false;
38   AllowNameToStartWithDigit = false;
39   ZeroDirective = "\t.zero\t";
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   SunStyleELFSectionSwitchSyntax = false;
47   UsesELFSectionDirectiveForBSS = false;
48   AlignDirective = "\t.align\t";
49   AlignmentIsInBytes = true;
50   TextAlignFillValue = 0;
51   JumpTableDirective = 0;
52   PICJumpTableDirective = 0;
53   GlobalDirective = "\t.globl\t";
54   SetDirective = 0;
55   LCOMMDirective = 0;
56   COMMDirective = "\t.comm\t";
57   COMMDirectiveTakesAlignment = true;
58   HasDotTypeDotSizeDirective = true;
59   HasSingleParameterDotFile = true;
60   UsedDirective = 0;
61   WeakRefDirective = 0;
62   WeakDefDirective = 0;
63   LinkOnceDirective = 0;
64   // FIXME: These are ELFish - move to ELFMAI.
65   HiddenDirective = "\t.hidden\t";
66   ProtectedDirective = "\t.protected\t";
67   AbsoluteDebugSectionOffsets = false;
68   AbsoluteEHSectionOffsets = false;
69   HasLEB128 = false;
70   HasDotLocAndDotFile = false;
71   SupportsDebugInformation = false;
72   ExceptionsType = ExceptionHandling::None;
73   DwarfRequiresFrameSection = true;
74   DwarfUsesInlineInfoSection = false;
75   Is_EHSymbolPrivate = true;
76   GlobalEHDirective = 0;
77   SupportsWeakOmittedEHFrame = true;
78   DwarfSectionOffsetDirective = 0;
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 }