1 //===-- AVR.h - Top-level interface for AVR representation ------*- C++ -*-===// 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 contains the entry points for global functions defined in the LLVM 10 // AVR back-end. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_AVR_H 15 #define LLVM_AVR_H 16 17 #include "llvm/CodeGen/SelectionDAGNodes.h" 18 #include "llvm/Target/TargetMachine.h" 19 20 namespace llvm { 21 22 class AVRTargetMachine; 23 class FunctionPass; 24 25 Pass *createAVRShiftExpandPass(); 26 FunctionPass *createAVRISelDag(AVRTargetMachine &TM, 27 CodeGenOpt::Level OptLevel); 28 FunctionPass *createAVRExpandPseudoPass(); 29 FunctionPass *createAVRFrameAnalyzerPass(); 30 FunctionPass *createAVRRelaxMemPass(); 31 FunctionPass *createAVRDynAllocaSRPass(); 32 FunctionPass *createAVRBranchSelectionPass(); 33 34 void initializeAVRShiftExpandPass(PassRegistry &); 35 void initializeAVRExpandPseudoPass(PassRegistry&); 36 void initializeAVRRelaxMemPass(PassRegistry&); 37 38 /// Contains the AVR backend. 39 namespace AVR { 40 41 /// An integer that identifies all of the supported AVR address spaces. 42 enum AddressSpace { DataMemory, ProgramMemory }; 43 44 /// Checks if a given type is a pointer to program memory. 45 template <typename T> bool isProgramMemoryAddress(T *V) { 46 return cast<PointerType>(V->getType())->getAddressSpace() == ProgramMemory; 47 } 48 49 inline bool isProgramMemoryAccess(MemSDNode const *N) { 50 auto V = N->getMemOperand()->getValue(); 51 52 return (V != nullptr) ? isProgramMemoryAddress(V) : false; 53 } 54 55 } // end of namespace AVR 56 57 } // end namespace llvm 58 59 #endif // LLVM_AVR_H 60