X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FMC%2FMCAsmInfo.cpp;h=84e4075621beac2d51af2faacf9611d825bf9f55;hb=0a230e0d985625a3909cb78fd867a3abaf434565;hp=873802ae9806c2deab98120c799385005a589c92;hpb=bfa27cc5d72e061a96efbb461864d40bc8089ec2;p=oota-llvm.git diff --git a/lib/MC/MCAsmInfo.cpp b/lib/MC/MCAsmInfo.cpp index 873802ae980..84e4075621b 100644 --- a/lib/MC/MCAsmInfo.cpp +++ b/lib/MC/MCAsmInfo.cpp @@ -13,34 +13,48 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCStreamer.h" #include "llvm/Support/DataTypes.h" +#include "llvm/Support/Dwarf.h" #include #include using namespace llvm; MCAsmInfo::MCAsmInfo() { + PointerSize = 4; + CalleeSaveStackSlotSize = 4; + + IsLittleEndian = true; + StackGrowsUp = false; HasSubsectionsViaSymbols = false; HasMachoZeroFillDirective = false; HasMachoTBSSDirective = false; HasStaticCtorDtorReferenceInStaticMode = false; LinkerRequiresNonEmptyDwarfLines = false; MaxInstLength = 4; + MinInstAlignment = 1; PCSymbol = "$"; SeparatorString = ";"; CommentColumn = 40; CommentString = "#"; LabelSuffix = ":"; + DebugLabelSuffix = ":"; GlobalPrefix = ""; PrivateGlobalPrefix = "."; LinkerPrivateGlobalPrefix = ""; InlineAsmStart = "APP"; InlineAsmEnd = "NO_APP"; + Code16Directive = ".code16"; + Code32Directive = ".code32"; + Code64Directive = ".code64"; AssemblerDialect = 0; AllowQuotesInName = false; AllowNameToStartWithDigit = false; AllowPeriodsInName = true; + AllowUTF8 = true; + UseDataRegionDirectives = false; ZeroDirective = "\t.zero\t"; AsciiDirective = "\t.ascii\t"; AscizDirective = "\t.asciz\t"; @@ -53,12 +67,13 @@ MCAsmInfo::MCAsmInfo() { AlignDirective = "\t.align\t"; AlignmentIsInBytes = true; TextAlignFillValue = 0; + GPRel64Directive = 0; GPRel32Directive = 0; GlobalDirective = "\t.globl\t"; HasSetDirective = true; HasAggressiveSymbolFolding = true; - HasLCOMMDirective = false; COMMDirectiveAlignmentIsInBytes = true; + LCOMMDirectiveAlignmentType = LCOMM::NoAlignment; HasDotTypeDotSizeDirective = true; HasSingleParameterDotFile = true; HasNoDeadStrip = false; @@ -72,21 +87,18 @@ MCAsmInfo::MCAsmInfo() { HasLEB128 = false; SupportsDebugInformation = false; ExceptionsType = ExceptionHandling::None; - DwarfRequiresFrameSection = true; DwarfUsesInlineInfoSection = false; - DwarfUsesAbsoluteLabelForStmtList = true; - DwarfSectionOffsetDirective = 0; - DwarfUsesLabelOffsetForRanges = true; + DwarfUsesRelocationsAcrossSections = true; + DwarfRegNumForCFI = false; HasMicrosoftFastStdCallMangling = false; - - AsmTransCBE = 0; + NeedsDwarfSectionOffsetDirective = false; } MCAsmInfo::~MCAsmInfo() { } -unsigned MCAsmInfo::getULEB128Size(unsigned Value) { +unsigned MCAsmInfo::getULEB128Size(uint64_t Value) { unsigned Size = 0; do { Value >>= 7; @@ -95,7 +107,7 @@ unsigned MCAsmInfo::getULEB128Size(unsigned Value) { return Size; } -unsigned MCAsmInfo::getSLEB128Size(int Value) { +unsigned MCAsmInfo::getSLEB128Size(int64_t Value) { unsigned Size = 0; int Sign = Value >> (8 * sizeof(Value) - 1); bool IsMore; @@ -111,6 +123,22 @@ unsigned MCAsmInfo::getSLEB128Size(int Value) { const MCExpr * MCAsmInfo::getExprForPersonalitySymbol(const MCSymbol *Sym, + unsigned Encoding, MCStreamer &Streamer) const { - return MCSymbolRefExpr::Create(Sym, Streamer.getContext()); + return getExprForFDESymbol(Sym, Encoding, Streamer); +} + +const MCExpr * +MCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym, + unsigned Encoding, + MCStreamer &Streamer) const { + if (!(Encoding & dwarf::DW_EH_PE_pcrel)) + return MCSymbolRefExpr::Create(Sym, Streamer.getContext()); + + MCContext &Context = Streamer.getContext(); + const MCExpr *Res = MCSymbolRefExpr::Create(Sym, Context); + MCSymbol *PCSym = Context.CreateTempSymbol(); + Streamer.EmitLabel(PCSym); + const MCExpr *PC = MCSymbolRefExpr::Create(PCSym, Context); + return MCBinaryExpr::CreateSub(Res, PC, Context); }