[llvm-commits] [llvm] r158427 - /llvm/trunk/lib/Target/Mips/MipsMachineFunction.h
Akira Hatanaka
ahatanaka at mips.com
Wed Jun 13 18:15:36 PDT 2012
Author: ahatanak
Date: Wed Jun 13 20:15:36 2012
New Revision: 158427
URL: http://llvm.org/viewvc/llvm-project?rev=158427&view=rev
Log:
Add methods to MipsFunctionInfo for initializing and accessing the stack frame
object for the global base register.
This is the first of a series of patches which implements long branch expansion
for MIPS.
Modified:
llvm/trunk/lib/Target/Mips/MipsMachineFunction.h
Modified: llvm/trunk/lib/Target/Mips/MipsMachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsMachineFunction.h?rev=158427&r1=158426&r2=158427&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsMachineFunction.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsMachineFunction.h Wed Jun 13 20:15:36 2012
@@ -14,8 +14,11 @@
#ifndef MIPS_MACHINE_FUNCTION_INFO_H
#define MIPS_MACHINE_FUNCTION_INFO_H
+#include "MipsSubtarget.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
+#include "llvm/Target/TargetFrameLowering.h"
+#include "llvm/Target/TargetMachine.h"
#include <utility>
namespace llvm {
@@ -45,6 +48,7 @@
// OutArgFIRange: Range of indices of all frame objects created during call to
// LowerCall except for the frame object for restoring $gp.
std::pair<int, int> InArgFIRange, OutArgFIRange;
+ int GlobalRegFI;
mutable int DynAllocFI; // Frame index of dynamically allocated stack area.
unsigned MaxCallFrameSize;
@@ -54,7 +58,7 @@
MipsFunctionInfo(MachineFunction& MF)
: MF(MF), SRetReturnReg(0), GlobalBaseReg(0),
VarArgsFrameIndex(0), InArgFIRange(std::make_pair(-1, 0)),
- OutArgFIRange(std::make_pair(-1, 0)), DynAllocFI(0),
+ OutArgFIRange(std::make_pair(-1, 0)), GlobalRegFI(0), DynAllocFI(0),
MaxCallFrameSize(0), EmitNOAT(false)
{}
@@ -73,6 +77,24 @@
OutArgFIRange.second = LastFI;
}
+ bool isGlobalRegFI(int FI) const {
+ return GlobalRegFI && (FI == GlobalRegFI);
+ }
+
+ int getGlobalRegFI() const {
+ return GlobalRegFI;
+ }
+
+ int initGlobalRegFI() {
+ const TargetMachine &TM = MF.getTarget();
+ unsigned RegSize = TM.getSubtarget<MipsSubtarget>().isABI_N64() ? 8 : 4;
+ int64_t StackAlignment = TM.getFrameLowering()->getStackAlignment();
+ uint64_t Offset = RoundUpToAlignment(MaxCallFrameSize, StackAlignment);
+
+ GlobalRegFI = MF.getFrameInfo()->CreateFixedObject(RegSize, Offset, true);
+ return GlobalRegFI;
+ }
+
// The first call to this function creates a frame object for dynamically
// allocated stack area.
int getDynAllocFI() const {
More information about the llvm-commits
mailing list