1//===-- LanaiMCAsmInfo.cpp - Lanai asm properties -----------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains the declarations of the LanaiMCAsmInfo properties.
10//
11//===----------------------------------------------------------------------===//
12
13#include "LanaiMCAsmInfo.h"
14#include "llvm/MC/MCExpr.h"
15#include "llvm/Support/raw_ostream.h"
16#include "llvm/TargetParser/Triple.h"
17
18using namespace llvm;
19
20void LanaiMCAsmInfo::anchor() {}
21
22LanaiMCAsmInfo::LanaiMCAsmInfo(const Triple & /*TheTriple*/,
23 const MCTargetOptions &Options)
24 : MCAsmInfoELF(Options) {
25 IsLittleEndian = false;
26 InternalSymbolPrefix = ".L";
27 WeakRefDirective = "\t.weak\t";
28 ExceptionsType = ExceptionHandling::DwarfCFI;
29
30 // Lanai assembly requires ".section" before ".bss"
31 UsesELFSectionDirectiveForBSS = true;
32
33 // Use '!' as comment string to correspond with old toolchain.
34 CommentString = "!";
35
36 // Target supports emission of debugging information.
37 SupportsDebugInformation = true;
38
39 // Set the instruction alignment. Currently used only for address adjustment
40 // in dwarf generation.
41 MinInstAlignment = 4;
42}
43
44void LanaiMCAsmInfo::printSpecifierExpr(raw_ostream &OS,
45 const MCSpecifierExpr &Expr) const {
46 if (Expr.getSpecifier() == 0) {
47 printExpr(OS, *Expr.getSubExpr());
48 return;
49 }
50
51 switch (Expr.getSpecifier()) {
52 default:
53 llvm_unreachable("Invalid kind!");
54 case Lanai::S_ABS_HI:
55 OS << "hi";
56 break;
57 case Lanai::S_ABS_LO:
58 OS << "lo";
59 break;
60 }
61
62 OS << '(';
63 printExpr(OS, *Expr.getSubExpr());
64 OS << ')';
65}
66