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
18#include "llvm/Target/TargetMachine.h"
19#include "llvm/CodeGen/SelectionDAGNodes.h"
20
21namespace llvm {
22
23class AVRTargetMachine;
24class FunctionPass;
25
26FunctionPass *createAVRISelDag(AVRTargetMachine &TM,
27                               CodeGenOpt::Level OptLevel);
28FunctionPass *createAVRExpandPseudoPass();
29FunctionPass *createAVRFrameAnalyzerPass();
30FunctionPass *createAVRDynAllocaSRPass();
31FunctionPass *createAVRBranchSelectionPass();
32
33/**
34 * Contains the AVR backend.
35 */
36namespace AVR {
37
38enum AddressSpace { DataMemory, ProgramMemory };
39
40template <typename T> bool isProgramMemoryAddress(T *V) {
41  return cast<PointerType>(V->getType())->getAddressSpace() == ProgramMemory;
42}
43
44inline bool isProgramMemoryAccess(MemSDNode const *N) {
45  auto V = N->getMemOperand()->getValue();
46
47  return (V != nullptr) ? isProgramMemoryAddress(V) : false;
48}
49
50} // end of namespace AVR
51
52} // end namespace llvm
53
54#endif // LLVM_AVR_H
55