LLVM  14.0.0git
AVRMCELFStreamer.cpp
Go to the documentation of this file.
1 //===--------- AVRMCELFStreamer.cpp - AVR subclass of MCELFStreamer -------===//
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 is a stub that parses a MCInst bundle and passes the
10 // instructions on to the real streamer.
11 //
12 //===----------------------------------------------------------------------===//
14 #include "llvm/MC/MCContext.h"
15 #include "llvm/MC/MCExpr.h"
16 #include "llvm/MC/MCObjectWriter.h"
17 #include "llvm/MC/MCSymbol.h"
18 
19 #define DEBUG_TYPE "avrmcelfstreamer"
20 
21 using namespace llvm;
22 
24  const MCSymbol *Sym, unsigned SizeInBytes, SMLoc Loc,
25  AVRMCExpr::VariantKind ModifierKind) {
27  if (ModifierKind == AVRMCExpr::VK_AVR_None) {
29  if (SizeInBytes == SIZE_LONG)
31  else if (SizeInBytes == SIZE_WORD)
33  } else if (ModifierKind == AVRMCExpr::VK_AVR_LO8)
35  else if (ModifierKind == AVRMCExpr::VK_AVR_HI8)
37  else if (ModifierKind == AVRMCExpr::VK_AVR_HH8)
40  SizeInBytes, Loc);
41 }
42 
43 namespace llvm {
45  std::unique_ptr<MCAsmBackend> MAB,
46  std::unique_ptr<MCObjectWriter> OW,
47  std::unique_ptr<MCCodeEmitter> CE) {
48  return new AVRMCELFStreamer(Context, std::move(MAB), std::move(OW),
49  std::move(CE));
50 }
51 
52 } // end namespace llvm
llvm::MCSymbolRefExpr::VK_AVR_HI8
@ VK_AVR_HI8
Definition: MCExpr.h:240
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::AVRMCExpr::VK_AVR_HH8
@ VK_AVR_HH8
Corresponds to hlo8() and hh8().
Definition: AVRMCExpr.h:27
llvm::MCSymbolRefExpr::VK_AVR_NONE
@ VK_AVR_NONE
Definition: MCExpr.h:238
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
llvm::MCSymbolRefExpr::VK_AVR_DIFF8
@ VK_AVR_DIFF8
Definition: MCExpr.h:242
AVRMCELFStreamer.h
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::MCStreamer::emitValue
void emitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:177
llvm::AVRMCExpr::VK_AVR_LO8
@ VK_AVR_LO8
Corresponds to lo8().
Definition: AVRMCExpr.h:26
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:199
llvm::SMLoc
Represents a location in source code.
Definition: SMLoc.h:23
llvm::AVRMCExpr::VK_AVR_None
@ VK_AVR_None
Definition: AVRMCExpr.h:23
llvm::MCSymbolRefExpr::VK_AVR_HLO8
@ VK_AVR_HLO8
Definition: MCExpr.h:241
MCContext.h
llvm::AVRMCELFStreamer::emitValueForModiferKind
void emitValueForModiferKind(const MCSymbol *Sym, unsigned SizeInBytes, SMLoc Loc=SMLoc(), AVRMCExpr::VariantKind ModifierKind=AVRMCExpr::VK_AVR_None)
Definition: AVRMCELFStreamer.cpp:23
MCSymbol.h
llvm::SIZE_WORD
const int SIZE_WORD
Definition: AVRMCELFStreamer.h:23
llvm::MCSymbolRefExpr::VK_AVR_DIFF32
@ VK_AVR_DIFF32
Definition: MCExpr.h:244
llvm::createAVRELFStreamer
MCStreamer * createAVRELFStreamer(Triple const &TT, MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > CE)
Definition: AVRMCELFStreamer.cpp:44
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::MCSymbolRefExpr::VK_AVR_LO8
@ VK_AVR_LO8
Definition: MCExpr.h:239
llvm::MCSymbolRefExpr::VariantKind
VariantKind
Definition: MCExpr.h:194
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::AVRMCELFStreamer
Definition: AVRMCELFStreamer.h:25
llvm::SIZE_LONG
const int SIZE_LONG
Definition: AVRMCELFStreamer.h:22
MCObjectWriter.h
llvm::AVRMCExpr::VariantKind
VariantKind
Specifies the type of an expression.
Definition: AVRMCExpr.h:22
llvm::MCSymbolRefExpr::create
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:385
llvm::MCStreamer::getContext
MCContext & getContext() const
Definition: MCStreamer.h:280
llvm::MCSymbolRefExpr::VK_AVR_DIFF16
@ VK_AVR_DIFF16
Definition: MCExpr.h:243
llvm::AVRMCExpr::VK_AVR_HI8
@ VK_AVR_HI8
Corresponds to hi8().
Definition: AVRMCExpr.h:25
MCExpr.h