LLVM 22.0.0git
SystemZTargetStreamer.cpp
Go to the documentation of this file.
1//==-- SystemZTargetStreamer.cpp - SystemZ Target Streamer Methods ----------=//
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/// \file
10/// This file defines SystemZ-specific target streamer classes.
11/// These are for implementing support for target-specific assembly directives.
12///
13//===----------------------------------------------------------------------===//
14
17#include "llvm/MC/MCAsmInfo.h"
20
21using namespace llvm;
22
24 // Emit EXRL target instructions.
25 if (EXRLTargets2Sym.empty())
26 return;
27 // Switch to the .text section.
28 const MCObjectFileInfo &OFI = *Streamer.getContext().getObjectFileInfo();
29 Streamer.switchSection(OFI.getTextSection());
30 for (auto &I : EXRLTargets2Sym) {
31 Streamer.emitLabel(I.second);
32 const MCInstSTIPair &MCI_STI = I.first;
33 Streamer.emitInstruction(MCI_STI.first, *MCI_STI.second);
34 }
35 EXRLTargets2Sym.clear();
36}
37
41
42// HLASM statements can only perform a single operation at a time
44 MCContext &Ctx, const MCSymbol *Hi, const MCSymbol *Lo) {
45 assert(Hi && Lo && "Symbols required to calculate expression");
46 MCSymbol *Temp = Ctx.createTempSymbol();
47 OS << Temp->getName() << " EQU ";
48 const MCBinaryExpr *TempExpr = MCBinaryExpr::createSub(
50 Ctx.getAsmInfo()->printExpr(OS, *TempExpr);
51 OS << "\n";
53 MCConstantExpr::create(1, Ctx), Ctx);
54}
55
57 MCContext &Ctx, const MCSymbol *Hi, const MCSymbol *Lo) {
58 assert(Hi && Lo && "Symbols required to calculate expression");
61 MCSymbolRefExpr::create(Lo, Ctx), Ctx),
62 MCConstantExpr::create(1, Ctx), Ctx);
63}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define I(x, y, z)
Definition MD5.cpp:57
Binary assembler expressions.
Definition MCExpr.h:299
static const MCBinaryExpr * createLShr(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition MCExpr.h:423
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition MCExpr.h:428
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Definition MCExpr.cpp:212
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
MCSection * getTextSection() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.h:214
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
StringRef getName() const
getName - Get the symbol name.
Definition MCSymbol.h:188
MCStreamer & getStreamer()
Definition MCStreamer.h:101
MCStreamer & Streamer
Definition MCStreamer.h:95
const MCExpr * createWordDiffExpr(MCContext &Ctx, const MCSymbol *Hi, const MCSymbol *Lo) override
SystemZHLASMAsmStreamer & getHLASMStreamer()
const MCExpr * createWordDiffExpr(MCContext &Ctx, const MCSymbol *Hi, const MCSymbol *Lo) override
std::pair< MCInst, const MCSubtargetInfo * > MCInstSTIPair
This is an optimization pass for GlobalISel generic memory operations.