Index: lib/Target/NDS32/CMakeLists.txt =================================================================== --- lib/Target/NDS32/CMakeLists.txt +++ lib/Target/NDS32/CMakeLists.txt @@ -12,6 +12,7 @@ add_llvm_target(NDS32CodeGen NDS32ISelDAGToDAG.cpp NDS32ISelLowering.cpp + NDS32MachineFunctionInfo.cpp NDS32TargetMachine.cpp ) Index: lib/Target/NDS32/NDS32MachineFunctionInfo.h =================================================================== --- /dev/null +++ lib/Target/NDS32/NDS32MachineFunctionInfo.h @@ -0,0 +1,54 @@ +//=== NDS32MachineFunctionInfo.h - NDS32 machine function info -*- C++ -*---==// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file declares NDS32-specific per-machine-function information. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIB_TARGET_NDS32_NDS32MACHINEFUNCTIONINFO_H +#define LLVM_LIB_TARGET_NDS32_NDS32MACHINEFUNCTIONINFO_H + +#include "llvm/CodeGen/MachineFunction.h" + +namespace llvm { + +/// NDS32MachineFunctionInfo - This class is derived from MachineFunction and +/// contains private NDS32 target-specific information for each MachineFunction. +class NDS32MachineFunctionInfo : public MachineFunctionInfo { + virtual void anchor(); + + /// CalleeSavedFrameSize - Size of the callee-saved register portion of the + /// stack frame in bytes. + unsigned CalleeSavedFrameSize; + + /// ReturnAddrIndex - FrameIndex for return slot. + int ReturnAddrIndex; + + /// VarArgsFrameIndex - FrameIndex for start of varargs area. + int VarArgsFrameIndex; + +public: + NDS32MachineFunctionInfo() : CalleeSavedFrameSize(0) {} + + explicit NDS32MachineFunctionInfo(MachineFunction &MF) + : CalleeSavedFrameSize(0), ReturnAddrIndex(0) {} + + unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; } + void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; } + + int getRAIndex() const { return ReturnAddrIndex; } + void setRAIndex(int Index) { ReturnAddrIndex = Index; } + + int getVarArgsFrameIndex() const { return VarArgsFrameIndex;} + void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; } +}; + +} // End llvm namespace + +#endif Index: lib/Target/NDS32/NDS32MachineFunctionInfo.cpp =================================================================== --- /dev/null +++ lib/Target/NDS32/NDS32MachineFunctionInfo.cpp @@ -0,0 +1,14 @@ +//===-- NDS32MachineFunctionInfo.cpp - NDS32 machine function info --------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "NDS32MachineFunctionInfo.h" + +using namespace llvm; + +void NDS32MachineFunctionInfo::anchor() { }