LLVM 22.0.0git
AVRMCExpr.h
Go to the documentation of this file.
1//===-- AVRMCExpr.h - AVR specific MC expression classes --------*- 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#ifndef LLVM_AVR_MCEXPR_H
10#define LLVM_AVR_MCEXPR_H
11
12#include "llvm/MC/MCExpr.h"
13
15
16namespace llvm {
17
18/// A expression in AVR machine code.
19class AVRMCExpr : public MCSpecifierExpr {
20public:
21 friend class AVRMCAsmInfo;
22 using Specifier = Spec;
23 /// Specifies the type of an expression.
24
25public:
26 /// Creates an AVR machine code expression.
27 static const AVRMCExpr *create(Specifier S, const MCExpr *Expr,
28 bool isNegated, MCContext &Ctx);
29
30 /// Gets the name of the expression.
31 const char *getName() const;
32 /// Gets the fixup which corresponds to the expression.
34 /// Evaluates the fixup as a constant value.
35 bool evaluateAsConstant(int64_t &Result) const;
36
37 bool isNegated() const { return Negated; }
38 void setNegated(bool negated = true) { Negated = negated; }
39
40public:
42
43private:
44 int64_t evaluateAsInt64(int64_t Value) const;
45
46 bool Negated;
47
48private:
49 explicit AVRMCExpr(Specifier S, const MCExpr *Expr, bool Negated)
50 : MCSpecifierExpr(Expr, S), Negated(Negated) {}
51};
52
53} // end namespace llvm
54
55#endif // LLVM_AVR_MCEXPR_H
std::string Name
static std::optional< int64_t > evaluateAsInt64(uint16_t specifier, int64_t Value)
Specifies the format of AVR assembly files.
Definition: AVRMCAsmInfo.h:25
A expression in AVR machine code.
Definition: AVRMCExpr.h:19
bool evaluateAsConstant(int64_t &Result) const
Evaluates the fixup as a constant value.
void setNegated(bool negated=true)
Definition: AVRMCExpr.h:38
static const AVRMCExpr * create(Specifier S, const MCExpr *Expr, bool isNegated, MCContext &Ctx)
Specifies the type of an expression.
Definition: AVRMCExpr.cpp:17
bool isNegated() const
Definition: AVRMCExpr.h:37
const char * getName() const
Gets the name of the expression.
static Specifier parseSpecifier(StringRef Name)
AVR::Fixups getFixupKind() const
Gets the fixup which corresponds to the expression.
Context object for machine code objects.
Definition: MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:34
Extension point for target-specific MCExpr subclasses with a relocation specifier,...
Definition: MCExpr.h:495
const MCExpr * Expr
Definition: MCExpr.h:497
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
LLVM Value Representation.
Definition: Value.h:75
Fixups
The set of supported fixups.
Definition: AVRFixupKinds.h:26
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18