LCOV - code coverage report
Current view: top level - lib/Target/AArch64/MCTargetDesc - AArch64MCAsmInfo.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 57 63 90.5 %
Date: 2018-10-20 13:21:21 Functions: 4 5 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- AArch64MCAsmInfo.cpp - AArch64 asm properties ---------------------===//
       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 contains the declarations of the AArch64MCAsmInfo properties.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #include "AArch64MCAsmInfo.h"
      15             : #include "llvm/ADT/Triple.h"
      16             : #include "llvm/MC/MCContext.h"
      17             : #include "llvm/MC/MCExpr.h"
      18             : #include "llvm/MC/MCStreamer.h"
      19             : #include "llvm/Support/CommandLine.h"
      20             : using namespace llvm;
      21             : 
      22             : enum AsmWriterVariantTy {
      23             :   Default = -1,
      24             :   Generic = 0,
      25             :   Apple = 1
      26             : };
      27             : 
      28             : static cl::opt<AsmWriterVariantTy> AsmWriterVariant(
      29             :     "aarch64-neon-syntax", cl::init(Default),
      30             :     cl::desc("Choose style of NEON code to emit from AArch64 backend:"),
      31             :     cl::values(clEnumValN(Generic, "generic", "Emit generic NEON assembly"),
      32             :                clEnumValN(Apple, "apple", "Emit Apple-style NEON assembly")));
      33             : 
      34         525 : AArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin() {
      35             :   // We prefer NEON instructions to be printed in the short, Apple-specific
      36             :   // form when targeting Darwin.
      37         525 :   AssemblerDialect = AsmWriterVariant == Default ? Apple : AsmWriterVariant;
      38             : 
      39         525 :   PrivateGlobalPrefix = "L";
      40         525 :   PrivateLabelPrefix = "L";
      41         525 :   SeparatorString = "%%";
      42         525 :   CommentString = ";";
      43         525 :   CodePointerSize = CalleeSaveStackSlotSize = 8;
      44             : 
      45         525 :   AlignmentIsInBytes = false;
      46         525 :   UsesELFSectionDirectiveForBSS = true;
      47         525 :   SupportsDebugInformation = true;
      48         525 :   UseDataRegionDirectives = true;
      49             : 
      50         525 :   ExceptionsType = ExceptionHandling::DwarfCFI;
      51         525 : }
      52             : 
      53           0 : const MCExpr *AArch64MCAsmInfoDarwin::getExprForPersonalitySymbol(
      54             :     const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const {
      55             :   // On Darwin, we can reference dwarf symbols with foo@GOT-., which
      56             :   // is an indirect pc-relative reference. The default implementation
      57             :   // won't reference using the GOT, so we need this target-specific
      58             :   // version.
      59           0 :   MCContext &Context = Streamer.getContext();
      60             :   const MCExpr *Res =
      61           0 :       MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOT, Context);
      62           0 :   MCSymbol *PCSym = Context.createTempSymbol();
      63           0 :   Streamer.EmitLabel(PCSym);
      64             :   const MCExpr *PC = MCSymbolRefExpr::create(PCSym, Context);
      65           0 :   return MCBinaryExpr::createSub(Res, PC, Context);
      66             : }
      67             : 
      68        4360 : AArch64MCAsmInfoELF::AArch64MCAsmInfoELF(const Triple &T) {
      69        4360 :   if (T.getArch() == Triple::aarch64_be)
      70          43 :     IsLittleEndian = false;
      71             : 
      72             :   // We prefer NEON instructions to be printed in the generic form when
      73             :   // targeting ELF.
      74        4360 :   AssemblerDialect = AsmWriterVariant == Default ? Generic : AsmWriterVariant;
      75             : 
      76        4360 :   CodePointerSize = 8;
      77             : 
      78             :   // ".comm align is in bytes but .align is pow-2."
      79        4360 :   AlignmentIsInBytes = false;
      80             : 
      81        4360 :   CommentString = "//";
      82        4360 :   PrivateGlobalPrefix = ".L";
      83        4360 :   PrivateLabelPrefix = ".L";
      84        4360 :   Code32Directive = ".code\t32";
      85             : 
      86        4360 :   Data16bitsDirective = "\t.hword\t";
      87        4360 :   Data32bitsDirective = "\t.word\t";
      88        4360 :   Data64bitsDirective = "\t.xword\t";
      89             : 
      90        4360 :   UseDataRegionDirectives = false;
      91             : 
      92        4360 :   WeakRefDirective = "\t.weak\t";
      93             : 
      94        4360 :   SupportsDebugInformation = true;
      95             : 
      96             :   // Exceptions handling
      97        4360 :   ExceptionsType = ExceptionHandling::DwarfCFI;
      98             : 
      99        4360 :   UseIntegratedAssembler = true;
     100             : 
     101        4360 :   HasIdentDirective = true;
     102        4360 : }
     103             : 
     104          40 : AArch64MCAsmInfoMicrosoftCOFF::AArch64MCAsmInfoMicrosoftCOFF() {
     105          40 :   PrivateGlobalPrefix = ".L";
     106          40 :   PrivateLabelPrefix = ".L";
     107             : 
     108          40 :   Data16bitsDirective = "\t.hword\t";
     109          40 :   Data32bitsDirective = "\t.word\t";
     110          40 :   Data64bitsDirective = "\t.xword\t";
     111             : 
     112          40 :   AlignmentIsInBytes = false;
     113          40 :   SupportsDebugInformation = true;
     114          40 :   CodePointerSize = 8;
     115             : 
     116          40 :   CommentString = ";";
     117          40 :   ExceptionsType = ExceptionHandling::WinEH;
     118          40 : }
     119             : 
     120          14 : AArch64MCAsmInfoGNUCOFF::AArch64MCAsmInfoGNUCOFF() {
     121          14 :   PrivateGlobalPrefix = ".L";
     122          14 :   PrivateLabelPrefix = ".L";
     123             : 
     124          14 :   Data16bitsDirective = "\t.hword\t";
     125          14 :   Data32bitsDirective = "\t.word\t";
     126          14 :   Data64bitsDirective = "\t.xword\t";
     127             : 
     128          14 :   AlignmentIsInBytes = false;
     129          14 :   SupportsDebugInformation = true;
     130          14 :   CodePointerSize = 8;
     131             : 
     132          14 :   CommentString = "//";
     133          14 :   ExceptionsType = ExceptionHandling::DwarfCFI;
     134          14 : }

Generated by: LCOV version 1.13