LLVM  9.0.0svn
RISCVELFStreamer.cpp
Go to the documentation of this file.
1 //===-- RISCVELFStreamer.cpp - RISCV ELF 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 RISCV specific target streamer methods.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "RISCVELFStreamer.h"
14 #include "RISCVMCTargetDesc.h"
15 #include "llvm/BinaryFormat/ELF.h"
17 
18 using namespace llvm;
19 
20 // This part is for ELF object output.
22  const MCSubtargetInfo &STI)
23  : RISCVTargetStreamer(S) {
25 
26  const FeatureBitset &Features = STI.getFeatureBits();
27 
28  unsigned EFlags = MCA.getELFHeaderEFlags();
29 
30  if (Features[RISCV::FeatureStdExtC])
31  EFlags |= ELF::EF_RISCV_RVC;
32 
33  MCA.setELFHeaderEFlags(EFlags);
34 }
35 
37  return static_cast<MCELFStreamer &>(Streamer);
38 }
39 
void setELFHeaderEFlags(unsigned Flags)
Definition: MCAssembler.h:255
RISCVTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
This class represents lattice values for constants.
Definition: AllocatorList.h:23
const FeatureBitset Features
virtual void emitDirectiveOptionNoRelax()
const FeatureBitset & getFeatureBits() const
Streaming machine code generation interface.
Definition: MCStreamer.h:188
Container class for subtarget features.
MCAssembler & getAssembler()
unsigned getELFHeaderEFlags() const
ELF e_header flags.
Definition: MCAssembler.h:254
MCStreamer & Streamer
Definition: MCStreamer.h:85
Generic base class for all target subtargets.