| 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 | |
| 18 | using namespace llvm; |
| 19 | |
| 20 | void LanaiMCAsmInfo::anchor() {} |
| 21 | |
| 22 | LanaiMCAsmInfo::LanaiMCAsmInfo(const Triple & /*TheTriple*/, |
| 23 | const MCTargetOptions &Options) { |
| 24 | IsLittleEndian = false; |
| 25 | PrivateGlobalPrefix = ".L"; |
| 26 | WeakRefDirective = "\t.weak\t"; |
| 27 | ExceptionsType = ExceptionHandling::DwarfCFI; |
| 28 | |
| 29 | // Lanai assembly requires ".section" before ".bss" |
| 30 | UsesELFSectionDirectiveForBSS = true; |
| 31 | |
| 32 | // Use '!' as comment string to correspond with old toolchain. |
| 33 | CommentString = "!"; |
| 34 | |
| 35 | // Target supports emission of debugging information. |
| 36 | SupportsDebugInformation = true; |
| 37 | |
| 38 | // Set the instruction alignment. Currently used only for address adjustment |
| 39 | // in dwarf generation. |
| 40 | MinInstAlignment = 4; |
| 41 | } |
| 42 | |
| 43 | void LanaiMCAsmInfo::printSpecifierExpr(raw_ostream &OS, |
| 44 | const MCSpecifierExpr &Expr) const { |
| 45 | if (Expr.getSpecifier() == 0) { |
| 46 | printExpr(OS, *Expr.getSubExpr()); |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | switch (Expr.getSpecifier()) { |
| 51 | default: |
| 52 | llvm_unreachable("Invalid kind!"); |
| 53 | case Lanai::S_ABS_HI: |
| 54 | OS << "hi"; |
| 55 | break; |
| 56 | case Lanai::S_ABS_LO: |
| 57 | OS << "lo"; |
| 58 | break; |
| 59 | } |
| 60 | |
| 61 | OS << '('; |
| 62 | printExpr(OS, *Expr.getSubExpr()); |
| 63 | OS << ')'; |
| 64 | } |
| 65 |