blob: 20a584916f7a04d6f9f3161ce11583832984f893 [file] [log] [blame]
Jim Laskey7c95ad42006-09-06 19:21:41 +00001//===-- TargetAsmInfo.cpp - Asm Info ---------------------------------------==//
Jim Laskeyec0d9fe2006-09-06 18:35:33 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Jim Laskeyec0d9fe2006-09-06 18:35:33 +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"
Dale Johannesen3bb62832007-04-23 20:00:17 +000016#include <cctype>
17#include <cstring>
Jim Laskeyec0d9fe2006-09-06 18:35:33 +000018using namespace llvm;
19
Chris Lattner8d4a0a32009-08-02 04:27:24 +000020TargetAsmInfo::TargetAsmInfo() {
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000021 ZeroFillDirective = 0;
22 NonexecutableStackDirective = 0;
23 NeedsSet = false;
24 MaxInstLength = 4;
25 PCSymbol = "$";
26 SeparatorChar = ';';
David Greene014700c2009-07-13 20:25:48 +000027 CommentColumn = 60;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000028 CommentString = "#";
29 GlobalPrefix = "";
30 PrivateGlobalPrefix = ".";
Chris Lattner90f8b702009-07-21 17:30:51 +000031 LinkerPrivateGlobalPrefix = "";
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000032 JumpTableSpecialLabelPrefix = 0;
33 GlobalVarAddrPrefix = "";
34 GlobalVarAddrSuffix = "";
35 FunctionAddrPrefix = "";
36 FunctionAddrSuffix = "";
37 PersonalityPrefix = "";
38 PersonalitySuffix = "";
39 NeedsIndirectEncoding = false;
Chris Lattnere2b06012009-08-11 22:39:40 +000040 InlineAsmStart = "APP";
41 InlineAsmEnd = "NO_APP";
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000042 AssemblerDialect = 0;
Chris Lattnera93ca922009-06-18 23:41:35 +000043 AllowQuotesInName = false;
Anton Korobeynikov32b952a2008-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 Lattner5277b222009-08-08 20:43:12 +000052 SunStyleELFSectionSwitchSyntax = false;
Bruno Cardoso Lopesfdf229e2009-08-13 23:30:21 +000053 UsesELFSectionDirectiveForBSS = false;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000054 AlignDirective = "\t.align\t";
55 AlignmentIsInBytes = true;
56 TextAlignFillValue = 0;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000057 JumpTableDirective = 0;
Chris Lattnerdfab2912009-08-11 20:30:58 +000058 PICJumpTableDirective = 0;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000059 GlobalDirective = "\t.globl\t";
60 SetDirective = 0;
61 LCOMMDirective = 0;
62 COMMDirective = "\t.comm\t";
63 COMMDirectiveTakesAlignment = true;
64 HasDotTypeDotSizeDirective = true;
Rafael Espindola952b8392008-12-03 11:01:37 +000065 HasSingleParameterDotFile = true;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000066 UsedDirective = 0;
67 WeakRefDirective = 0;
68 WeakDefDirective = 0;
69 // FIXME: These are ELFish - move to ELFTAI.
70 HiddenDirective = "\t.hidden\t";
71 ProtectedDirective = "\t.protected\t";
72 AbsoluteDebugSectionOffsets = false;
73 AbsoluteEHSectionOffsets = false;
74 HasLEB128 = false;
75 HasDotLocAndDotFile = false;
76 SupportsDebugInformation = false;
Jim Grosbach1b747ad2009-08-11 00:09:57 +000077 ExceptionsType = ExceptionHandling::None;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000078 DwarfRequiresFrameSection = true;
Devang Patel0f7fef32009-04-13 17:02:03 +000079 DwarfUsesInlineInfoSection = false;
Chris Lattnere2cf37b2009-07-17 20:46:40 +000080 Is_EHSymbolPrivate = true;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000081 GlobalEHDirective = 0;
82 SupportsWeakOmittedEHFrame = true;
83 DwarfSectionOffsetDirective = 0;
Chris Lattner18a4c162009-08-02 07:24:22 +000084
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000085 AsmTransCBE = 0;
Chris Lattner4c7b07a2006-10-13 17:50:07 +000086}
Chris Lattnerf5b10ec2006-10-05 00:35:16 +000087
88TargetAsmInfo::~TargetAsmInfo() {
89}
Chris Lattner4c7b07a2006-10-13 17:50:07 +000090
Anton Korobeynikova6199c82007-03-07 02:47:57 +000091
Anton Korobeynikovffe31d72008-08-16 12:57:46 +000092unsigned TargetAsmInfo::getULEB128Size(unsigned Value) {
93 unsigned Size = 0;
94 do {
95 Value >>= 7;
96 Size += sizeof(int8_t);
97 } while (Value);
98 return Size;
99}
100
101unsigned TargetAsmInfo::getSLEB128Size(int Value) {
102 unsigned Size = 0;
103 int Sign = Value >> (8 * sizeof(Value) - 1);
104 bool IsMore;
105
106 do {
107 unsigned Byte = Value & 0x7f;
108 Value >>= 7;
109 IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
110 Size += sizeof(int8_t);
111 } while (IsMore);
112 return Size;
113}