Dylan McKay | 5c96de3 | 2016-01-07 10:53:15 +0000 | [diff] [blame] | 1 | //===-- AVR.h - Top-level interface for AVR representation ------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the entry points for global functions defined in the LLVM |
| 11 | // AVR back-end. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_AVR_H |
| 16 | #define LLVM_AVR_H |
| 17 | |
Dylan McKay | 5c96de3 | 2016-01-07 10:53:15 +0000 | [diff] [blame] | 18 | #include "llvm/CodeGen/SelectionDAGNodes.h" |
Chandler Carruth | 6bda14b | 2017-06-06 11:49:48 +0000 | [diff] [blame] | 19 | #include "llvm/Target/TargetMachine.h" |
Dylan McKay | 5c96de3 | 2016-01-07 10:53:15 +0000 | [diff] [blame] | 20 | |
| 21 | namespace llvm { |
| 22 | |
| 23 | class AVRTargetMachine; |
| 24 | class FunctionPass; |
| 25 | |
| 26 | FunctionPass *createAVRISelDag(AVRTargetMachine &TM, |
| 27 | CodeGenOpt::Level OptLevel); |
| 28 | FunctionPass *createAVRExpandPseudoPass(); |
| 29 | FunctionPass *createAVRFrameAnalyzerPass(); |
Dylan McKay | 1e57fa4 | 2016-12-13 05:53:14 +0000 | [diff] [blame] | 30 | FunctionPass *createAVRRelaxMemPass(); |
Dylan McKay | 5c96de3 | 2016-01-07 10:53:15 +0000 | [diff] [blame] | 31 | FunctionPass *createAVRDynAllocaSRPass(); |
| 32 | FunctionPass *createAVRBranchSelectionPass(); |
| 33 | |
Dylan McKay | 8cec7eb | 2016-12-07 11:08:56 +0000 | [diff] [blame] | 34 | void initializeAVRExpandPseudoPass(PassRegistry&); |
Dylan McKay | 1e57fa4 | 2016-12-13 05:53:14 +0000 | [diff] [blame] | 35 | void initializeAVRRelaxMemPass(PassRegistry&); |
Dylan McKay | 8cec7eb | 2016-12-07 11:08:56 +0000 | [diff] [blame] | 36 | |
Dylan McKay | d56676e | 2016-05-18 09:43:01 +0000 | [diff] [blame] | 37 | /// Contains the AVR backend. |
Dylan McKay | 5c96de3 | 2016-01-07 10:53:15 +0000 | [diff] [blame] | 38 | namespace AVR { |
| 39 | |
| 40 | enum AddressSpace { DataMemory, ProgramMemory }; |
| 41 | |
| 42 | template <typename T> bool isProgramMemoryAddress(T *V) { |
| 43 | return cast<PointerType>(V->getType())->getAddressSpace() == ProgramMemory; |
| 44 | } |
| 45 | |
| 46 | inline bool isProgramMemoryAccess(MemSDNode const *N) { |
| 47 | auto V = N->getMemOperand()->getValue(); |
| 48 | |
| 49 | return (V != nullptr) ? isProgramMemoryAddress(V) : false; |
| 50 | } |
| 51 | |
| 52 | } // end of namespace AVR |
| 53 | |
| 54 | } // end namespace llvm |
| 55 | |
| 56 | #endif // LLVM_AVR_H |