Path: blob/main/contrib/llvm-project/llvm/lib/Target/AVR/AVRMachineFunctionInfo.h
35266 views
//===-- AVRMachineFuctionInfo.h - AVR machine function info -----*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file declares AVR-specific per-machine-function information.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_AVR_MACHINE_FUNCTION_INFO_H13#define LLVM_AVR_MACHINE_FUNCTION_INFO_H1415#include "llvm/CodeGen/MachineFunction.h"1617namespace llvm {1819/// Contains AVR-specific information for each MachineFunction.20class AVRMachineFunctionInfo : public MachineFunctionInfo {21/// Indicates if a register has been spilled by the register22/// allocator.23bool HasSpills;2425/// Indicates if there are any fixed size allocas present.26/// Note that if there are only variable sized allocas this is set to false.27bool HasAllocas;2829/// Indicates if arguments passed using the stack are being30/// used inside the function.31bool HasStackArgs;3233/// Whether or not the function is an interrupt handler.34bool IsInterruptHandler;3536/// Whether or not the function is an non-blocking interrupt handler.37bool IsSignalHandler;3839/// Size of the callee-saved register portion of the40/// stack frame in bytes.41unsigned CalleeSavedFrameSize;4243/// FrameIndex for start of varargs area.44int VarArgsFrameIndex;4546public:47AVRMachineFunctionInfo(const Function &F, const TargetSubtargetInfo *STI)48: HasSpills(false), HasAllocas(false), HasStackArgs(false),49CalleeSavedFrameSize(0), VarArgsFrameIndex(0) {50CallingConv::ID CallConv = F.getCallingConv();5152this->IsInterruptHandler =53CallConv == CallingConv::AVR_INTR || F.hasFnAttribute("interrupt");54this->IsSignalHandler =55CallConv == CallingConv::AVR_SIGNAL || F.hasFnAttribute("signal");56}5758MachineFunctionInfo *59clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,60const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)61const override {62return DestMF.cloneInfo<AVRMachineFunctionInfo>(*this);63}6465bool getHasSpills() const { return HasSpills; }66void setHasSpills(bool B) { HasSpills = B; }6768bool getHasAllocas() const { return HasAllocas; }69void setHasAllocas(bool B) { HasAllocas = B; }7071bool getHasStackArgs() const { return HasStackArgs; }72void setHasStackArgs(bool B) { HasStackArgs = B; }7374/// Checks if the function is some form of interrupt service routine.75bool isInterruptOrSignalHandler() const {76return isInterruptHandler() || isSignalHandler();77}7879bool isInterruptHandler() const { return IsInterruptHandler; }80bool isSignalHandler() const { return IsSignalHandler; }8182unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }83void setCalleeSavedFrameSize(unsigned Bytes) { CalleeSavedFrameSize = Bytes; }8485int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }86void setVarArgsFrameIndex(int Idx) { VarArgsFrameIndex = Idx; }87};8889} // namespace llvm9091#endif // LLVM_AVR_MACHINE_FUNCTION_INFO_H929394