From 4866fe14e2ea1fc366142ab7f4c7789d1a952bb0 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Tue, 30 Oct 2012 19:37:25 +0000 Subject: [PATCH] Add code for saving formal argument information to MipsFunctionInfo. This information will be used by IsEligibleForTailCallOptimization to determine whether a call can be tail-call optimized. llvm-svn: 167043 --- llvm/lib/Target/Mips/MipsISelLowering.cpp | 2 ++ llvm/lib/Target/Mips/MipsMachineFunction.h | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp index 77f1bac..862790b 100644 --- a/llvm/lib/Target/Mips/MipsISelLowering.cpp +++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp @@ -3021,6 +3021,8 @@ MipsTargetLowering::LowerFormalArguments(SDValue Chain, MipsCC MipsCCInfo(CallConv, isVarArg, IsO32, CCInfo); MipsCCInfo.analyzeFormalArguments(Ins); + MipsFI->setFormalArgInfo(CCInfo.getNextStackOffset(), + MipsCCInfo.hasByValArg()); Function::const_arg_iterator FuncArg = DAG.getMachineFunction().getFunction()->arg_begin(); diff --git a/llvm/lib/Target/Mips/MipsMachineFunction.h b/llvm/lib/Target/Mips/MipsMachineFunction.h index f9efe07..663aaec 100644 --- a/llvm/lib/Target/Mips/MipsMachineFunction.h +++ b/llvm/lib/Target/Mips/MipsMachineFunction.h @@ -47,6 +47,10 @@ class MipsFunctionInfo : public MachineFunctionInfo { /// VarArgsFrameIndex - FrameIndex for start of varargs area. int VarArgsFrameIndex; + // Formal argument information obtained during call to LowerFormalArguments. + unsigned NextStackOffset; + bool HasByvalArg; + bool EmitNOAT; public: @@ -67,6 +71,13 @@ public: int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; } + unsigned nextStackOffset() const { return NextStackOffset; } + bool hasByvalArg() const { return HasByvalArg; } + void setFormalArgInfo(unsigned Offset, bool HasByval) { + NextStackOffset = Offset; + HasByvalArg = HasByval; + } + bool getEmitNOAT() const { return EmitNOAT; } void setEmitNOAT() { EmitNOAT = true; } }; -- 2.7.4