LLVM 19.0.0git
X86MCExpr.h
Go to the documentation of this file.
1//=--- X86MCExpr.h - X86 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// This file describes X86-specific MCExprs, i.e, registers used for
10// extended variable assignments.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCEXPR_H
15#define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCEXPR_H
16
17#include "X86ATTInstPrinter.h"
18#include "llvm/MC/MCAsmInfo.h"
19#include "llvm/MC/MCContext.h"
20#include "llvm/MC/MCExpr.h"
23
24namespace llvm {
25
26class X86MCExpr : public MCTargetExpr {
27
28private:
29 const int64_t RegNo; // All
30
31 explicit X86MCExpr(int64_t R) : RegNo(R) {}
32
33public:
34 /// @name Construction
35 /// @{
36
37 static const X86MCExpr *create(int64_t RegNo, MCContext &Ctx) {
38 return new (Ctx) X86MCExpr(RegNo);
39 }
40
41 /// @}
42 /// @name Accessors
43 /// @{
44
45 /// getSubExpr - Get the child of this expression.
46 int64_t getRegNo() const { return RegNo; }
47
48 /// @}
49
50 void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override {
51 if (!MAI || MAI->getAssemblerDialect() == 0)
52 OS << '%';
54 }
55
57 const MCFixup *Fixup) const override {
58 return false;
59 }
60 // Register values should be inlined as they are not valid .set expressions.
61 bool inlineAssignedExpr() const override { return true; }
62 bool isEqualTo(const MCExpr *X) const override {
63 if (auto *E = dyn_cast<X86MCExpr>(X))
64 return getRegNo() == E->getRegNo();
65 return false;
66 }
67 void visitUsedExpr(MCStreamer &Streamer) const override {}
68 MCFragment *findAssociatedFragment() const override { return nullptr; }
69
70 // There are no TLS X86MCExprs at the moment.
71 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
72
73 static bool classof(const MCExpr *E) {
74 return E->getKind() == MCExpr::Target;
75 }
76};
77
78} // end namespace llvm
79
80#endif
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
PowerPC TLS Dynamic Call Fixup
raw_pwrite_stream & OS
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
unsigned getAssemblerDialect() const
Definition: MCAsmInfo.h:682
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
Context object for machine code objects.
Definition: MCContext.h:81
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
@ Target
Target specific expression.
Definition: MCExpr.h:42
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71
Streaming machine code generation interface.
Definition: MCStreamer.h:212
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:656
This represents an "assembler immediate".
Definition: MCValue.h:36
static const char * getRegisterName(MCRegister Reg)
static const X86MCExpr * create(int64_t RegNo, MCContext &Ctx)
Definition: X86MCExpr.h:37
bool isEqualTo(const MCExpr *X) const override
Definition: X86MCExpr.h:62
int64_t getRegNo() const
getSubExpr - Get the child of this expression.
Definition: X86MCExpr.h:46
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
Definition: X86MCExpr.h:71
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: X86MCExpr.h:67
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: X86MCExpr.h:50
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
Definition: X86MCExpr.h:56
MCFragment * findAssociatedFragment() const override
Definition: X86MCExpr.h:68
static bool classof(const MCExpr *E)
Definition: X86MCExpr.h:73
bool inlineAssignedExpr() const override
Definition: X86MCExpr.h:61
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18