blob: 84a97710d6781c02e569a9ec2be8ba313dbdd659 [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 = "#";
29 GlobalPrefix = "";
30 PrivateGlobalPrefix = ".";
Chris Lattnerc889b3b2009-07-21 17:30:51 +000031 LinkerPrivateGlobalPrefix = "";
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000032 JumpTableSpecialLabelPrefix = 0;
33 GlobalVarAddrPrefix = "";
34 GlobalVarAddrSuffix = "";
35 FunctionAddrPrefix = "";
36 FunctionAddrSuffix = "";
37 PersonalityPrefix = "";
38 PersonalitySuffix = "";
39 NeedsIndirectEncoding = false;
40 InlineAsmStart = "#APP";
41 InlineAsmEnd = "#NO_APP";
42 AssemblerDialect = 0;
Chris Lattner690b02c2009-06-18 23:41:35 +000043 AllowQuotesInName = false;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000044 ZeroDirective = "\t.zero\t";
45 ZeroDirectiveSuffix = 0;
46 AsciiDirective = "\t.ascii\t";
47 AscizDirective = "\t.asciz\t";
48 Data8bitsDirective = "\t.byte\t";
49 Data16bitsDirective = "\t.short\t";
50 Data32bitsDirective = "\t.long\t";
51 Data64bitsDirective = "\t.quad\t";
Chris Lattnera8b97f42009-08-08 20:43:12 +000052 SunStyleELFSectionSwitchSyntax = false;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000053 AlignDirective = "\t.align\t";
54 AlignmentIsInBytes = true;
55 TextAlignFillValue = 0;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000056 JumpTableDirective = 0;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000057 GlobalDirective = "\t.globl\t";
58 SetDirective = 0;
59 LCOMMDirective = 0;
60 COMMDirective = "\t.comm\t";
61 COMMDirectiveTakesAlignment = true;
62 HasDotTypeDotSizeDirective = true;
Rafael Espindola5cf2e552008-12-03 11:01:37 +000063 HasSingleParameterDotFile = true;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000064 UsedDirective = 0;
65 WeakRefDirective = 0;
66 WeakDefDirective = 0;
67 // FIXME: These are ELFish - move to ELFTAI.
68 HiddenDirective = "\t.hidden\t";
69 ProtectedDirective = "\t.protected\t";
70 AbsoluteDebugSectionOffsets = false;
71 AbsoluteEHSectionOffsets = false;
72 HasLEB128 = false;
73 HasDotLocAndDotFile = false;
74 SupportsDebugInformation = false;
Jim Grosbach29feb6a2009-08-11 00:09:57 +000075 ExceptionsType = ExceptionHandling::None;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000076 DwarfRequiresFrameSection = true;
Devang Patel88bf96e2009-04-13 17:02:03 +000077 DwarfUsesInlineInfoSection = false;
Chris Lattner5c3475e2009-07-17 20:46:40 +000078 Is_EHSymbolPrivate = true;
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000079 GlobalEHDirective = 0;
80 SupportsWeakOmittedEHFrame = true;
81 DwarfSectionOffsetDirective = 0;
Chris Lattner72d228d2009-08-02 07:24:22 +000082
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000083 AsmTransCBE = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000084}
85
86TargetAsmInfo::~TargetAsmInfo() {
87}
88
Dan Gohmanf17a25c2007-07-18 16:29:46 +000089
aslc200b112008-08-16 12:57:46 +000090unsigned TargetAsmInfo::getULEB128Size(unsigned Value) {
91 unsigned Size = 0;
92 do {
93 Value >>= 7;
94 Size += sizeof(int8_t);
95 } while (Value);
96 return Size;
97}
98
99unsigned TargetAsmInfo::getSLEB128Size(int Value) {
100 unsigned Size = 0;
101 int Sign = Value >> (8 * sizeof(Value) - 1);
102 bool IsMore;
103
104 do {
105 unsigned Byte = Value & 0x7f;
106 Value >>= 7;
107 IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
108 Size += sizeof(int8_t);
109 } while (IsMore);
110 return Size;
111}