10b57cec5SDimitry Andric //===-- AVRAsmPrinter.cpp - AVR LLVM assembly writer ----------------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // This file contains a printer that converts from our internal representation
100b57cec5SDimitry Andric // of machine-dependent LLVM code to GAS-format AVR assembly language.
110b57cec5SDimitry Andric //
120b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
130b57cec5SDimitry Andric
140b57cec5SDimitry Andric #include "AVR.h"
150b57cec5SDimitry Andric #include "AVRMCInstLower.h"
160b57cec5SDimitry Andric #include "AVRSubtarget.h"
1781ad6265SDimitry Andric #include "AVRTargetMachine.h"
180b57cec5SDimitry Andric #include "MCTargetDesc/AVRInstPrinter.h"
19fe6060f1SDimitry Andric #include "MCTargetDesc/AVRMCExpr.h"
200b57cec5SDimitry Andric #include "TargetInfo/AVRTargetInfo.h"
210b57cec5SDimitry Andric
22bdd1243dSDimitry Andric #include "llvm/BinaryFormat/ELF.h"
230b57cec5SDimitry Andric #include "llvm/CodeGen/AsmPrinter.h"
240b57cec5SDimitry Andric #include "llvm/CodeGen/MachineFunction.h"
250b57cec5SDimitry Andric #include "llvm/CodeGen/MachineInstr.h"
2681ad6265SDimitry Andric #include "llvm/CodeGen/MachineModuleInfo.h"
270b57cec5SDimitry Andric #include "llvm/CodeGen/TargetRegisterInfo.h"
280b57cec5SDimitry Andric #include "llvm/CodeGen/TargetSubtargetInfo.h"
290b57cec5SDimitry Andric #include "llvm/IR/Mangler.h"
30*0fca6ea1SDimitry Andric #include "llvm/IR/Module.h"
31349cc55cSDimitry Andric #include "llvm/MC/MCContext.h"
320b57cec5SDimitry Andric #include "llvm/MC/MCInst.h"
33bdd1243dSDimitry Andric #include "llvm/MC/MCSectionELF.h"
340b57cec5SDimitry Andric #include "llvm/MC/MCStreamer.h"
350b57cec5SDimitry Andric #include "llvm/MC/MCSymbol.h"
36349cc55cSDimitry Andric #include "llvm/MC/TargetRegistry.h"
370b57cec5SDimitry Andric #include "llvm/Support/ErrorHandling.h"
380b57cec5SDimitry Andric #include "llvm/Support/raw_ostream.h"
39bdd1243dSDimitry Andric #include "llvm/Target/TargetLoweringObjectFile.h"
400b57cec5SDimitry Andric
410b57cec5SDimitry Andric #define DEBUG_TYPE "avr-asm-printer"
420b57cec5SDimitry Andric
430b57cec5SDimitry Andric namespace llvm {
440b57cec5SDimitry Andric
450b57cec5SDimitry Andric /// An AVR assembly code printer.
460b57cec5SDimitry Andric class AVRAsmPrinter : public AsmPrinter {
470b57cec5SDimitry Andric public:
AVRAsmPrinter(TargetMachine & TM,std::unique_ptr<MCStreamer> Streamer)48349cc55cSDimitry Andric AVRAsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer)
490b57cec5SDimitry Andric : AsmPrinter(TM, std::move(Streamer)), MRI(*TM.getMCRegisterInfo()) {}
500b57cec5SDimitry Andric
getPassName() const510b57cec5SDimitry Andric StringRef getPassName() const override { return "AVR Assembly Printer"; }
520b57cec5SDimitry Andric
530b57cec5SDimitry Andric void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
540b57cec5SDimitry Andric
550b57cec5SDimitry Andric bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
560b57cec5SDimitry Andric const char *ExtraCode, raw_ostream &O) override;
570b57cec5SDimitry Andric
580b57cec5SDimitry Andric bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
590b57cec5SDimitry Andric const char *ExtraCode, raw_ostream &O) override;
600b57cec5SDimitry Andric
615ffd83dbSDimitry Andric void emitInstruction(const MachineInstr *MI) override;
620b57cec5SDimitry Andric
63fe6060f1SDimitry Andric const MCExpr *lowerConstant(const Constant *CV) override;
64fe6060f1SDimitry Andric
65349cc55cSDimitry Andric void emitXXStructor(const DataLayout &DL, const Constant *CV) override;
66349cc55cSDimitry Andric
67349cc55cSDimitry Andric bool doFinalization(Module &M) override;
68349cc55cSDimitry Andric
6981ad6265SDimitry Andric void emitStartOfAsmFile(Module &M) override;
7081ad6265SDimitry Andric
710b57cec5SDimitry Andric private:
720b57cec5SDimitry Andric const MCRegisterInfo &MRI;
73349cc55cSDimitry Andric bool EmittedStructorSymbolAttrs = false;
740b57cec5SDimitry Andric };
750b57cec5SDimitry Andric
printOperand(const MachineInstr * MI,unsigned OpNo,raw_ostream & O)760b57cec5SDimitry Andric void AVRAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
770b57cec5SDimitry Andric raw_ostream &O) {
780b57cec5SDimitry Andric const MachineOperand &MO = MI->getOperand(OpNo);
790b57cec5SDimitry Andric
800b57cec5SDimitry Andric switch (MO.getType()) {
810b57cec5SDimitry Andric case MachineOperand::MO_Register:
820b57cec5SDimitry Andric O << AVRInstPrinter::getPrettyRegisterName(MO.getReg(), MRI);
830b57cec5SDimitry Andric break;
840b57cec5SDimitry Andric case MachineOperand::MO_Immediate:
850b57cec5SDimitry Andric O << MO.getImm();
860b57cec5SDimitry Andric break;
870b57cec5SDimitry Andric case MachineOperand::MO_GlobalAddress:
880b57cec5SDimitry Andric O << getSymbol(MO.getGlobal());
890b57cec5SDimitry Andric break;
900b57cec5SDimitry Andric case MachineOperand::MO_ExternalSymbol:
910b57cec5SDimitry Andric O << *GetExternalSymbolSymbol(MO.getSymbolName());
920b57cec5SDimitry Andric break;
930b57cec5SDimitry Andric case MachineOperand::MO_MachineBasicBlock:
940b57cec5SDimitry Andric O << *MO.getMBB()->getSymbol();
950b57cec5SDimitry Andric break;
960b57cec5SDimitry Andric default:
970b57cec5SDimitry Andric llvm_unreachable("Not implemented yet!");
980b57cec5SDimitry Andric }
990b57cec5SDimitry Andric }
1000b57cec5SDimitry Andric
PrintAsmOperand(const MachineInstr * MI,unsigned OpNum,const char * ExtraCode,raw_ostream & O)1010b57cec5SDimitry Andric bool AVRAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
1020b57cec5SDimitry Andric const char *ExtraCode, raw_ostream &O) {
1030b57cec5SDimitry Andric // Default asm printer can only deal with some extra codes,
1040b57cec5SDimitry Andric // so try it first.
10506c3fb27SDimitry Andric if (!AsmPrinter::PrintAsmOperand(MI, OpNum, ExtraCode, O))
10606c3fb27SDimitry Andric return false;
1070b57cec5SDimitry Andric
10806c3fb27SDimitry Andric const MachineOperand &MO = MI->getOperand(OpNum);
1090b57cec5SDimitry Andric
11006c3fb27SDimitry Andric if (ExtraCode && ExtraCode[0]) {
11106c3fb27SDimitry Andric // Unknown extra code.
11206c3fb27SDimitry Andric if (ExtraCode[1] != 0 || ExtraCode[0] < 'A' || ExtraCode[0] > 'Z')
11306c3fb27SDimitry Andric return true;
1140b57cec5SDimitry Andric
11506c3fb27SDimitry Andric // Operand must be a register when using 'A' ~ 'Z' extra code.
11606c3fb27SDimitry Andric if (!MO.isReg())
11706c3fb27SDimitry Andric return true;
11806c3fb27SDimitry Andric
11906c3fb27SDimitry Andric Register Reg = MO.getReg();
1200b57cec5SDimitry Andric
1210b57cec5SDimitry Andric unsigned ByteNumber = ExtraCode[0] - 'A';
1225f757f3fSDimitry Andric const InlineAsm::Flag OpFlags(MI->getOperand(OpNum - 1).getImm());
1235f757f3fSDimitry Andric const unsigned NumOpRegs = OpFlags.getNumOperandRegisters();
1240b57cec5SDimitry Andric
1250b57cec5SDimitry Andric const AVRSubtarget &STI = MF->getSubtarget<AVRSubtarget>();
1260b57cec5SDimitry Andric const TargetRegisterInfo &TRI = *STI.getRegisterInfo();
1270b57cec5SDimitry Andric
1280b57cec5SDimitry Andric const TargetRegisterClass *RC = TRI.getMinimalPhysRegClass(Reg);
1290b57cec5SDimitry Andric unsigned BytesPerReg = TRI.getRegSizeInBits(*RC) / 8;
1300b57cec5SDimitry Andric assert(BytesPerReg <= 2 && "Only 8 and 16 bit regs are supported.");
1310b57cec5SDimitry Andric
1320b57cec5SDimitry Andric unsigned RegIdx = ByteNumber / BytesPerReg;
133bdd1243dSDimitry Andric if (RegIdx >= NumOpRegs)
134bdd1243dSDimitry Andric return true;
1350b57cec5SDimitry Andric Reg = MI->getOperand(OpNum + RegIdx).getReg();
1360b57cec5SDimitry Andric
1370b57cec5SDimitry Andric if (BytesPerReg == 2) {
138*0fca6ea1SDimitry Andric Reg = TRI.getSubReg(Reg, (ByteNumber % BytesPerReg) ? AVR::sub_hi
139*0fca6ea1SDimitry Andric : AVR::sub_lo);
1400b57cec5SDimitry Andric }
1410b57cec5SDimitry Andric
1420b57cec5SDimitry Andric O << AVRInstPrinter::getPrettyRegisterName(Reg, MRI);
1430b57cec5SDimitry Andric return false;
1440b57cec5SDimitry Andric }
1450b57cec5SDimitry Andric
14606c3fb27SDimitry Andric if (MO.getType() == MachineOperand::MO_GlobalAddress)
14706c3fb27SDimitry Andric PrintSymbolOperand(MO, O); // Print global symbols.
14806c3fb27SDimitry Andric else
14906c3fb27SDimitry Andric printOperand(MI, OpNum, O); // Fallback to ordinary cases.
1500b57cec5SDimitry Andric
1510b57cec5SDimitry Andric return false;
1520b57cec5SDimitry Andric }
1530b57cec5SDimitry Andric
PrintAsmMemoryOperand(const MachineInstr * MI,unsigned OpNum,const char * ExtraCode,raw_ostream & O)1540b57cec5SDimitry Andric bool AVRAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
1550b57cec5SDimitry Andric unsigned OpNum, const char *ExtraCode,
1560b57cec5SDimitry Andric raw_ostream &O) {
157349cc55cSDimitry Andric if (ExtraCode && ExtraCode[0])
158349cc55cSDimitry Andric return true; // Unknown modifier
1590b57cec5SDimitry Andric
1600b57cec5SDimitry Andric const MachineOperand &MO = MI->getOperand(OpNum);
1610b57cec5SDimitry Andric (void)MO;
1620b57cec5SDimitry Andric assert(MO.isReg() && "Unexpected inline asm memory operand");
1630b57cec5SDimitry Andric
1640b57cec5SDimitry Andric // TODO: We should be able to look up the alternative name for
1650b57cec5SDimitry Andric // the register if it's given.
1660b57cec5SDimitry Andric // TableGen doesn't expose a way of getting retrieving names
1670b57cec5SDimitry Andric // for registers.
1680b57cec5SDimitry Andric if (MI->getOperand(OpNum).getReg() == AVR::R31R30) {
1690b57cec5SDimitry Andric O << "Z";
170bdd1243dSDimitry Andric } else if (MI->getOperand(OpNum).getReg() == AVR::R29R28) {
1710b57cec5SDimitry Andric O << "Y";
172bdd1243dSDimitry Andric } else if (MI->getOperand(OpNum).getReg() == AVR::R27R26) {
173bdd1243dSDimitry Andric O << "X";
174bdd1243dSDimitry Andric } else {
175bdd1243dSDimitry Andric assert(false && "Wrong register class for memory operand.");
1760b57cec5SDimitry Andric }
1770b57cec5SDimitry Andric
1780b57cec5SDimitry Andric // If NumOpRegs == 2, then we assume it is product of a FrameIndex expansion
1790b57cec5SDimitry Andric // and the second operand is an Imm.
1805f757f3fSDimitry Andric const InlineAsm::Flag OpFlags(MI->getOperand(OpNum - 1).getImm());
1815f757f3fSDimitry Andric const unsigned NumOpRegs = OpFlags.getNumOperandRegisters();
1820b57cec5SDimitry Andric
1830b57cec5SDimitry Andric if (NumOpRegs == 2) {
184bdd1243dSDimitry Andric assert(MI->getOperand(OpNum).getReg() != AVR::R27R26 &&
185bdd1243dSDimitry Andric "Base register X can not have offset/displacement.");
1860b57cec5SDimitry Andric O << '+' << MI->getOperand(OpNum + 1).getImm();
1870b57cec5SDimitry Andric }
1880b57cec5SDimitry Andric
1890b57cec5SDimitry Andric return false;
1900b57cec5SDimitry Andric }
1910b57cec5SDimitry Andric
emitInstruction(const MachineInstr * MI)1925ffd83dbSDimitry Andric void AVRAsmPrinter::emitInstruction(const MachineInstr *MI) {
19306c3fb27SDimitry Andric AVR_MC::verifyInstructionPredicates(MI->getOpcode(),
19406c3fb27SDimitry Andric getSubtargetInfo().getFeatureBits());
195753f127fSDimitry Andric
1960b57cec5SDimitry Andric AVRMCInstLower MCInstLowering(OutContext, *this);
1970b57cec5SDimitry Andric
1980b57cec5SDimitry Andric MCInst I;
1990b57cec5SDimitry Andric MCInstLowering.lowerInstruction(*MI, I);
2000b57cec5SDimitry Andric EmitToStreamer(*OutStreamer, I);
2010b57cec5SDimitry Andric }
2020b57cec5SDimitry Andric
lowerConstant(const Constant * CV)203fe6060f1SDimitry Andric const MCExpr *AVRAsmPrinter::lowerConstant(const Constant *CV) {
204fe6060f1SDimitry Andric MCContext &Ctx = OutContext;
205fe6060f1SDimitry Andric
206fe6060f1SDimitry Andric if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV)) {
207fe6060f1SDimitry Andric bool IsProgMem = GV->getAddressSpace() == AVR::ProgramMemory;
208fe6060f1SDimitry Andric if (IsProgMem) {
209fe6060f1SDimitry Andric const MCExpr *Expr = MCSymbolRefExpr::create(getSymbol(GV), Ctx);
210fe6060f1SDimitry Andric return AVRMCExpr::create(AVRMCExpr::VK_AVR_PM, Expr, false, Ctx);
211fe6060f1SDimitry Andric }
212fe6060f1SDimitry Andric }
213fe6060f1SDimitry Andric
214fe6060f1SDimitry Andric return AsmPrinter::lowerConstant(CV);
215fe6060f1SDimitry Andric }
216fe6060f1SDimitry Andric
emitXXStructor(const DataLayout & DL,const Constant * CV)217349cc55cSDimitry Andric void AVRAsmPrinter::emitXXStructor(const DataLayout &DL, const Constant *CV) {
218349cc55cSDimitry Andric if (!EmittedStructorSymbolAttrs) {
219349cc55cSDimitry Andric OutStreamer->emitRawComment(
220349cc55cSDimitry Andric " Emitting these undefined symbol references causes us to link the"
221349cc55cSDimitry Andric " libgcc code that runs our constructors/destructors");
222349cc55cSDimitry Andric OutStreamer->emitRawComment(" This matches GCC's behavior");
223349cc55cSDimitry Andric
224349cc55cSDimitry Andric MCSymbol *CtorsSym = OutContext.getOrCreateSymbol("__do_global_ctors");
225349cc55cSDimitry Andric OutStreamer->emitSymbolAttribute(CtorsSym, MCSA_Global);
226349cc55cSDimitry Andric
227349cc55cSDimitry Andric MCSymbol *DtorsSym = OutContext.getOrCreateSymbol("__do_global_dtors");
228349cc55cSDimitry Andric OutStreamer->emitSymbolAttribute(DtorsSym, MCSA_Global);
229349cc55cSDimitry Andric
230349cc55cSDimitry Andric EmittedStructorSymbolAttrs = true;
231349cc55cSDimitry Andric }
232349cc55cSDimitry Andric
233349cc55cSDimitry Andric AsmPrinter::emitXXStructor(DL, CV);
234349cc55cSDimitry Andric }
235349cc55cSDimitry Andric
doFinalization(Module & M)236349cc55cSDimitry Andric bool AVRAsmPrinter::doFinalization(Module &M) {
237bdd1243dSDimitry Andric const TargetLoweringObjectFile &TLOF = getObjFileLowering();
238bdd1243dSDimitry Andric const AVRTargetMachine &TM = (const AVRTargetMachine &)MMI->getTarget();
239bdd1243dSDimitry Andric const AVRSubtarget *SubTM = (const AVRSubtarget *)TM.getSubtargetImpl();
240bdd1243dSDimitry Andric
241bdd1243dSDimitry Andric bool NeedsCopyData = false;
242bdd1243dSDimitry Andric bool NeedsClearBSS = false;
243bdd1243dSDimitry Andric for (const auto &GO : M.globals()) {
244bdd1243dSDimitry Andric if (!GO.hasInitializer() || GO.hasAvailableExternallyLinkage())
245bdd1243dSDimitry Andric // These globals aren't defined in the current object file.
246bdd1243dSDimitry Andric continue;
247bdd1243dSDimitry Andric
248bdd1243dSDimitry Andric if (GO.hasCommonLinkage()) {
249bdd1243dSDimitry Andric // COMMON symbols are put in .bss.
250bdd1243dSDimitry Andric NeedsClearBSS = true;
251bdd1243dSDimitry Andric continue;
252bdd1243dSDimitry Andric }
253bdd1243dSDimitry Andric
254bdd1243dSDimitry Andric auto *Section = cast<MCSectionELF>(TLOF.SectionForGlobal(&GO, TM));
2555f757f3fSDimitry Andric if (Section->getName().starts_with(".data"))
256bdd1243dSDimitry Andric NeedsCopyData = true;
2575f757f3fSDimitry Andric else if (Section->getName().starts_with(".rodata") && SubTM->hasLPM())
25806c3fb27SDimitry Andric // AVRs that have a separate program memory (that's most AVRs) store
25906c3fb27SDimitry Andric // .rodata sections in RAM.
260bdd1243dSDimitry Andric NeedsCopyData = true;
2615f757f3fSDimitry Andric else if (Section->getName().starts_with(".bss"))
262bdd1243dSDimitry Andric NeedsClearBSS = true;
263bdd1243dSDimitry Andric }
264bdd1243dSDimitry Andric
265349cc55cSDimitry Andric MCSymbol *DoCopyData = OutContext.getOrCreateSymbol("__do_copy_data");
266349cc55cSDimitry Andric MCSymbol *DoClearBss = OutContext.getOrCreateSymbol("__do_clear_bss");
267349cc55cSDimitry Andric
268bdd1243dSDimitry Andric if (NeedsCopyData) {
269349cc55cSDimitry Andric OutStreamer->emitRawComment(
270349cc55cSDimitry Andric " Declaring this symbol tells the CRT that it should");
271349cc55cSDimitry Andric OutStreamer->emitRawComment(
272349cc55cSDimitry Andric "copy all variables from program memory to RAM on startup");
273349cc55cSDimitry Andric OutStreamer->emitSymbolAttribute(DoCopyData, MCSA_Global);
274bdd1243dSDimitry Andric }
275349cc55cSDimitry Andric
276bdd1243dSDimitry Andric if (NeedsClearBSS) {
277349cc55cSDimitry Andric OutStreamer->emitRawComment(
278349cc55cSDimitry Andric " Declaring this symbol tells the CRT that it should");
279349cc55cSDimitry Andric OutStreamer->emitRawComment("clear the zeroed data section on startup");
280349cc55cSDimitry Andric OutStreamer->emitSymbolAttribute(DoClearBss, MCSA_Global);
281bdd1243dSDimitry Andric }
282349cc55cSDimitry Andric
283349cc55cSDimitry Andric return AsmPrinter::doFinalization(M);
284349cc55cSDimitry Andric }
285349cc55cSDimitry Andric
emitStartOfAsmFile(Module & M)28681ad6265SDimitry Andric void AVRAsmPrinter::emitStartOfAsmFile(Module &M) {
28781ad6265SDimitry Andric const AVRTargetMachine &TM = (const AVRTargetMachine &)MMI->getTarget();
28881ad6265SDimitry Andric const AVRSubtarget *SubTM = (const AVRSubtarget *)TM.getSubtargetImpl();
28981ad6265SDimitry Andric if (!SubTM)
29081ad6265SDimitry Andric return;
29181ad6265SDimitry Andric
29281ad6265SDimitry Andric // Emit __tmp_reg__.
29381ad6265SDimitry Andric OutStreamer->emitAssignment(
29481ad6265SDimitry Andric MMI->getContext().getOrCreateSymbol(StringRef("__tmp_reg__")),
29581ad6265SDimitry Andric MCConstantExpr::create(SubTM->getRegTmpIndex(), MMI->getContext()));
29681ad6265SDimitry Andric // Emit __zero_reg__.
29781ad6265SDimitry Andric OutStreamer->emitAssignment(
29881ad6265SDimitry Andric MMI->getContext().getOrCreateSymbol(StringRef("__zero_reg__")),
29981ad6265SDimitry Andric MCConstantExpr::create(SubTM->getRegZeroIndex(), MMI->getContext()));
30081ad6265SDimitry Andric // Emit __SREG__.
30181ad6265SDimitry Andric OutStreamer->emitAssignment(
30281ad6265SDimitry Andric MMI->getContext().getOrCreateSymbol(StringRef("__SREG__")),
30381ad6265SDimitry Andric MCConstantExpr::create(SubTM->getIORegSREG(), MMI->getContext()));
30481ad6265SDimitry Andric // Emit __SP_H__ if available.
30581ad6265SDimitry Andric if (!SubTM->hasSmallStack())
30681ad6265SDimitry Andric OutStreamer->emitAssignment(
30781ad6265SDimitry Andric MMI->getContext().getOrCreateSymbol(StringRef("__SP_H__")),
30881ad6265SDimitry Andric MCConstantExpr::create(SubTM->getIORegSPH(), MMI->getContext()));
30981ad6265SDimitry Andric // Emit __SP_L__.
31081ad6265SDimitry Andric OutStreamer->emitAssignment(
31181ad6265SDimitry Andric MMI->getContext().getOrCreateSymbol(StringRef("__SP_L__")),
31281ad6265SDimitry Andric MCConstantExpr::create(SubTM->getIORegSPL(), MMI->getContext()));
31381ad6265SDimitry Andric // Emit __EIND__ if available.
31481ad6265SDimitry Andric if (SubTM->hasEIJMPCALL())
31581ad6265SDimitry Andric OutStreamer->emitAssignment(
31681ad6265SDimitry Andric MMI->getContext().getOrCreateSymbol(StringRef("__EIND__")),
31781ad6265SDimitry Andric MCConstantExpr::create(SubTM->getIORegEIND(), MMI->getContext()));
31881ad6265SDimitry Andric // Emit __RAMPZ__ if available.
31981ad6265SDimitry Andric if (SubTM->hasELPM())
32081ad6265SDimitry Andric OutStreamer->emitAssignment(
32181ad6265SDimitry Andric MMI->getContext().getOrCreateSymbol(StringRef("__RAMPZ__")),
32281ad6265SDimitry Andric MCConstantExpr::create(SubTM->getIORegRAMPZ(), MMI->getContext()));
32381ad6265SDimitry Andric }
32481ad6265SDimitry Andric
3250b57cec5SDimitry Andric } // end of namespace llvm
3260b57cec5SDimitry Andric
LLVMInitializeAVRAsmPrinter()327480093f4SDimitry Andric extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAVRAsmPrinter() {
3280b57cec5SDimitry Andric llvm::RegisterAsmPrinter<llvm::AVRAsmPrinter> X(llvm::getTheAVRTarget());
3290b57cec5SDimitry Andric }
330