172062f5744557e270a38192554c3126ea5f97434Tim Northover//===-- AArch64MCAsmInfo.cpp - AArch64 asm properties ---------------------===// 272062f5744557e270a38192554c3126ea5f97434Tim Northover// 372062f5744557e270a38192554c3126ea5f97434Tim Northover// The LLVM Compiler Infrastructure 472062f5744557e270a38192554c3126ea5f97434Tim Northover// 572062f5744557e270a38192554c3126ea5f97434Tim Northover// This file is distributed under the University of Illinois Open Source 672062f5744557e270a38192554c3126ea5f97434Tim Northover// License. See LICENSE.TXT for details. 772062f5744557e270a38192554c3126ea5f97434Tim Northover// 872062f5744557e270a38192554c3126ea5f97434Tim Northover//===----------------------------------------------------------------------===// 972062f5744557e270a38192554c3126ea5f97434Tim Northover// 1072062f5744557e270a38192554c3126ea5f97434Tim Northover// This file contains the declarations of the AArch64MCAsmInfo properties. 1172062f5744557e270a38192554c3126ea5f97434Tim Northover// 1272062f5744557e270a38192554c3126ea5f97434Tim Northover//===----------------------------------------------------------------------===// 1372062f5744557e270a38192554c3126ea5f97434Tim Northover 1472062f5744557e270a38192554c3126ea5f97434Tim Northover#include "AArch64MCAsmInfo.h" 1536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines#include "llvm/ADT/Triple.h" 16dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines#include "llvm/MC/MCContext.h" 1737ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines#include "llvm/MC/MCExpr.h" 18dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines#include "llvm/MC/MCStreamer.h" 19dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines#include "llvm/Support/CommandLine.h" 2072062f5744557e270a38192554c3126ea5f97434Tim Northoverusing namespace llvm; 2172062f5744557e270a38192554c3126ea5f97434Tim Northover 22dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hinesenum AsmWriterVariantTy { 23dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines Default = -1, 24dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines Generic = 0, 25dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines Apple = 1 26dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines}; 27dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 28dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hinesstatic cl::opt<AsmWriterVariantTy> AsmWriterVariant( 29dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines "aarch64-neon-syntax", cl::init(Default), 30dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines cl::desc("Choose style of NEON code to emit from AArch64 backend:"), 31dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines cl::values(clEnumValN(Generic, "generic", "Emit generic NEON assembly"), 32dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines clEnumValN(Apple, "apple", "Emit Apple-style NEON assembly"), 33dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines clEnumValEnd)); 34dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 35dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen HinesAArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin() { 36dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines // We prefer NEON instructions to be printed in the short form. 37dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines AssemblerDialect = AsmWriterVariant == Default ? 1 : AsmWriterVariant; 38dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 39dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines PrivateGlobalPrefix = "L"; 40ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines PrivateLabelPrefix = "L"; 41dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines SeparatorString = "%%"; 42dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines CommentString = ";"; 43dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines PointerSize = CalleeSaveStackSlotSize = 8; 44dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 45dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines AlignmentIsInBytes = false; 46dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines UsesELFSectionDirectiveForBSS = true; 47dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines SupportsDebugInformation = true; 48dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines UseDataRegionDirectives = true; 49dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 50dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines ExceptionsType = ExceptionHandling::DwarfCFI; 51dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines} 52dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 53dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hinesconst MCExpr *AArch64MCAsmInfoDarwin::getExprForPersonalitySymbol( 54dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const { 55dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines // On Darwin, we can reference dwarf symbols with foo@GOT-., which 56dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines // is an indirect pc-relative reference. The default implementation 57dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines // won't reference using the GOT, so we need this target-specific 58dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines // version. 59dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines MCContext &Context = Streamer.getContext(); 60dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines const MCExpr *Res = 616948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOT, Context); 626948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar MCSymbol *PCSym = Context.createTempSymbol(); 63dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines Streamer.EmitLabel(PCSym); 646948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar const MCExpr *PC = MCSymbolRefExpr::create(PCSym, Context); 656948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar return MCBinaryExpr::createSub(Res, PC, Context); 66dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines} 67dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 686948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga NainarAArch64MCAsmInfoELF::AArch64MCAsmInfoELF(const Triple &T) { 6937ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines if (T.getArch() == Triple::aarch64_be) 7036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines IsLittleEndian = false; 7136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 72dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines // We prefer NEON instructions to be printed in the short form. 73dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines AssemblerDialect = AsmWriterVariant == Default ? 0 : AsmWriterVariant; 74dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 7572062f5744557e270a38192554c3126ea5f97434Tim Northover PointerSize = 8; 7672062f5744557e270a38192554c3126ea5f97434Tim Northover 7772062f5744557e270a38192554c3126ea5f97434Tim Northover // ".comm align is in bytes but .align is pow-2." 7872062f5744557e270a38192554c3126ea5f97434Tim Northover AlignmentIsInBytes = false; 7972062f5744557e270a38192554c3126ea5f97434Tim Northover 8072062f5744557e270a38192554c3126ea5f97434Tim Northover CommentString = "//"; 81dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines PrivateGlobalPrefix = ".L"; 82ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines PrivateLabelPrefix = ".L"; 8372062f5744557e270a38192554c3126ea5f97434Tim Northover Code32Directive = ".code\t32"; 8472062f5744557e270a38192554c3126ea5f97434Tim Northover 8572062f5744557e270a38192554c3126ea5f97434Tim Northover Data16bitsDirective = "\t.hword\t"; 8672062f5744557e270a38192554c3126ea5f97434Tim Northover Data32bitsDirective = "\t.word\t"; 8772062f5744557e270a38192554c3126ea5f97434Tim Northover Data64bitsDirective = "\t.xword\t"; 8872062f5744557e270a38192554c3126ea5f97434Tim Northover 89dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines UseDataRegionDirectives = false; 90dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 91dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines WeakRefDirective = "\t.weak\t"; 92dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 9372062f5744557e270a38192554c3126ea5f97434Tim Northover SupportsDebugInformation = true; 9472062f5744557e270a38192554c3126ea5f97434Tim Northover 9572062f5744557e270a38192554c3126ea5f97434Tim Northover // Exceptions handling 9672062f5744557e270a38192554c3126ea5f97434Tim Northover ExceptionsType = ExceptionHandling::DwarfCFI; 9736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 9836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines UseIntegratedAssembler = true; 99c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines 100c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines HasIdentDirective = true; 10172062f5744557e270a38192554c3126ea5f97434Tim Northover} 102