blob: 2535b63dccdd1ba35614e6406944b39da964e234 [file] [log] [blame]
Dylan McKay5c96de32016-01-07 10:53:15 +00001//===-- 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 McKay5c96de32016-01-07 10:53:15 +000018#include "llvm/CodeGen/SelectionDAGNodes.h"
Chandler Carruth6bda14b2017-06-06 11:49:48 +000019#include "llvm/Target/TargetMachine.h"
Dylan McKay5c96de32016-01-07 10:53:15 +000020
21namespace llvm {
22
23class AVRTargetMachine;
24class FunctionPass;
25
26FunctionPass *createAVRISelDag(AVRTargetMachine &TM,
27 CodeGenOpt::Level OptLevel);
28FunctionPass *createAVRExpandPseudoPass();
29FunctionPass *createAVRFrameAnalyzerPass();
Dylan McKay1e57fa42016-12-13 05:53:14 +000030FunctionPass *createAVRRelaxMemPass();
Dylan McKay5c96de32016-01-07 10:53:15 +000031FunctionPass *createAVRDynAllocaSRPass();
32FunctionPass *createAVRBranchSelectionPass();
33
Dylan McKay8cec7eb2016-12-07 11:08:56 +000034void initializeAVRExpandPseudoPass(PassRegistry&);
Dylan McKay1e57fa42016-12-13 05:53:14 +000035void initializeAVRRelaxMemPass(PassRegistry&);
Dylan McKay8cec7eb2016-12-07 11:08:56 +000036
Dylan McKayd56676e2016-05-18 09:43:01 +000037/// Contains the AVR backend.
Dylan McKay5c96de32016-01-07 10:53:15 +000038namespace AVR {
39
40enum AddressSpace { DataMemory, ProgramMemory };
41
42template <typename T> bool isProgramMemoryAddress(T *V) {
43 return cast<PointerType>(V->getType())->getAddressSpace() == ProgramMemory;
44}
45
46inline 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