LLVM 20.0.0git
SparcTargetStreamer.cpp
Go to the documentation of this file.
1//===-- SparcTargetStreamer.cpp - Sparc 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// This file provides Sparc specific target streamer methods.
10//
11//===----------------------------------------------------------------------===//
12
13#include "SparcTargetStreamer.h"
14#include "SparcInstPrinter.h"
15#include "SparcMCTargetDesc.h"
18#include "llvm/MC/MCRegister.h"
21
22using namespace llvm;
23
24static unsigned getEFlagsForFeatureSet(const MCSubtargetInfo &STI) {
25 unsigned EFlags = 0;
26
27 if (STI.hasFeature(Sparc::FeatureV8Plus))
28 EFlags |= ELF::EF_SPARC_32PLUS;
29
30 return EFlags;
31}
32
33// pin vtable to this file
35
36void SparcTargetStreamer::anchor() {}
37
40 : SparcTargetStreamer(S), OS(OS) {}
41
43 OS << "\t.register "
45 << ", #ignore\n";
46}
47
49 OS << "\t.register "
51 << ", #scratch\n";
52}
53
55 const MCSubtargetInfo &STI)
58 unsigned EFlags = W.getELFHeaderEFlags();
59
60 EFlags |= getEFlagsForFeatureSet(STI);
61
62 W.setELFHeaderEFlags(EFlags);
63}
64
66 return static_cast<MCELFStreamer &>(Streamer);
67}
raw_pwrite_stream & OS
static unsigned getEFlagsForFeatureSet(const MCSubtargetInfo &STI)
ELFObjectWriter & getWriter()
Streaming machine code generation interface.
Definition: MCStreamer.h:213
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
Target specific streamer interface.
Definition: MCStreamer.h:94
MCStreamer & Streamer
Definition: MCStreamer.h:96
static const char * getRegisterName(MCRegister Reg, unsigned AltIdx=SP::NoRegAltName)
void emitSparcRegisterIgnore(unsigned reg) override
Emit ".register <reg>, #ignore".
SparcTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS)
void emitSparcRegisterScratch(unsigned reg) override
Emit ".register <reg>, #scratch".
SparcTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
std::string lower() const
Definition: StringRef.cpp:113
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
@ EF_SPARC_32PLUS
Definition: ELF.h:709
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
static unsigned getEFlagsForFeatureSet(const FeatureBitset &Features)