blob: 74bacfc9d3f290df5f966c164d07ff6dae9e8fb1 [file] [log] [blame]
Chris Lattner7b26fce2009-08-22 20:48:53 +00001//===-- MCAsmInfo.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
Chris Lattner7b26fce2009-08-22 20:48:53 +000015#include "llvm/MC/MCAsmInfo.h"
Chandler Carruth56869f22009-10-26 01:35:46 +000016#include "llvm/System/DataTypes.h"
Dale Johannesen0a1069d2007-04-23 20:00:17 +000017#include <cctype>
18#include <cstring>
Jim Laskey681ecbb2006-09-06 18:35:33 +000019using namespace llvm;
20
Chris Lattner2b4364f2010-01-20 06:34:14 +000021MCAsmInfo::MCAsmInfo() {
Chris Lattner76bdea32010-01-23 07:21:06 +000022 HasSubsectionsViaSymbols = false;
Chris Lattner1d371882010-01-19 02:09:44 +000023 HasMachoZeroFillDirective = false;
Chris Lattnere9d28b12010-01-19 04:34:02 +000024 HasStaticCtorDtorReferenceInStaticMode = false;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000025 MaxInstLength = 4;
26 PCSymbol = "$";
27 SeparatorChar = ';';
David Greenede544782009-07-13 20:25:48 +000028 CommentColumn = 60;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000029 CommentString = "#";
30 GlobalPrefix = "";
31 PrivateGlobalPrefix = ".";
Chris Lattner1177cee2009-07-21 17:30:51 +000032 LinkerPrivateGlobalPrefix = "";
Chris Lattnerabdcbc72009-08-11 22:39:40 +000033 InlineAsmStart = "APP";
34 InlineAsmEnd = "NO_APP";
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000035 AssemblerDialect = 0;
Chris Lattnerb8476452009-06-18 23:41:35 +000036 AllowQuotesInName = false;
Anton Korobeynikov592638a2009-09-18 16:57:42 +000037 AllowNameToStartWithDigit = false;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000038 ZeroDirective = "\t.zero\t";
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000039 AsciiDirective = "\t.ascii\t";
40 AscizDirective = "\t.asciz\t";
41 Data8bitsDirective = "\t.byte\t";
42 Data16bitsDirective = "\t.short\t";
43 Data32bitsDirective = "\t.long\t";
44 Data64bitsDirective = "\t.quad\t";
Chris Lattnerc9ea8fd2009-08-08 20:43:12 +000045 SunStyleELFSectionSwitchSyntax = false;
Bruno Cardoso Lopes62e6a8b2009-08-13 23:30:21 +000046 UsesELFSectionDirectiveForBSS = false;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000047 AlignDirective = "\t.align\t";
48 AlignmentIsInBytes = true;
49 TextAlignFillValue = 0;
Chris Lattner19bd0392010-01-25 21:10:10 +000050 GPRel32Directive = 0;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000051 GlobalDirective = "\t.globl\t";
Chris Lattnerff234e02010-01-26 20:40:54 +000052 HasSetDirective = true;
Chris Lattnerb1301f72010-01-23 07:47:02 +000053 HasLCOMMDirective = false;
Rafael Espindoladcb03f02010-01-26 20:21:43 +000054 COMMDirectiveAlignmentIsInBytes = true;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000055 HasDotTypeDotSizeDirective = true;
Rafael Espindolacda011b2008-12-03 11:01:37 +000056 HasSingleParameterDotFile = true;
Chris Lattner1deb09c2010-01-23 05:51:36 +000057 HasNoDeadStrip = false;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000058 WeakRefDirective = 0;
59 WeakDefDirective = 0;
Chris Lattnerb1f29342010-01-19 05:08:13 +000060 LinkOnceDirective = 0;
Chris Lattner0bfd2792010-01-23 06:53:23 +000061 HiddenVisibilityAttr = MCSA_Hidden;
62 ProtectedVisibilityAttr = MCSA_Protected;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000063 AbsoluteDebugSectionOffsets = false;
64 AbsoluteEHSectionOffsets = false;
65 HasLEB128 = false;
66 HasDotLocAndDotFile = false;
67 SupportsDebugInformation = false;
Jim Grosbach693e36a2009-08-11 00:09:57 +000068 ExceptionsType = ExceptionHandling::None;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000069 DwarfRequiresFrameSection = true;
Devang Patel80be3512009-04-13 17:02:03 +000070 DwarfUsesInlineInfoSection = false;
Chris Lattnere79b2bc2009-07-17 20:46:40 +000071 Is_EHSymbolPrivate = true;
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000072 GlobalEHDirective = 0;
73 SupportsWeakOmittedEHFrame = true;
74 DwarfSectionOffsetDirective = 0;
Chris Lattner1472cf52009-08-02 07:24:22 +000075
Anton Korobeynikov87001fd2008-09-25 21:00:33 +000076 AsmTransCBE = 0;
Chris Lattner95129a72006-10-13 17:50:07 +000077}
Chris Lattnerafe6d7a2006-10-05 00:35:16 +000078
Chris Lattner7b26fce2009-08-22 20:48:53 +000079MCAsmInfo::~MCAsmInfo() {
Chris Lattnerafe6d7a2006-10-05 00:35:16 +000080}
Chris Lattner95129a72006-10-13 17:50:07 +000081
Anton Korobeynikov942fda02007-03-07 02:47:57 +000082
Chris Lattner7b26fce2009-08-22 20:48:53 +000083unsigned MCAsmInfo::getULEB128Size(unsigned Value) {
Anton Korobeynikovbd890b12008-08-16 12:57:46 +000084 unsigned Size = 0;
85 do {
86 Value >>= 7;
87 Size += sizeof(int8_t);
88 } while (Value);
89 return Size;
90}
91
Chris Lattner7b26fce2009-08-22 20:48:53 +000092unsigned MCAsmInfo::getSLEB128Size(int Value) {
Anton Korobeynikovbd890b12008-08-16 12:57:46 +000093 unsigned Size = 0;
94 int Sign = Value >> (8 * sizeof(Value) - 1);
95 bool IsMore;
96
97 do {
98 unsigned Byte = Value & 0x7f;
99 Value >>= 7;
100 IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
101 Size += sizeof(int8_t);
102 } while (IsMore);
103 return Size;
104}