LLVM 17.0.0git
Go to the documentation of this file.
1//===-- ARMMCExpr.cpp - ARM specific MC expression classes ----------------===//
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
9#include "ARMMCExpr.h"
10#include "llvm/MC/MCContext.h"
11#include "llvm/MC/MCStreamer.h"
12using namespace llvm;
14#define DEBUG_TYPE "armmcexpr"
16const ARMMCExpr*
18 MCContext &Ctx) {
19 return new (Ctx) ARMMCExpr(Kind, Expr);
22void ARMMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
23 switch (Kind) {
24 default: llvm_unreachable("Invalid kind!");
25 case VK_ARM_HI16: OS << ":upper16:"; break;
26 case VK_ARM_LO16: OS << ":lower16:"; break;
27 }
29 const MCExpr *Expr = getSubExpr();
30 if (Expr->getKind() != MCExpr::SymbolRef)
31 OS << '(';
32 Expr->print(OS, MAI);
33 if (Expr->getKind() != MCExpr::SymbolRef)
34 OS << ')';
37void ARMMCExpr::visitUsedExpr(MCStreamer &Streamer) const {
38 Streamer.visitUsedExpr(*getSubExpr());
raw_pwrite_stream & OS
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: ARMMCExpr.cpp:22
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
Definition: ARMMCExpr.h:54
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: ARMMCExpr.cpp:37
static const ARMMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: ARMMCExpr.cpp:17
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Context object for machine code objects.
Definition: MCContext.h:76
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
@ SymbolRef
References to labels and assigned expressions.
Definition: MCExpr.h:40
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
Definition: MCExpr.cpp:41
ExprKind getKind() const
Definition: MCExpr.h:81
Streaming machine code generation interface.
Definition: MCStreamer.h:212
void visitUsedExpr(const MCExpr &Expr)
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18