LLVM  10.0.0svn
AVRTargetStreamer.cpp
Go to the documentation of this file.
1 //===-- AVRTargetStreamer.cpp - AVR 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 AVR specific target streamer methods.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "AVRTargetStreamer.h"
14 
15 #include "llvm/MC/MCContext.h"
16 
17 namespace llvm {
18 
20 
22  : AVRTargetStreamer(S) {}
23 
25  MCStreamer &OS = getStreamer();
27 
28  MCSymbol *DoCopyData = Context.getOrCreateSymbol("__do_copy_data");
29  MCSymbol *DoClearBss = Context.getOrCreateSymbol("__do_clear_bss");
30 
31  // FIXME: We can disable __do_copy_data if there are no static RAM variables.
32 
33  OS.emitRawComment(" Declaring this symbol tells the CRT that it should");
34  OS.emitRawComment("copy all variables from program memory to RAM on startup");
35  OS.EmitSymbolAttribute(DoCopyData, MCSA_Global);
36 
37  OS.emitRawComment(" Declaring this symbol tells the CRT that it should");
38  OS.emitRawComment("clear the zeroed data section on startup");
39  OS.EmitSymbolAttribute(DoClearBss, MCSA_Global);
40 }
41 
42 } // end namespace llvm
43 
LLVMContext & Context
This class represents lattice values for constants.
Definition: AllocatorList.h:23
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
Target specific streamer interface.
Definition: MCStreamer.h:91
MCContext & getContext() const
Definition: MCStreamer.h:258
Context object for machine code objects.
Definition: MCContext.h:65
virtual void emitRawComment(const Twine &T, bool TabPrefix=true)
Print T and prefix it with the comment string (normally #) and optionally a tab.
Definition: MCStreamer.cpp:118
AVRTargetStreamer(MCStreamer &S)
Streaming machine code generation interface.
Definition: MCStreamer.h:196
virtual bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute)=0
Add the given Attribute to Symbol.
MCStreamer & getStreamer()
Definition: MCStreamer.h:99
.type _foo,
Definition: MCDirectives.h:30
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Definition: MCContext.cpp:129
A generic AVR target output stream.