LLVM 22.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 if (STI.hasFeature(Sparc::FeatureVIS))
31 EFlags |= ELF::EF_SPARC_SUN_US1;
32
33 if (STI.hasFeature(Sparc::FeatureVIS2))
34 EFlags |= ELF::EF_SPARC_SUN_US3;
35
36 // VIS 3 and other ISA extensions doesn't set any flags.
37
38 return EFlags;
39}
40
41// pin vtable to this file
43
44void SparcTargetStreamer::anchor() {}
45
49
51 OS << "\t.register "
53 << ", #ignore\n";
54}
55
57 OS << "\t.register "
59 << ", #scratch\n";
60}
61
63 const MCSubtargetInfo &STI)
66 unsigned EFlags = W.getELFHeaderEFlags();
67
68 EFlags |= getEFlagsForFeatureSet(STI);
69
70 W.setELFHeaderEFlags(EFlags);
71}
72
ELFObjectWriter & getWriter()
Streaming machine code generation interface.
Definition MCStreamer.h:220
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
MCStreamer & Streamer
Definition MCStreamer.h:95
MCTargetStreamer(MCStreamer &S)
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:55
LLVM_ABI std::string lower() const
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
@ EF_SPARC_32PLUS
Definition ELF.h:746
@ EF_SPARC_SUN_US1
Definition ELF.h:747
@ EF_SPARC_SUN_US3
Definition ELF.h:749
This is an optimization pass for GlobalISel generic memory operations.
static unsigned getEFlagsForFeatureSet(const FeatureBitset &Features)