LLVM  15.0.0git
AVRELFStreamer.cpp
Go to the documentation of this file.
1 #include "AVRELFStreamer.h"
2 
4 #include "llvm/MC/MCAssembler.h"
8 
9 #include "AVRMCTargetDesc.h"
10 
11 namespace llvm {
12 
13 static unsigned getEFlagsForFeatureSet(const FeatureBitset &Features) {
14  unsigned EFlags = 0;
15 
16  // Set architecture
17  if (Features[AVR::ELFArchAVR1])
18  EFlags |= ELF::EF_AVR_ARCH_AVR1;
19  else if (Features[AVR::ELFArchAVR2])
20  EFlags |= ELF::EF_AVR_ARCH_AVR2;
21  else if (Features[AVR::ELFArchAVR25])
22  EFlags |= ELF::EF_AVR_ARCH_AVR25;
23  else if (Features[AVR::ELFArchAVR3])
24  EFlags |= ELF::EF_AVR_ARCH_AVR3;
25  else if (Features[AVR::ELFArchAVR31])
26  EFlags |= ELF::EF_AVR_ARCH_AVR31;
27  else if (Features[AVR::ELFArchAVR35])
28  EFlags |= ELF::EF_AVR_ARCH_AVR35;
29  else if (Features[AVR::ELFArchAVR4])
30  EFlags |= ELF::EF_AVR_ARCH_AVR4;
31  else if (Features[AVR::ELFArchAVR5])
32  EFlags |= ELF::EF_AVR_ARCH_AVR5;
33  else if (Features[AVR::ELFArchAVR51])
34  EFlags |= ELF::EF_AVR_ARCH_AVR51;
35  else if (Features[AVR::ELFArchAVR6])
36  EFlags |= ELF::EF_AVR_ARCH_AVR6;
37  else if (Features[AVR::ELFArchTiny])
38  EFlags |= ELF::EF_AVR_ARCH_AVRTINY;
39  else if (Features[AVR::ELFArchXMEGA1])
40  EFlags |= ELF::EF_AVR_ARCH_XMEGA1;
41  else if (Features[AVR::ELFArchXMEGA2])
42  EFlags |= ELF::EF_AVR_ARCH_XMEGA2;
43  else if (Features[AVR::ELFArchXMEGA3])
44  EFlags |= ELF::EF_AVR_ARCH_XMEGA3;
45  else if (Features[AVR::ELFArchXMEGA4])
46  EFlags |= ELF::EF_AVR_ARCH_XMEGA4;
47  else if (Features[AVR::ELFArchXMEGA5])
48  EFlags |= ELF::EF_AVR_ARCH_XMEGA5;
49  else if (Features[AVR::ELFArchXMEGA6])
50  EFlags |= ELF::EF_AVR_ARCH_XMEGA6;
51  else if (Features[AVR::ELFArchXMEGA7])
52  EFlags |= ELF::EF_AVR_ARCH_XMEGA7;
53 
54  return EFlags;
55 }
56 
58  : AVRTargetStreamer(S) {
59 
61  unsigned EFlags = MCA.getELFHeaderEFlags();
62 
63  EFlags |= getEFlagsForFeatureSet(STI.getFeatureBits());
64 
65  MCA.setELFHeaderEFlags(EFlags);
66 }
67 
68 } // end namespace llvm
llvm::MCAssembler::getELFHeaderEFlags
unsigned getELFHeaderEFlags() const
ELF e_header flags.
Definition: MCAssembler.h:276
llvm::ELF::EF_AVR_ARCH_XMEGA2
@ EF_AVR_ARCH_XMEGA2
Definition: ELF.h:487
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::ELF::EF_AVR_ARCH_XMEGA4
@ EF_AVR_ARCH_XMEGA4
Definition: ELF.h:489
llvm::ELF::EF_AVR_ARCH_XMEGA6
@ EF_AVR_ARCH_XMEGA6
Definition: ELF.h:491
llvm::AVRELFStreamer::getStreamer
MCELFStreamer & getStreamer()
Definition: AVRELFStreamer.h:21
MCAssembler.h
llvm::FeatureBitset
Container class for subtarget features.
Definition: SubtargetFeature.h:40
llvm::ELF::EF_AVR_ARCH_AVR51
@ EF_AVR_ARCH_AVR51
Definition: ELF.h:483
FormattedStream.h
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:201
SubtargetFeature.h
ELF.h
llvm::ELF::EF_AVR_ARCH_XMEGA3
@ EF_AVR_ARCH_XMEGA3
Definition: ELF.h:488
llvm::ELF::EF_AVR_ARCH_AVR25
@ EF_AVR_ARCH_AVR25
Definition: ELF.h:477
llvm::ELF::EF_AVR_ARCH_AVR5
@ EF_AVR_ARCH_AVR5
Definition: ELF.h:482
MCSubtargetInfo.h
llvm::MCSubtargetInfo::getFeatureBits
const FeatureBitset & getFeatureBits() const
Definition: MCSubtargetInfo.h:112
llvm::ELF::EF_AVR_ARCH_AVR35
@ EF_AVR_ARCH_AVR35
Definition: ELF.h:480
llvm::AVRELFStreamer::AVRELFStreamer
AVRELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
Definition: AVRELFStreamer.cpp:57
llvm::MCAssembler
Definition: MCAssembler.h:73
llvm::getEFlagsForFeatureSet
static unsigned getEFlagsForFeatureSet(const FeatureBitset &Features)
Definition: AVRELFStreamer.cpp:13
llvm::MCAssembler::setELFHeaderEFlags
void setELFHeaderEFlags(unsigned Flags)
Definition: MCAssembler.h:277
llvm::ELF::EF_AVR_ARCH_AVR3
@ EF_AVR_ARCH_AVR3
Definition: ELF.h:478
AVRMCTargetDesc.h
llvm::ELF::EF_AVR_ARCH_AVRTINY
@ EF_AVR_ARCH_AVRTINY
Definition: ELF.h:485
AVRELFStreamer.h
llvm::ELF::EF_AVR_ARCH_AVR6
@ EF_AVR_ARCH_AVR6
Definition: ELF.h:484
llvm::MCObjectStreamer::getAssembler
MCAssembler & getAssembler()
Definition: MCObjectStreamer.h:128
llvm::ELF::EF_AVR_ARCH_AVR1
@ EF_AVR_ARCH_AVR1
Definition: ELF.h:475
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::ELF::EF_AVR_ARCH_AVR31
@ EF_AVR_ARCH_AVR31
Definition: ELF.h:479
llvm::ELF::EF_AVR_ARCH_XMEGA7
@ EF_AVR_ARCH_XMEGA7
Definition: ELF.h:492
llvm::ELF::EF_AVR_ARCH_AVR4
@ EF_AVR_ARCH_AVR4
Definition: ELF.h:481
llvm::ELF::EF_AVR_ARCH_XMEGA5
@ EF_AVR_ARCH_XMEGA5
Definition: ELF.h:490
llvm::ELF::EF_AVR_ARCH_AVR2
@ EF_AVR_ARCH_AVR2
Definition: ELF.h:476
llvm::ELF::EF_AVR_ARCH_XMEGA1
@ EF_AVR_ARCH_XMEGA1
Definition: ELF.h:486
llvm::AVRTargetStreamer
A generic AVR target output stream.
Definition: AVRTargetStreamer.h:18
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:76