LLVM  14.0.0git
AVRELFStreamer.cpp
Go to the documentation of this file.
1 #include "AVRELFStreamer.h"
2 
7 
8 #include "AVRMCTargetDesc.h"
9 
10 namespace llvm {
11 
12 static unsigned getEFlagsForFeatureSet(const FeatureBitset &Features) {
13  unsigned EFlags = 0;
14 
15  // Set architecture
16  if (Features[AVR::ELFArchAVR1])
17  EFlags |= ELF::EF_AVR_ARCH_AVR1;
18  else if (Features[AVR::ELFArchAVR2])
19  EFlags |= ELF::EF_AVR_ARCH_AVR2;
20  else if (Features[AVR::ELFArchAVR25])
21  EFlags |= ELF::EF_AVR_ARCH_AVR25;
22  else if (Features[AVR::ELFArchAVR3])
23  EFlags |= ELF::EF_AVR_ARCH_AVR3;
24  else if (Features[AVR::ELFArchAVR31])
25  EFlags |= ELF::EF_AVR_ARCH_AVR31;
26  else if (Features[AVR::ELFArchAVR35])
27  EFlags |= ELF::EF_AVR_ARCH_AVR35;
28  else if (Features[AVR::ELFArchAVR4])
29  EFlags |= ELF::EF_AVR_ARCH_AVR4;
30  else if (Features[AVR::ELFArchAVR5])
31  EFlags |= ELF::EF_AVR_ARCH_AVR5;
32  else if (Features[AVR::ELFArchAVR51])
33  EFlags |= ELF::EF_AVR_ARCH_AVR51;
34  else if (Features[AVR::ELFArchAVR6])
35  EFlags |= ELF::EF_AVR_ARCH_AVR6;
36  else if (Features[AVR::ELFArchTiny])
37  EFlags |= ELF::EF_AVR_ARCH_AVRTINY;
38  else if (Features[AVR::ELFArchXMEGA1])
39  EFlags |= ELF::EF_AVR_ARCH_XMEGA1;
40  else if (Features[AVR::ELFArchXMEGA2])
41  EFlags |= ELF::EF_AVR_ARCH_XMEGA2;
42  else if (Features[AVR::ELFArchXMEGA3])
43  EFlags |= ELF::EF_AVR_ARCH_XMEGA3;
44  else if (Features[AVR::ELFArchXMEGA4])
45  EFlags |= ELF::EF_AVR_ARCH_XMEGA4;
46  else if (Features[AVR::ELFArchXMEGA5])
47  EFlags |= ELF::EF_AVR_ARCH_XMEGA5;
48  else if (Features[AVR::ELFArchXMEGA6])
49  EFlags |= ELF::EF_AVR_ARCH_XMEGA6;
50  else if (Features[AVR::ELFArchXMEGA7])
51  EFlags |= ELF::EF_AVR_ARCH_XMEGA7;
52 
53  return EFlags;
54 }
55 
57  : AVRTargetStreamer(S) {
58 
60  unsigned EFlags = MCA.getELFHeaderEFlags();
61 
62  EFlags |= getEFlagsForFeatureSet(STI.getFeatureBits());
63 
64  MCA.setELFHeaderEFlags(EFlags);
65 }
66 
67 } // end namespace llvm
llvm::MCAssembler::getELFHeaderEFlags
unsigned getELFHeaderEFlags() const
ELF e_header flags.
Definition: MCAssembler.h:262
llvm::ELF::EF_AVR_ARCH_AVR3
@ EF_AVR_ARCH_AVR3
Definition: ELF.h:477
llvm::ELF::EF_AVR_ARCH_AVR4
@ EF_AVR_ARCH_AVR4
Definition: ELF.h:480
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::AVRELFStreamer::getStreamer
MCELFStreamer & getStreamer()
Definition: AVRELFStreamer.h:21
llvm::ELF::EF_AVR_ARCH_XMEGA3
@ EF_AVR_ARCH_XMEGA3
Definition: ELF.h:487
llvm::ELF::EF_AVR_ARCH_AVRTINY
@ EF_AVR_ARCH_AVRTINY
Definition: ELF.h:484
llvm::FeatureBitset
Container class for subtarget features.
Definition: SubtargetFeature.h:40
llvm::ELF::EF_AVR_ARCH_AVR5
@ EF_AVR_ARCH_AVR5
Definition: ELF.h:481
llvm::ELF::EF_AVR_ARCH_AVR35
@ EF_AVR_ARCH_AVR35
Definition: ELF.h:479
FormattedStream.h
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:199
SubtargetFeature.h
ELF.h
MCSubtargetInfo.h
llvm::MCSubtargetInfo::getFeatureBits
const FeatureBitset & getFeatureBits() const
Definition: MCSubtargetInfo.h:111
llvm::ELF::EF_AVR_ARCH_AVR6
@ EF_AVR_ARCH_AVR6
Definition: ELF.h:483
llvm::ELF::EF_AVR_ARCH_XMEGA5
@ EF_AVR_ARCH_XMEGA5
Definition: ELF.h:489
llvm::ELF::EF_AVR_ARCH_XMEGA6
@ EF_AVR_ARCH_XMEGA6
Definition: ELF.h:490
llvm::ELF::EF_AVR_ARCH_AVR2
@ EF_AVR_ARCH_AVR2
Definition: ELF.h:475
llvm::AVRELFStreamer::AVRELFStreamer
AVRELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
Definition: AVRELFStreamer.cpp:56
llvm::MCAssembler
Definition: MCAssembler.h:60
llvm::getEFlagsForFeatureSet
static unsigned getEFlagsForFeatureSet(const FeatureBitset &Features)
Definition: AVRELFStreamer.cpp:12
llvm::ELF::EF_AVR_ARCH_XMEGA2
@ EF_AVR_ARCH_XMEGA2
Definition: ELF.h:486
llvm::ELF::EF_AVR_ARCH_XMEGA1
@ EF_AVR_ARCH_XMEGA1
Definition: ELF.h:485
llvm::MCAssembler::setELFHeaderEFlags
void setELFHeaderEFlags(unsigned Flags)
Definition: MCAssembler.h:263
AVRMCTargetDesc.h
AVRELFStreamer.h
llvm::MCObjectStreamer::getAssembler
MCAssembler & getAssembler()
Definition: MCObjectStreamer.h:112
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_AVR51
@ EF_AVR_ARCH_AVR51
Definition: ELF.h:482
llvm::ELF::EF_AVR_ARCH_XMEGA7
@ EF_AVR_ARCH_XMEGA7
Definition: ELF.h:491
llvm::ELF::EF_AVR_ARCH_AVR1
@ EF_AVR_ARCH_AVR1
Definition: ELF.h:474
llvm::ELF::EF_AVR_ARCH_AVR25
@ EF_AVR_ARCH_AVR25
Definition: ELF.h:476
llvm::ELF::EF_AVR_ARCH_XMEGA4
@ EF_AVR_ARCH_XMEGA4
Definition: ELF.h:488
llvm::AVRTargetStreamer
A generic AVR target output stream.
Definition: AVRTargetStreamer.h:18
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75
llvm::ELF::EF_AVR_ARCH_AVR31
@ EF_AVR_ARCH_AVR31
Definition: ELF.h:478