mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-26 13:36:28 +00:00
Replace some std::vectors that showed up in heap profiling with
SmallVectors. Change the signature of TargetLowering::LowerArguments to avoid returning a vector by value, and update the two targets which still use this directly, Sparc and IA64, accordingly. llvm-svn: 52917
This commit is contained in:
parent
8d6d17cd2c
commit
295abfe228
@ -964,8 +964,9 @@ public:
|
|||||||
|
|
||||||
/// LowerArguments - This hook must be implemented to indicate how we should
|
/// LowerArguments - This hook must be implemented to indicate how we should
|
||||||
/// lower the arguments for the specified function, into the specified DAG.
|
/// lower the arguments for the specified function, into the specified DAG.
|
||||||
virtual std::vector<SDOperand>
|
virtual void
|
||||||
LowerArguments(Function &F, SelectionDAG &DAG);
|
LowerArguments(Function &F, SelectionDAG &DAG,
|
||||||
|
SmallVectorImpl<SDOperand>& ArgValues);
|
||||||
|
|
||||||
/// LowerCallTo - This hook lowers an abstract call to a function into an
|
/// LowerCallTo - This hook lowers an abstract call to a function into an
|
||||||
/// actual call. This returns a pair of operands. The first element is the
|
/// actual call. This returns a pair of operands. The first element is the
|
||||||
|
@ -474,7 +474,7 @@ class SelectionDAGLowering {
|
|||||||
/// them up and then emit token factor nodes when possible. This allows us to
|
/// them up and then emit token factor nodes when possible. This allows us to
|
||||||
/// get simple disambiguation between loads without worrying about alias
|
/// get simple disambiguation between loads without worrying about alias
|
||||||
/// analysis.
|
/// analysis.
|
||||||
std::vector<SDOperand> PendingLoads;
|
SmallVector<SDOperand, 8> PendingLoads;
|
||||||
|
|
||||||
/// PendingExports - CopyToReg nodes that copy values to virtual registers
|
/// PendingExports - CopyToReg nodes that copy values to virtual registers
|
||||||
/// for export to other blocks need to be emitted before any terminator
|
/// for export to other blocks need to be emitted before any terminator
|
||||||
@ -4612,16 +4612,16 @@ void SelectionDAGLowering::visitVACopy(CallInst &I) {
|
|||||||
/// implementation, which just inserts a FORMAL_ARGUMENTS node. FIXME: When all
|
/// implementation, which just inserts a FORMAL_ARGUMENTS node. FIXME: When all
|
||||||
/// targets are migrated to using FORMAL_ARGUMENTS, this hook should be
|
/// targets are migrated to using FORMAL_ARGUMENTS, this hook should be
|
||||||
/// integrated into SDISel.
|
/// integrated into SDISel.
|
||||||
std::vector<SDOperand>
|
void TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG,
|
||||||
TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
|
SmallVectorImpl<SDOperand> &ArgValues) {
|
||||||
// Add CC# and isVararg as operands to the FORMAL_ARGUMENTS node.
|
// Add CC# and isVararg as operands to the FORMAL_ARGUMENTS node.
|
||||||
std::vector<SDOperand> Ops;
|
SmallVector<SDOperand, 3+16> Ops;
|
||||||
Ops.push_back(DAG.getRoot());
|
Ops.push_back(DAG.getRoot());
|
||||||
Ops.push_back(DAG.getConstant(F.getCallingConv(), getPointerTy()));
|
Ops.push_back(DAG.getConstant(F.getCallingConv(), getPointerTy()));
|
||||||
Ops.push_back(DAG.getConstant(F.isVarArg(), getPointerTy()));
|
Ops.push_back(DAG.getConstant(F.isVarArg(), getPointerTy()));
|
||||||
|
|
||||||
// Add one result value for each formal argument.
|
// Add one result value for each formal argument.
|
||||||
std::vector<MVT> RetVals;
|
SmallVector<MVT, 16> RetVals;
|
||||||
unsigned j = 1;
|
unsigned j = 1;
|
||||||
for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end();
|
for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end();
|
||||||
I != E; ++I, ++j) {
|
I != E; ++I, ++j) {
|
||||||
@ -4699,7 +4699,6 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
|
|||||||
DAG.setRoot(SDOperand(Result, NumArgRegs));
|
DAG.setRoot(SDOperand(Result, NumArgRegs));
|
||||||
|
|
||||||
// Set up the return result vector.
|
// Set up the return result vector.
|
||||||
Ops.clear();
|
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
unsigned Idx = 1;
|
unsigned Idx = 1;
|
||||||
for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E;
|
for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E;
|
||||||
@ -4722,12 +4721,11 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
|
|||||||
else if (F.paramHasAttr(Idx, ParamAttr::ZExt))
|
else if (F.paramHasAttr(Idx, ParamAttr::ZExt))
|
||||||
AssertOp = ISD::AssertZext;
|
AssertOp = ISD::AssertZext;
|
||||||
|
|
||||||
Ops.push_back(getCopyFromParts(DAG, &Parts[0], NumParts, PartVT, VT,
|
ArgValues.push_back(getCopyFromParts(DAG, &Parts[0], NumParts, PartVT, VT,
|
||||||
AssertOp));
|
AssertOp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(i == NumArgRegs && "Argument register count mismatch!");
|
assert(i == NumArgRegs && "Argument register count mismatch!");
|
||||||
return Ops;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4951,7 +4949,8 @@ LowerArguments(BasicBlock *LLVMBB, SelectionDAGLowering &SDL) {
|
|||||||
Function &F = *LLVMBB->getParent();
|
Function &F = *LLVMBB->getParent();
|
||||||
FunctionLoweringInfo &FuncInfo = SDL.FuncInfo;
|
FunctionLoweringInfo &FuncInfo = SDL.FuncInfo;
|
||||||
SDOperand OldRoot = SDL.DAG.getRoot();
|
SDOperand OldRoot = SDL.DAG.getRoot();
|
||||||
std::vector<SDOperand> Args = TLI.LowerArguments(F, SDL.DAG);
|
SmallVector<SDOperand, 16> Args;
|
||||||
|
TLI.LowerArguments(F, SDL.DAG, Args);
|
||||||
|
|
||||||
unsigned a = 0;
|
unsigned a = 0;
|
||||||
for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end();
|
for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end();
|
||||||
|
@ -143,9 +143,8 @@ MVT IA64TargetLowering::getSetCCResultType(const SDOperand &) const {
|
|||||||
return MVT::i1;
|
return MVT::i1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<SDOperand>
|
void IA64TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG,
|
||||||
IA64TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
|
SmallVectorImpl<SDOperand> &ArgValues) {
|
||||||
std::vector<SDOperand> ArgValues;
|
|
||||||
//
|
//
|
||||||
// add beautiful description of IA64 stack frame format
|
// add beautiful description of IA64 stack frame format
|
||||||
// here (from intel 24535803.pdf most likely)
|
// here (from intel 24535803.pdf most likely)
|
||||||
@ -300,8 +299,6 @@ IA64TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
|
|||||||
MF.getRegInfo().addLiveOut(IA64::F8);
|
MF.getRegInfo().addLiveOut(IA64::F8);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ArgValues;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<SDOperand, SDOperand>
|
std::pair<SDOperand, SDOperand>
|
||||||
|
@ -53,8 +53,8 @@ namespace llvm {
|
|||||||
|
|
||||||
/// LowerArguments - This hook must be implemented to indicate how we should
|
/// LowerArguments - This hook must be implemented to indicate how we should
|
||||||
/// lower the arguments for the specified function, into the specified DAG.
|
/// lower the arguments for the specified function, into the specified DAG.
|
||||||
virtual std::vector<SDOperand>
|
virtual void LowerArguments(Function &F, SelectionDAG &DAG,
|
||||||
LowerArguments(Function &F, SelectionDAG &DAG);
|
SmallVectorImpl<SDOperand> &ArgValues);
|
||||||
|
|
||||||
/// LowerCallTo - This hook lowers an abstract call to a function into an
|
/// LowerCallTo - This hook lowers an abstract call to a function into an
|
||||||
/// actual call.
|
/// actual call.
|
||||||
|
@ -74,11 +74,11 @@ static SDOperand LowerRET(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
/// LowerArguments - V8 uses a very simple ABI, where all values are passed in
|
/// LowerArguments - V8 uses a very simple ABI, where all values are passed in
|
||||||
/// either one or two GPRs, including FP values. TODO: we should pass FP values
|
/// either one or two GPRs, including FP values. TODO: we should pass FP values
|
||||||
/// in FP registers for fastcc functions.
|
/// in FP registers for fastcc functions.
|
||||||
std::vector<SDOperand>
|
void
|
||||||
SparcTargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
|
SparcTargetLowering::LowerArguments(Function &F, SelectionDAG &DAG,
|
||||||
|
SmallVectorImpl<SDOperand> &ArgValues) {
|
||||||
MachineFunction &MF = DAG.getMachineFunction();
|
MachineFunction &MF = DAG.getMachineFunction();
|
||||||
MachineRegisterInfo &RegInfo = MF.getRegInfo();
|
MachineRegisterInfo &RegInfo = MF.getRegInfo();
|
||||||
std::vector<SDOperand> ArgValues;
|
|
||||||
|
|
||||||
static const unsigned ArgRegs[] = {
|
static const unsigned ArgRegs[] = {
|
||||||
SP::I0, SP::I1, SP::I2, SP::I3, SP::I4, SP::I5
|
SP::I0, SP::I1, SP::I2, SP::I3, SP::I4, SP::I5
|
||||||
@ -221,8 +221,6 @@ SparcTargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
|
|||||||
if (!OutChains.empty())
|
if (!OutChains.empty())
|
||||||
DAG.setRoot(DAG.getNode(ISD::TokenFactor, MVT::Other,
|
DAG.setRoot(DAG.getNode(ISD::TokenFactor, MVT::Other,
|
||||||
&OutChains[0], OutChains.size()));
|
&OutChains[0], OutChains.size()));
|
||||||
|
|
||||||
return ArgValues;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG) {
|
static SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG) {
|
||||||
|
@ -57,8 +57,8 @@ namespace llvm {
|
|||||||
const SelectionDAG &DAG,
|
const SelectionDAG &DAG,
|
||||||
unsigned Depth = 0) const;
|
unsigned Depth = 0) const;
|
||||||
|
|
||||||
virtual std::vector<SDOperand>
|
virtual void LowerArguments(Function &F, SelectionDAG &DAG,
|
||||||
LowerArguments(Function &F, SelectionDAG &DAG);
|
SmallVectorImpl<SDOperand> &ArgValues);
|
||||||
virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
|
virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
|
||||||
MachineBasicBlock *MBB);
|
MachineBasicBlock *MBB);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user