mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-30 17:33:24 +00:00
7b837d8c75
This adds a second implementation of the AArch64 architecture to LLVM, accessible in parallel via the "arm64" triple. The plan over the coming weeks & months is to merge the two into a single backend, during which time thorough code review should naturally occur. Everything will be easier with the target in-tree though, hence this commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205090 91177308-0d34-0410-b5e6-96231b3b80d8
93 lines
2.9 KiB
C++
93 lines
2.9 KiB
C++
//===-- ARM64MCAsmInfo.cpp - ARM64 asm properties -----------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file contains the declarations of the ARM64MCAsmInfo properties.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "ARM64MCAsmInfo.h"
|
|
#include "llvm/MC/MCExpr.h"
|
|
#include "llvm/MC/MCContext.h"
|
|
#include "llvm/MC/MCStreamer.h"
|
|
#include "llvm/Support/CommandLine.h"
|
|
using namespace llvm;
|
|
|
|
enum AsmWriterVariantTy {
|
|
Default = -1,
|
|
Generic = 0,
|
|
Apple = 1
|
|
};
|
|
|
|
static cl::opt<AsmWriterVariantTy> AsmWriterVariant(
|
|
"arm64-neon-syntax", cl::init(Default),
|
|
cl::desc("Choose style of NEON code to emit from ARM64 backend:"),
|
|
cl::values(clEnumValN(Generic, "generic", "Emit generic NEON assembly"),
|
|
clEnumValN(Apple, "apple", "Emit Apple-style NEON assembly"),
|
|
clEnumValEnd));
|
|
|
|
ARM64MCAsmInfoDarwin::ARM64MCAsmInfoDarwin() {
|
|
// We prefer NEON instructions to be printed in the short form.
|
|
AssemblerDialect = AsmWriterVariant == Default ? 1 : AsmWriterVariant;
|
|
|
|
PrivateGlobalPrefix = "L";
|
|
SeparatorString = "%%";
|
|
CommentString = ";";
|
|
PointerSize = CalleeSaveStackSlotSize = 8;
|
|
|
|
AlignmentIsInBytes = false;
|
|
UsesELFSectionDirectiveForBSS = true;
|
|
SupportsDebugInformation = true;
|
|
UseDataRegionDirectives = true;
|
|
|
|
ExceptionsType = ExceptionHandling::DwarfCFI;
|
|
}
|
|
|
|
const MCExpr *ARM64MCAsmInfoDarwin::getExprForPersonalitySymbol(
|
|
const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const {
|
|
// On Darwin, we can reference dwarf symbols with foo@GOT-., which
|
|
// is an indirect pc-relative reference. The default implementation
|
|
// won't reference using the GOT, so we need this target-specific
|
|
// version.
|
|
MCContext &Context = Streamer.getContext();
|
|
const MCExpr *Res =
|
|
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOT, Context);
|
|
MCSymbol *PCSym = Context.CreateTempSymbol();
|
|
Streamer.EmitLabel(PCSym);
|
|
const MCExpr *PC = MCSymbolRefExpr::Create(PCSym, Context);
|
|
return MCBinaryExpr::CreateSub(Res, PC, Context);
|
|
}
|
|
|
|
ARM64MCAsmInfoELF::ARM64MCAsmInfoELF() {
|
|
// We prefer NEON instructions to be printed in the short form.
|
|
AssemblerDialect = AsmWriterVariant == Default ? 0 : AsmWriterVariant;
|
|
|
|
PointerSize = 8;
|
|
|
|
// ".comm align is in bytes but .align is pow-2."
|
|
AlignmentIsInBytes = false;
|
|
|
|
CommentString = "//";
|
|
PrivateGlobalPrefix = ".L";
|
|
Code32Directive = ".code\t32";
|
|
|
|
Data16bitsDirective = "\t.hword\t";
|
|
Data32bitsDirective = "\t.word\t";
|
|
Data64bitsDirective = "\t.xword\t";
|
|
|
|
UseDataRegionDirectives = false;
|
|
|
|
WeakRefDirective = "\t.weak\t";
|
|
|
|
HasLEB128 = true;
|
|
SupportsDebugInformation = true;
|
|
|
|
// Exceptions handling
|
|
ExceptionsType = ExceptionHandling::DwarfCFI;
|
|
}
|