mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Move per-function state out of TargetLowering subclasses and into
MachineFunctionInfo subclasses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101634 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "SparcISelLowering.h"
|
||||
#include "SparcTargetMachine.h"
|
||||
#include "SparcMachineFunctionInfo.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/CodeGen/CallingConvLower.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
@@ -89,6 +90,7 @@ SparcTargetLowering::LowerFormalArguments(SDValue Chain,
|
||||
|
||||
MachineFunction &MF = DAG.getMachineFunction();
|
||||
MachineRegisterInfo &RegInfo = MF.getRegInfo();
|
||||
SparcMachineFunctionInfo *FuncInfo = MF.getInfo<SparcMachineFunctionInfo>();
|
||||
|
||||
// Assign locations to all of the incoming arguments.
|
||||
SmallVector<CCValAssign, 16> ArgLocs;
|
||||
@@ -226,7 +228,7 @@ SparcTargetLowering::LowerFormalArguments(SDValue Chain,
|
||||
// Store remaining ArgRegs to the stack if this is a varargs function.
|
||||
if (isVarArg) {
|
||||
// Remember the vararg offset for the va_start implementation.
|
||||
VarArgsFrameOffset = ArgOffset;
|
||||
FuncInfo->setVarArgsFrameOffset(ArgOffset);
|
||||
|
||||
std::vector<SDValue> OutChains;
|
||||
|
||||
@@ -874,13 +876,17 @@ static SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) {
|
||||
|
||||
static SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG,
|
||||
SparcTargetLowering &TLI) {
|
||||
MachineFunction &MF = DAG.getMachineFunction();
|
||||
SparcMachineFunctionInfo *FuncInfo = MF.getInfo<SparcMachineFunctionInfo>();
|
||||
|
||||
// vastart just stores the address of the VarArgsFrameIndex slot into the
|
||||
// memory location argument.
|
||||
DebugLoc dl = Op.getDebugLoc();
|
||||
SDValue Offset = DAG.getNode(ISD::ADD, dl, MVT::i32,
|
||||
DAG.getRegister(SP::I6, MVT::i32),
|
||||
DAG.getConstant(TLI.getVarArgsFrameOffset(),
|
||||
MVT::i32));
|
||||
SDValue Offset =
|
||||
DAG.getNode(ISD::ADD, dl, MVT::i32,
|
||||
DAG.getRegister(SP::I6, MVT::i32),
|
||||
DAG.getConstant(FuncInfo->getVarArgsFrameOffset(),
|
||||
MVT::i32));
|
||||
const Value *SV = cast<SrcValueSDNode>(Op.getOperand(2))->getValue();
|
||||
return DAG.getStore(Op.getOperand(0), dl, Offset, Op.getOperand(1), SV, 0,
|
||||
false, false, 0);
|
||||
|
@@ -41,13 +41,10 @@ namespace llvm {
|
||||
}
|
||||
|
||||
class SparcTargetLowering : public TargetLowering {
|
||||
int VarArgsFrameOffset; // Frame offset to start of varargs area.
|
||||
public:
|
||||
SparcTargetLowering(TargetMachine &TM);
|
||||
virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG);
|
||||
|
||||
int getVarArgsFrameOffset() const { return VarArgsFrameOffset; }
|
||||
|
||||
/// computeMaskedBitsForTargetNode - Determine which of the bits specified
|
||||
/// in Mask are known to be either zero or one and return them in the
|
||||
/// KnownZero/KnownOne bitsets.
|
||||
|
@@ -20,12 +20,20 @@ namespace llvm {
|
||||
class SparcMachineFunctionInfo : public MachineFunctionInfo {
|
||||
private:
|
||||
unsigned GlobalBaseReg;
|
||||
|
||||
/// VarArgsFrameOffset - Frame offset to start of varargs area.
|
||||
int VarArgsFrameOffset;
|
||||
|
||||
public:
|
||||
SparcMachineFunctionInfo() : GlobalBaseReg(0) {}
|
||||
explicit SparcMachineFunctionInfo(MachineFunction &MF) : GlobalBaseReg(0) {}
|
||||
SparcMachineFunctionInfo() : GlobalBaseReg(0), VarArgsFrameOffset(0) {}
|
||||
explicit SparcMachineFunctionInfo(MachineFunction &MF)
|
||||
: GlobalBaseReg(0), VarArgsFrameOffset(0) {}
|
||||
|
||||
unsigned getGlobalBaseReg() const { return GlobalBaseReg; }
|
||||
void setGlobalBaseReg(unsigned Reg) { GlobalBaseReg = Reg; }
|
||||
|
||||
int getVarArgsFrameOffset() const { return VarArgsFrameOffset; }
|
||||
void setVarArgsFrameOffset(int Offset) { VarArgsFrameOffset = Offset; }
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user