blob: 5be769319bd208b3bf122030ac35642796555cd0 [file] [log] [blame]
Jim Laskeyef94ebb2006-09-06 19:21:41 +00001//===-- TargetAsmInfo.cpp - Asm Info ---------------------------------------==//
Jim Laskey681ecbb2006-09-06 18:35:33 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-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 Laskey681ecbb2006-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 Johannesen0a1069d2007-04-23 20:00:17 +000016#include <cctype>
17#include <cstring>
Jim Laskey681ecbb2006-09-06 18:35:33 +000018using namespace llvm;
19
Chris Lattnerb25afe02009-08-02 04:27:24 +000020TargetAsmInfo::TargetAsmInfo() {
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000021 ZeroFillDirective = 0;
22 NonexecutableStackDirective = 0;
23 NeedsSet = false;
24 MaxInstLength = 4;
25 PCSymbol = "$";
26 SeparatorChar = ';';
David Greenede544782009-07-13 20:25:48 +000027 CommentColumn = 60;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000028 CommentString = "#";
David Greene40c68ad2009-07-20 22:02:59 +000029 FirstOperandColumn = 0;
30 MaxOperandLength = 0;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000031 GlobalPrefix = "";
32 PrivateGlobalPrefix = ".";
Chris Lattner1177cee2009-07-21 17:30:51 +000033 LinkerPrivateGlobalPrefix = "";
Anton Korobeynikov87001fd2008-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 Lattnerb8476452009-06-18 23:41:35 +000045 AllowQuotesInName = false;
Anton Korobeynikov87001fd2008-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 = "";
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000060 JumpTableDirective = 0;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000061 GlobalDirective = "\t.globl\t";
62 SetDirective = 0;
63 LCOMMDirective = 0;
64 COMMDirective = "\t.comm\t";
65 COMMDirectiveTakesAlignment = true;
66 HasDotTypeDotSizeDirective = true;
Rafael Espindolacda011b2008-12-03 11:01:37 +000067 HasSingleParameterDotFile = true;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000068 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;
Devang Patel80be3512009-04-13 17:02:03 +000081 DwarfUsesInlineInfoSection = false;
Chris Lattnere79b2bc2009-07-17 20:46:40 +000082 Is_EHSymbolPrivate = true;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000083 GlobalEHDirective = 0;
84 SupportsWeakOmittedEHFrame = true;
85 DwarfSectionOffsetDirective = 0;
Chris Lattner1472cf52009-08-02 07:24:22 +000086
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000087 AsmTransCBE = 0;
Chris Lattner95129a72006-10-13 17:50:07 +000088}
Chris Lattnerafe6d7a2006-10-05 00:35:16 +000089
90TargetAsmInfo::~TargetAsmInfo() {
91}
Chris Lattner95129a72006-10-13 17:50:07 +000092
Anton Korobeynikov942fda02007-03-07 02:47:57 +000093
Anton Korobeynikovbd890b12008-08-16 12:57:46 +000094unsigned TargetAsmInfo::getULEB128Size(unsigned Value) {
95 unsigned Size = 0;
96 do {
97 Value >>= 7;
98 Size += sizeof(int8_t);
99 } while (Value);
100 return Size;
101}
102
103unsigned TargetAsmInfo::getSLEB128Size(int Value) {
104 unsigned Size = 0;
105 int Sign = Value >> (8 * sizeof(Value) - 1);
106 bool IsMore;
107
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;
115}