LLVM API Documentation
00001 //===-- TargetAsmInfo.cpp - Asm Info ---------------------------------------==// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines target asm properties related what form asm statements 00011 // should take. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #include "llvm/Target/TargetAsmInfo.h" 00016 #include <cctype> 00017 #include <cstring> 00018 using namespace llvm; 00019 00020 TargetAsmInfo::TargetAsmInfo() { 00021 ZeroFillDirective = 0; 00022 NonexecutableStackDirective = 0; 00023 NeedsSet = false; 00024 MaxInstLength = 4; 00025 PCSymbol = "$"; 00026 SeparatorChar = ';'; 00027 CommentColumn = 60; 00028 CommentString = "#"; 00029 GlobalPrefix = ""; 00030 PrivateGlobalPrefix = "."; 00031 LinkerPrivateGlobalPrefix = ""; 00032 JumpTableSpecialLabelPrefix = 0; 00033 GlobalVarAddrPrefix = ""; 00034 GlobalVarAddrSuffix = ""; 00035 FunctionAddrPrefix = ""; 00036 FunctionAddrSuffix = ""; 00037 PersonalityPrefix = ""; 00038 PersonalitySuffix = ""; 00039 NeedsIndirectEncoding = false; 00040 InlineAsmStart = "APP"; 00041 InlineAsmEnd = "NO_APP"; 00042 AssemblerDialect = 0; 00043 AllowQuotesInName = false; 00044 ZeroDirective = "\t.zero\t"; 00045 ZeroDirectiveSuffix = 0; 00046 AsciiDirective = "\t.ascii\t"; 00047 AscizDirective = "\t.asciz\t"; 00048 Data8bitsDirective = "\t.byte\t"; 00049 Data16bitsDirective = "\t.short\t"; 00050 Data32bitsDirective = "\t.long\t"; 00051 Data64bitsDirective = "\t.quad\t"; 00052 SunStyleELFSectionSwitchSyntax = false; 00053 UsesELFSectionDirectiveForBSS = false; 00054 AlignDirective = "\t.align\t"; 00055 AlignmentIsInBytes = true; 00056 TextAlignFillValue = 0; 00057 JumpTableDirective = 0; 00058 PICJumpTableDirective = 0; 00059 GlobalDirective = "\t.globl\t"; 00060 SetDirective = 0; 00061 LCOMMDirective = 0; 00062 COMMDirective = "\t.comm\t"; 00063 COMMDirectiveTakesAlignment = true; 00064 HasDotTypeDotSizeDirective = true; 00065 HasSingleParameterDotFile = true; 00066 UsedDirective = 0; 00067 WeakRefDirective = 0; 00068 WeakDefDirective = 0; 00069 // FIXME: These are ELFish - move to ELFTAI. 00070 HiddenDirective = "\t.hidden\t"; 00071 ProtectedDirective = "\t.protected\t"; 00072 AbsoluteDebugSectionOffsets = false; 00073 AbsoluteEHSectionOffsets = false; 00074 HasLEB128 = false; 00075 HasDotLocAndDotFile = false; 00076 SupportsDebugInformation = false; 00077 ExceptionsType = ExceptionHandling::None; 00078 DwarfRequiresFrameSection = true; 00079 DwarfUsesInlineInfoSection = false; 00080 Is_EHSymbolPrivate = true; 00081 GlobalEHDirective = 0; 00082 SupportsWeakOmittedEHFrame = true; 00083 DwarfSectionOffsetDirective = 0; 00084 00085 AsmTransCBE = 0; 00086 } 00087 00088 TargetAsmInfo::~TargetAsmInfo() { 00089 } 00090 00091 00092 unsigned TargetAsmInfo::getULEB128Size(unsigned Value) { 00093 unsigned Size = 0; 00094 do { 00095 Value >>= 7; 00096 Size += sizeof(int8_t); 00097 } while (Value); 00098 return Size; 00099 } 00100 00101 unsigned TargetAsmInfo::getSLEB128Size(int Value) { 00102 unsigned Size = 0; 00103 int Sign = Value >> (8 * sizeof(Value) - 1); 00104 bool IsMore; 00105 00106 do { 00107 unsigned Byte = Value & 0x7f; 00108 Value >>= 7; 00109 IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0; 00110 Size += sizeof(int8_t); 00111 } while (IsMore); 00112 return Size; 00113 }