MCAsmInfo.cpp revision 3d2251361171b1a41bdb2ac71882e69d48617f49
1//===-- MCAsmInfo.cpp - Asm Info -------------------------------------------==// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file defines target asm properties related what form asm statements 11// should take. 12// 13//===----------------------------------------------------------------------===// 14 15#include "llvm/MC/MCAsmInfo.h" 16#include "llvm/System/DataTypes.h" 17#include <cctype> 18#include <cstring> 19using namespace llvm; 20 21MCAsmInfo::MCAsmInfo() { 22 HasSubsectionsViaSymbols = false; 23 HasMachoZeroFillDirective = false; 24 HasStaticCtorDtorReferenceInStaticMode = false; 25 MaxInstLength = 4; 26 PCSymbol = "$"; 27 SeparatorChar = ';'; 28 CommentColumn = 40; 29 CommentString = "#"; 30 GlobalPrefix = ""; 31 PrivateGlobalPrefix = "."; 32 LinkerPrivateGlobalPrefix = ""; 33 InlineAsmStart = "APP"; 34 InlineAsmEnd = "NO_APP"; 35 AssemblerDialect = 0; 36 AllowQuotesInName = false; 37 AllowNameToStartWithDigit = false; 38 ZeroDirective = "\t.zero\t"; 39 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"; 45 SunStyleELFSectionSwitchSyntax = false; 46 UsesELFSectionDirectiveForBSS = false; 47 AlignDirective = "\t.align\t"; 48 AlignmentIsInBytes = true; 49 TextAlignFillValue = 0; 50 GPRel32Directive = 0; 51 GlobalDirective = "\t.globl\t"; 52 HasSetDirective = true; 53 HasLCOMMDirective = false; 54 COMMDirectiveAlignmentIsInBytes = true; 55 HasDotTypeDotSizeDirective = true; 56 HasSingleParameterDotFile = true; 57 HasNoDeadStrip = false; 58 WeakRefDirective = 0; 59 WeakDefDirective = 0; 60 LinkOnceDirective = 0; 61 HiddenVisibilityAttr = MCSA_Hidden; 62 ProtectedVisibilityAttr = MCSA_Protected; 63 HasLEB128 = false; 64 HasDotLocAndDotFile = false; 65 SupportsDebugInformation = false; 66 ExceptionsType = ExceptionHandling::None; 67 DwarfRequiresFrameSection = true; 68 DwarfUsesInlineInfoSection = false; 69 DwarfSectionOffsetDirective = 0; 70 HasMicrosoftFastStdCallMangling = false; 71 72 AsmTransCBE = 0; 73} 74 75MCAsmInfo::~MCAsmInfo() { 76} 77 78 79unsigned MCAsmInfo::getULEB128Size(unsigned Value) { 80 unsigned Size = 0; 81 do { 82 Value >>= 7; 83 Size += sizeof(int8_t); 84 } while (Value); 85 return Size; 86} 87 88unsigned MCAsmInfo::getSLEB128Size(int Value) { 89 unsigned Size = 0; 90 int Sign = Value >> (8 * sizeof(Value) - 1); 91 bool IsMore; 92 93 do { 94 unsigned Byte = Value & 0x7f; 95 Value >>= 7; 96 IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0; 97 Size += sizeof(int8_t); 98 } while (IsMore); 99 return Size; 100} 101