Fix part 1 of pr4682. PICADD is a 16-bit instruction even in thumb2 mode.
[llvm/avr.git] / lib / Target / TargetAsmInfo.cpp
blob5be769319bd208b3bf122030ac35642796555cd0
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.
13 //===----------------------------------------------------------------------===//
15 #include "llvm/Target/TargetAsmInfo.h"
16 #include <cctype>
17 #include <cstring>
18 using namespace llvm;
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 JumpTableDirective = 0;
61 GlobalDirective = "\t.globl\t";
62 SetDirective = 0;
63 LCOMMDirective = 0;
64 COMMDirective = "\t.comm\t";
65 COMMDirectiveTakesAlignment = true;
66 HasDotTypeDotSizeDirective = true;
67 HasSingleParameterDotFile = true;
68 UsedDirective = 0;
69 WeakRefDirective = 0;
70 WeakDefDirective = 0;
71 // FIXME: These are ELFish - move to ELFTAI.
72 HiddenDirective = "\t.hidden\t";
73 ProtectedDirective = "\t.protected\t";
74 AbsoluteDebugSectionOffsets = false;
75 AbsoluteEHSectionOffsets = false;
76 HasLEB128 = false;
77 HasDotLocAndDotFile = false;
78 SupportsDebugInformation = false;
79 SupportsExceptionHandling = false;
80 DwarfRequiresFrameSection = true;
81 DwarfUsesInlineInfoSection = false;
82 Is_EHSymbolPrivate = true;
83 GlobalEHDirective = 0;
84 SupportsWeakOmittedEHFrame = true;
85 DwarfSectionOffsetDirective = 0;
87 AsmTransCBE = 0;
90 TargetAsmInfo::~TargetAsmInfo() {
94 unsigned TargetAsmInfo::getULEB128Size(unsigned Value) {
95 unsigned Size = 0;
96 do {
97 Value >>= 7;
98 Size += sizeof(int8_t);
99 } while (Value);
100 return Size;
103 unsigned TargetAsmInfo::getSLEB128Size(int Value) {
104 unsigned Size = 0;
105 int Sign = Value >> (8 * sizeof(Value) - 1);
106 bool IsMore;
108 do {
109 unsigned Byte = Value & 0x7f;
110 Value >>= 7;
111 IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
112 Size += sizeof(int8_t);
113 } while (IsMore);
114 return Size;