blob: 116c007a451cc6b50c8b9395eb7ea1979e14b267 [file] [log] [blame]
Chris Lattneraf76e592009-08-22 20:48:53 +00001//===-- MCAsmInfo.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
Chris Lattneraf76e592009-08-22 20:48:53 +000015#include "llvm/MC/MCAsmInfo.h"
Michael J. Spencer1f6efa32010-11-29 18:16:10 +000016#include "llvm/Support/DataTypes.h"
Dale Johannesen3bb62832007-04-23 20:00:17 +000017#include <cctype>
18#include <cstring>
Jim Laskeyec0d9fe2006-09-06 18:35:33 +000019using namespace llvm;
20
Chris Lattner8eeba352010-01-20 06:34:14 +000021MCAsmInfo::MCAsmInfo() {
Chris Lattnerf9f93e42010-01-23 07:21:06 +000022 HasSubsectionsViaSymbols = false;
Chris Lattneraac138e2010-01-19 02:09:44 +000023 HasMachoZeroFillDirective = false;
Eric Christopherc1a887d2010-05-20 00:49:07 +000024 HasMachoTBSSDirective = false;
Chris Lattner71eae712010-01-19 04:34:02 +000025 HasStaticCtorDtorReferenceInStaticMode = false;
Rafael Espindola767b1be2010-12-04 00:31:13 +000026 LinkerRequiresNonEmptyDwarfLines = false;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000027 MaxInstLength = 4;
28 PCSymbol = "$";
Jim Grosbachd31d3042011-03-24 18:46:34 +000029 SeparatorString = ";";
Daniel Dunbar73163f82010-02-05 07:32:18 +000030 CommentColumn = 40;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000031 CommentString = "#";
Chris Lattnere07b75e2010-09-22 22:19:53 +000032 LabelSuffix = ":";
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000033 GlobalPrefix = "";
34 PrivateGlobalPrefix = ".";
Chris Lattner90f8b702009-07-21 17:30:51 +000035 LinkerPrivateGlobalPrefix = "";
Chris Lattnere2b06012009-08-11 22:39:40 +000036 InlineAsmStart = "APP";
37 InlineAsmEnd = "NO_APP";
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000038 AssemblerDialect = 0;
Chris Lattnera93ca922009-06-18 23:41:35 +000039 AllowQuotesInName = false;
Anton Korobeynikovc6f729e2009-09-18 16:57:42 +000040 AllowNameToStartWithDigit = false;
Mon P Wangb9a01bc2010-04-29 04:00:56 +000041 AllowPeriodsInName = true;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000042 ZeroDirective = "\t.zero\t";
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000043 AsciiDirective = "\t.ascii\t";
44 AscizDirective = "\t.asciz\t";
45 Data8bitsDirective = "\t.byte\t";
46 Data16bitsDirective = "\t.short\t";
47 Data32bitsDirective = "\t.long\t";
48 Data64bitsDirective = "\t.quad\t";
Chris Lattner5277b222009-08-08 20:43:12 +000049 SunStyleELFSectionSwitchSyntax = false;
Bruno Cardoso Lopesfdf229e2009-08-13 23:30:21 +000050 UsesELFSectionDirectiveForBSS = false;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000051 AlignDirective = "\t.align\t";
52 AlignmentIsInBytes = true;
53 TextAlignFillValue = 0;
Chris Lattner78f485a2010-01-25 21:10:10 +000054 GPRel32Directive = 0;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000055 GlobalDirective = "\t.globl\t";
Chris Lattnercee63322010-01-26 20:40:54 +000056 HasSetDirective = true;
Rafael Espindola90a5a0c2010-12-22 21:51:29 +000057 HasAggressiveSymbolFolding = true;
Chris Lattner9eb158d2010-01-23 07:47:02 +000058 HasLCOMMDirective = false;
Rafael Espindola2e2563b2010-01-26 20:21:43 +000059 COMMDirectiveAlignmentIsInBytes = true;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000060 HasDotTypeDotSizeDirective = true;
Rafael Espindola952b8392008-12-03 11:01:37 +000061 HasSingleParameterDotFile = true;
Chris Lattner3a9be0e2010-01-23 05:51:36 +000062 HasNoDeadStrip = false;
Kevin Enderbye8e98d72010-11-19 18:39:33 +000063 HasSymbolResolver = false;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000064 WeakRefDirective = 0;
65 WeakDefDirective = 0;
Chris Lattner41eb8b42010-01-19 05:08:13 +000066 LinkOnceDirective = 0;
Chris Lattner152a29b2010-01-23 06:53:23 +000067 HiddenVisibilityAttr = MCSA_Hidden;
Stuart Hastings5129bde2011-02-23 02:27:05 +000068 HiddenDeclarationVisibilityAttr = MCSA_Hidden;
Chris Lattner152a29b2010-01-23 06:53:23 +000069 ProtectedVisibilityAttr = MCSA_Protected;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000070 HasLEB128 = false;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000071 SupportsDebugInformation = false;
Jim Grosbach1b747ad2009-08-11 00:09:57 +000072 ExceptionsType = ExceptionHandling::None;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000073 DwarfRequiresFrameSection = true;
Devang Patel0f7fef32009-04-13 17:02:03 +000074 DwarfUsesInlineInfoSection = false;
Devang Patelae84d5b2010-08-31 23:50:19 +000075 DwarfUsesAbsoluteLabelForStmtList = true;
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000076 DwarfSectionOffsetDirective = 0;
Devang Patelb1fcfbe2010-09-02 16:43:44 +000077 DwarfUsesLabelOffsetForRanges = true;
Chris Lattner8a29fa62010-03-12 21:03:47 +000078 HasMicrosoftFastStdCallMangling = false;
Chris Lattner18a4c162009-08-02 07:24:22 +000079
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000080 AsmTransCBE = 0;
Chris Lattner4c7b07a2006-10-13 17:50:07 +000081}
Chris Lattnerf5b10ec2006-10-05 00:35:16 +000082
Chris Lattneraf76e592009-08-22 20:48:53 +000083MCAsmInfo::~MCAsmInfo() {
Chris Lattnerf5b10ec2006-10-05 00:35:16 +000084}
Chris Lattner4c7b07a2006-10-13 17:50:07 +000085
Anton Korobeynikova6199c82007-03-07 02:47:57 +000086
Chris Lattneraf76e592009-08-22 20:48:53 +000087unsigned MCAsmInfo::getULEB128Size(unsigned Value) {
Anton Korobeynikovffe31d72008-08-16 12:57:46 +000088 unsigned Size = 0;
89 do {
90 Value >>= 7;
91 Size += sizeof(int8_t);
92 } while (Value);
93 return Size;
94}
95
Chris Lattneraf76e592009-08-22 20:48:53 +000096unsigned MCAsmInfo::getSLEB128Size(int Value) {
Anton Korobeynikovffe31d72008-08-16 12:57:46 +000097 unsigned Size = 0;
98 int Sign = Value >> (8 * sizeof(Value) - 1);
99 bool IsMore;
100
101 do {
102 unsigned Byte = Value & 0x7f;
103 Value >>= 7;
104 IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
105 Size += sizeof(int8_t);
106 } while (IsMore);
107 return Size;
108}