[PATCH] D28648: [NDS32 11/22] add NDS32 Machine Function Info
Shiva Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 12 23:24:06 PST 2017
shiva0217 created this revision.
shiva0217 added a subscriber: llvm-commits.
Herald added a subscriber: mgorny.
Add NDS32 Machine Function Info
which contain target specific function info for helping prolog/endprolog code generation
https://reviews.llvm.org/D28648
Files:
lib/Target/NDS32/CMakeLists.txt
lib/Target/NDS32/NDS32MachineFunctionInfo.cpp
lib/Target/NDS32/NDS32MachineFunctionInfo.h
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() { }
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
)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28648.84238.patch
Type: text/x-patch
Size: 3105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170113/bea65e3f/attachment.bin>
More information about the llvm-commits
mailing list