blob: 5eadf7bdcef6a4b803c159bb8b7aa868a869b2e2 [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 McKay3abd1d32016-12-14 10:15:00 +000030FunctionPass *createAVRInstrumentFunctionsPass();
Dylan McKay1e57fa42016-12-13 05:53:14 +000031FunctionPass *createAVRRelaxMemPass();
Dylan McKay5c96de32016-01-07 10:53:15 +000032FunctionPass *createAVRDynAllocaSRPass();
33FunctionPass *createAVRBranchSelectionPass();
34
Dylan McKay8cec7eb2016-12-07 11:08:56 +000035void initializeAVRExpandPseudoPass(PassRegistry&);
Dylan McKay3abd1d32016-12-14 10:15:00 +000036void initializeAVRInstrumentFunctionsPass(PassRegistry&);
Dylan McKay1e57fa42016-12-13 05:53:14 +000037void initializeAVRRelaxMemPass(PassRegistry&);
Dylan McKay8cec7eb2016-12-07 11:08:56 +000038
Dylan McKayd56676e2016-05-18 09:43:01 +000039/// Contains the AVR backend.
Dylan McKay5c96de32016-01-07 10:53:15 +000040namespace AVR {
41
42enum AddressSpace { DataMemory, ProgramMemory };
43
44template <typename T> bool isProgramMemoryAddress(T *V) {
45 return cast<PointerType>(V->getType())->getAddressSpace() == ProgramMemory;
46}
47
48inline bool isProgramMemoryAccess(MemSDNode const *N) {
49 auto V = N->getMemOperand()->getValue();
50
51 return (V != nullptr) ? isProgramMemoryAddress(V) : false;
52}
53
54} // end of namespace AVR
55
56} // end namespace llvm
57
58#endif // LLVM_AVR_H