blob: 7da3715d2666e3971b9ade7228b29df677d9a836 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===-- TargetAsmInfo.cpp - Asm Info ---------------------------------------==//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
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>
Dan Gohmanf17a25c2007-07-18 16:29:46 +000018using namespace llvm;
19
Chris Lattner7dd4ffc2009-08-02 04:27:24 +000020TargetAsmInfo::TargetAsmInfo() {
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000021 ZeroFillDirective = 0;
22 NonexecutableStackDirective = 0;
23 NeedsSet = false;
24 MaxInstLength = 4;
25 PCSymbol = "$";
26 SeparatorChar = ';';
David Greene63486122009-07-13 20:25:48 +000027 CommentColumn = 60;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000028 CommentString = "#";
David Greene47974bf2009-07-20 22:02:59 +000029 FirstOperandColumn = 0;
30 MaxOperandLength = 0;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000031 GlobalPrefix = "";
32 PrivateGlobalPrefix = ".";
Chris Lattnerc889b3b2009-07-21 17:30:51 +000033 LinkerPrivateGlobalPrefix = "";
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000034 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;
Chris Lattner690b02c2009-06-18 23:41:35 +000045 AllowQuotesInName = false;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000046 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;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000061 JumpTableDirective = 0;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000062 GlobalDirective = "\t.globl\t";
63 SetDirective = 0;
64 LCOMMDirective = 0;
65 COMMDirective = "\t.comm\t";
66 COMMDirectiveTakesAlignment = true;
67 HasDotTypeDotSizeDirective = true;
Rafael Espindola5cf2e552008-12-03 11:01:37 +000068 HasSingleParameterDotFile = true;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000069 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;
Devang Patel88bf96e2009-04-13 17:02:03 +000082 DwarfUsesInlineInfoSection = false;
Chris Lattner5c3475e2009-07-17 20:46:40 +000083 Is_EHSymbolPrivate = true;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000084 GlobalEHDirective = 0;
85 SupportsWeakOmittedEHFrame = true;
86 DwarfSectionOffsetDirective = 0;
87 DwarfAbbrevSection = ".debug_abbrev";
88 DwarfInfoSection = ".debug_info";
89 DwarfLineSection = ".debug_line";
90 DwarfFrameSection = ".debug_frame";
91 DwarfPubNamesSection = ".debug_pubnames";
92 DwarfPubTypesSection = ".debug_pubtypes";
Devang Patel88bf96e2009-04-13 17:02:03 +000093 DwarfDebugInlineSection = ".debug_inlined";
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000094 DwarfStrSection = ".debug_str";
95 DwarfLocSection = ".debug_loc";
96 DwarfARangesSection = ".debug_aranges";
97 DwarfRangesSection = ".debug_ranges";
Chris Lattnerecbf73b2009-06-18 23:31:37 +000098 DwarfMacroInfoSection = ".debug_macinfo";
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000099 AsmTransCBE = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000100}
101
102TargetAsmInfo::~TargetAsmInfo() {
103}
104
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000105
aslc200b112008-08-16 12:57:46 +0000106unsigned TargetAsmInfo::getULEB128Size(unsigned Value) {
107 unsigned Size = 0;
108 do {
109 Value >>= 7;
110 Size += sizeof(int8_t);
111 } while (Value);
112 return Size;
113}
114
115unsigned TargetAsmInfo::getSLEB128Size(int Value) {
116 unsigned Size = 0;
117 int Sign = Value >> (8 * sizeof(Value) - 1);
118 bool IsMore;
119
120 do {
121 unsigned Byte = Value & 0x7f;
122 Value >>= 7;
123 IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
124 Size += sizeof(int8_t);
125 } while (IsMore);
126 return Size;
127}