| Dylan McKay | 5c96de3 | 2016-01-07 10:53:15 +0000 | [diff] [blame] | 1 | //===-- AVR.h - Top-level interface for AVR representation ------*- C++ -*-===// | 
|  | 2 | // | 
| Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 | 
| Dylan McKay | 5c96de3 | 2016-01-07 10:53:15 +0000 | [diff] [blame] | 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 |  | 
| Dylan McKay | 5c96de3 | 2016-01-07 10:53:15 +0000 | [diff] [blame] | 17 | #include "llvm/CodeGen/SelectionDAGNodes.h" | 
| Chandler Carruth | 6bda14b | 2017-06-06 11:49:48 +0000 | [diff] [blame] | 18 | #include "llvm/Target/TargetMachine.h" | 
| Dylan McKay | 5c96de3 | 2016-01-07 10:53:15 +0000 | [diff] [blame] | 19 |  | 
|  | 20 | namespace llvm { | 
|  | 21 |  | 
|  | 22 | class AVRTargetMachine; | 
|  | 23 | class FunctionPass; | 
|  | 24 |  | 
|  | 25 | FunctionPass *createAVRISelDag(AVRTargetMachine &TM, | 
|  | 26 | CodeGenOpt::Level OptLevel); | 
|  | 27 | FunctionPass *createAVRExpandPseudoPass(); | 
|  | 28 | FunctionPass *createAVRFrameAnalyzerPass(); | 
| Dylan McKay | 1e57fa4 | 2016-12-13 05:53:14 +0000 | [diff] [blame] | 29 | FunctionPass *createAVRRelaxMemPass(); | 
| Dylan McKay | 5c96de3 | 2016-01-07 10:53:15 +0000 | [diff] [blame] | 30 | FunctionPass *createAVRDynAllocaSRPass(); | 
|  | 31 | FunctionPass *createAVRBranchSelectionPass(); | 
|  | 32 |  | 
| Dylan McKay | 8cec7eb | 2016-12-07 11:08:56 +0000 | [diff] [blame] | 33 | void initializeAVRExpandPseudoPass(PassRegistry&); | 
| Dylan McKay | 1e57fa4 | 2016-12-13 05:53:14 +0000 | [diff] [blame] | 34 | void initializeAVRRelaxMemPass(PassRegistry&); | 
| Dylan McKay | 8cec7eb | 2016-12-07 11:08:56 +0000 | [diff] [blame] | 35 |  | 
| Dylan McKay | d56676e | 2016-05-18 09:43:01 +0000 | [diff] [blame] | 36 | /// Contains the AVR backend. | 
| Dylan McKay | 5c96de3 | 2016-01-07 10:53:15 +0000 | [diff] [blame] | 37 | namespace AVR { | 
|  | 38 |  | 
| Dylan McKay | 0603bae | 2018-07-15 07:24:27 +0000 | [diff] [blame] | 39 | /// An integer that identifies all of the supported AVR address spaces. | 
| Dylan McKay | 5c96de3 | 2016-01-07 10:53:15 +0000 | [diff] [blame] | 40 | enum AddressSpace { DataMemory, ProgramMemory }; | 
|  | 41 |  | 
| Dylan McKay | 0603bae | 2018-07-15 07:24:27 +0000 | [diff] [blame] | 42 | /// Checks if a given type is a pointer to program memory. | 
| Dylan McKay | 5c96de3 | 2016-01-07 10:53:15 +0000 | [diff] [blame] | 43 | template <typename T> bool isProgramMemoryAddress(T *V) { | 
|  | 44 | return cast<PointerType>(V->getType())->getAddressSpace() == ProgramMemory; | 
|  | 45 | } | 
|  | 46 |  | 
|  | 47 | inline bool isProgramMemoryAccess(MemSDNode const *N) { | 
|  | 48 | auto V = N->getMemOperand()->getValue(); | 
|  | 49 |  | 
|  | 50 | return (V != nullptr) ? isProgramMemoryAddress(V) : false; | 
|  | 51 | } | 
|  | 52 |  | 
|  | 53 | } // end of namespace AVR | 
|  | 54 |  | 
|  | 55 | } // end namespace llvm | 
|  | 56 |  | 
|  | 57 | #endif // LLVM_AVR_H |