| 1 | //===-- AVRMCAsmInfo.h - AVR asm properties ---------------------*- C++ -*-===// |
| 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 declaration of the AVRMCAsmInfo class. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef LLVM_AVR_ASM_INFO_H |
| 14 | #define LLVM_AVR_ASM_INFO_H |
| 15 | |
| 16 | #include "MCTargetDesc/AVRMCExpr.h" |
| 17 | #include "llvm/MC/MCAsmInfo.h" |
| 18 | #include "llvm/MC/MCExpr.h" |
| 19 | |
| 20 | namespace llvm { |
| 21 | |
| 22 | class Triple; |
| 23 | |
| 24 | /// Specifies the format of AVR assembly files. |
| 25 | class AVRMCAsmInfo : public MCAsmInfo { |
| 26 | public: |
| 27 | explicit AVRMCAsmInfo(const Triple &TT, const MCTargetOptions &Options); |
| 28 | void printSpecifierExpr(raw_ostream &OS, |
| 29 | const MCSpecifierExpr &Expr) const override; |
| 30 | bool evaluateAsRelocatableImpl(const MCSpecifierExpr &Expr, MCValue &Res, |
| 31 | const MCAssembler *Asm) const override; |
| 32 | }; |
| 33 | |
| 34 | namespace AVR { |
| 35 | using Specifier = uint16_t; |
| 36 | enum { |
| 37 | S_None, |
| 38 | |
| 39 | S_AVR_NONE = MCSymbolRefExpr::FirstTargetSpecifier, |
| 40 | |
| 41 | S_HI8, ///< Corresponds to `hi8()`. |
| 42 | S_LO8, ///< Corresponds to `lo8()`. |
| 43 | S_HH8, ///< Corresponds to `hlo8() and hh8()`. |
| 44 | S_HHI8, ///< Corresponds to `hhi8()`. |
| 45 | |
| 46 | S_PM, ///< Corresponds to `pm()`, reference to program memory. |
| 47 | S_PM_LO8, ///< Corresponds to `pm_lo8()`. |
| 48 | S_PM_HI8, ///< Corresponds to `pm_hi8()`. |
| 49 | S_PM_HH8, ///< Corresponds to `pm_hh8()`. |
| 50 | |
| 51 | S_LO8_GS, ///< Corresponds to `lo8(gs())`. |
| 52 | S_HI8_GS, ///< Corresponds to `hi8(gs())`. |
| 53 | S_GS, ///< Corresponds to `gs()`. |
| 54 | |
| 55 | S_DIFF8, |
| 56 | S_DIFF16, |
| 57 | S_DIFF32, |
| 58 | }; |
| 59 | } // namespace AVR |
| 60 | |
| 61 | } // end namespace llvm |
| 62 | |
| 63 | #endif // LLVM_AVR_ASM_INFO_H |
| 64 | |