mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
Run StatepointLowering.{cpp,h} through clang-format.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236166 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
65d5d2d117
commit
ec4a389039
@ -38,8 +38,7 @@ STATISTIC(NumOfStatepoints, "Number of statepoint nodes encountered");
|
|||||||
STATISTIC(StatepointMaxSlotsRequired,
|
STATISTIC(StatepointMaxSlotsRequired,
|
||||||
"Maximum number of stack slots required for a singe statepoint");
|
"Maximum number of stack slots required for a singe statepoint");
|
||||||
|
|
||||||
void
|
void StatepointLoweringState::startNewStatepoint(SelectionDAGBuilder &Builder) {
|
||||||
StatepointLoweringState::startNewStatepoint(SelectionDAGBuilder &Builder) {
|
|
||||||
// Consistency check
|
// Consistency check
|
||||||
assert(PendingGCRelocateCalls.empty() &&
|
assert(PendingGCRelocateCalls.empty() &&
|
||||||
"Trying to visit statepoint before finished processing previous one");
|
"Trying to visit statepoint before finished processing previous one");
|
||||||
@ -262,8 +261,7 @@ static SDNode *lowerCallFromStatepoint(ImmutableStatepoint StatepointSite,
|
|||||||
unsigned reg = Builder.FuncInfo.CreateRegs(Tmp->getType());
|
unsigned reg = Builder.FuncInfo.CreateRegs(Tmp->getType());
|
||||||
Builder.CopyValueToVirtualRegister(Tmp, reg);
|
Builder.CopyValueToVirtualRegister(Tmp, reg);
|
||||||
Builder.FuncInfo.ValueMap[CS.getInstruction()] = reg;
|
Builder.FuncInfo.ValueMap[CS.getInstruction()] = reg;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// The value of the statepoint itself will be the value of call itself.
|
// The value of the statepoint itself will be the value of call itself.
|
||||||
// We'll replace the actually call node shortly. gc_result will grab
|
// We'll replace the actually call node shortly. gc_result will grab
|
||||||
// this value.
|
// this value.
|
||||||
@ -325,11 +323,9 @@ static SDNode *lowerCallFromStatepoint(ImmutableStatepoint StatepointSite,
|
|||||||
/// Relocs - the gc_relocate corresponding to each base/ptr pair
|
/// Relocs - the gc_relocate corresponding to each base/ptr pair
|
||||||
/// Elements of this arrays should be in one-to-one correspondence with each
|
/// Elements of this arrays should be in one-to-one correspondence with each
|
||||||
/// other i.e Bases[i], Ptrs[i] are from the same gcrelocate call
|
/// other i.e Bases[i], Ptrs[i] are from the same gcrelocate call
|
||||||
static void
|
static void getIncomingStatepointGCValues(
|
||||||
getIncomingStatepointGCValues(SmallVectorImpl<const Value *> &Bases,
|
SmallVectorImpl<const Value *> &Bases, SmallVectorImpl<const Value *> &Ptrs,
|
||||||
SmallVectorImpl<const Value *> &Ptrs,
|
SmallVectorImpl<const Value *> &Relocs, ImmutableStatepoint StatepointSite,
|
||||||
SmallVectorImpl<const Value *> &Relocs,
|
|
||||||
ImmutableStatepoint StatepointSite,
|
|
||||||
SelectionDAGBuilder &Builder) {
|
SelectionDAGBuilder &Builder) {
|
||||||
for (GCRelocateOperands relocateOpers :
|
for (GCRelocateOperands relocateOpers :
|
||||||
StatepointSite.getRelocates(StatepointSite)) {
|
StatepointSite.getRelocates(StatepointSite)) {
|
||||||
@ -437,8 +433,8 @@ static void lowerStatepointMetaArgs(SmallVectorImpl<SDValue> &Ops,
|
|||||||
// be: deopt argument length, deopt arguments.., gc arguments...
|
// be: deopt argument length, deopt arguments.., gc arguments...
|
||||||
|
|
||||||
SmallVector<const Value *, 64> Bases, Ptrs, Relocations;
|
SmallVector<const Value *, 64> Bases, Ptrs, Relocations;
|
||||||
getIncomingStatepointGCValues(Bases, Ptrs, Relocations,
|
getIncomingStatepointGCValues(Bases, Ptrs, Relocations, StatepointSite,
|
||||||
StatepointSite, Builder);
|
Builder);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// Check that each of the gc pointer and bases we've gotten out of the
|
// Check that each of the gc pointer and bases we've gotten out of the
|
||||||
@ -469,8 +465,6 @@ static void lowerStatepointMetaArgs(SmallVectorImpl<SDValue> &Ops,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Before we actually start lowering (and allocating spill slots for values),
|
// Before we actually start lowering (and allocating spill slots for values),
|
||||||
// reserve any stack slots which we judge to be profitable to reuse for a
|
// reserve any stack slots which we judge to be profitable to reuse for a
|
||||||
// particular value. This is purely an optimization over the code below and
|
// particular value. This is purely an optimization over the code below and
|
||||||
@ -540,7 +534,6 @@ static void lowerStatepointMetaArgs(SmallVectorImpl<SDValue> &Ops,
|
|||||||
// This handles allocas as arguments to the statepoint
|
// This handles allocas as arguments to the statepoint
|
||||||
Ops.push_back(Builder.DAG.getTargetFrameIndex(FI->getIndex(),
|
Ops.push_back(Builder.DAG.getTargetFrameIndex(FI->getIndex(),
|
||||||
Incoming.getValueType()));
|
Incoming.getValueType()));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -553,9 +546,8 @@ void SelectionDAGBuilder::visitStatepoint(const CallInst &CI) {
|
|||||||
LowerStatepoint(ImmutableStatepoint(&CI));
|
LowerStatepoint(ImmutableStatepoint(&CI));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void SelectionDAGBuilder::LowerStatepoint(
|
||||||
SelectionDAGBuilder::LowerStatepoint(ImmutableStatepoint ISP,
|
ImmutableStatepoint ISP, MachineBasicBlock *LandingPad /*=nullptr*/) {
|
||||||
MachineBasicBlock *LandingPad/*=nullptr*/) {
|
|
||||||
// The basic scheme here is that information about both the original call and
|
// The basic scheme here is that information about both the original call and
|
||||||
// the safepoint is encoded in the CallInst. We create a temporary call and
|
// the safepoint is encoded in the CallInst. We create a temporary call and
|
||||||
// lower it, then reverse engineer the calling sequence.
|
// lower it, then reverse engineer the calling sequence.
|
||||||
@ -656,8 +648,8 @@ SelectionDAGBuilder::LowerStatepoint(ImmutableStatepoint ISP,
|
|||||||
// input. This allows someone else to chain off us as needed.
|
// input. This allows someone else to chain off us as needed.
|
||||||
SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Glue);
|
SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Glue);
|
||||||
|
|
||||||
SDNode *StatepointMCNode = DAG.getMachineNode(TargetOpcode::STATEPOINT,
|
SDNode *StatepointMCNode =
|
||||||
getCurSDLoc(), NodeTys, Ops);
|
DAG.getMachineNode(TargetOpcode::STATEPOINT, getCurSDLoc(), NodeTys, Ops);
|
||||||
|
|
||||||
// Replace original call
|
// Replace original call
|
||||||
DAG.ReplaceAllUsesWith(CallNode, StatepointMCNode); // This may update Root
|
DAG.ReplaceAllUsesWith(CallNode, StatepointMCNode); // This may update Root
|
||||||
@ -678,8 +670,7 @@ void SelectionDAGBuilder::visitGCResult(const CallInst &CI) {
|
|||||||
// The result value of the gc_result is simply the result of the actual
|
// The result value of the gc_result is simply the result of the actual
|
||||||
// call. We've already emitted this, so just grab the value.
|
// call. We've already emitted this, so just grab the value.
|
||||||
Instruction *I = cast<Instruction>(CI.getArgOperand(0));
|
Instruction *I = cast<Instruction>(CI.getArgOperand(0));
|
||||||
assert(isStatepoint(I) &&
|
assert(isStatepoint(I) && "first argument must be a statepoint token");
|
||||||
"first argument must be a statepoint token");
|
|
||||||
|
|
||||||
if (isa<InvokeInst>(I)) {
|
if (isa<InvokeInst>(I)) {
|
||||||
// For invokes we should have stored call result in a virtual register.
|
// For invokes we should have stored call result in a virtual register.
|
||||||
@ -687,16 +678,15 @@ void SelectionDAGBuilder::visitGCResult(const CallInst &CI) {
|
|||||||
// register because statepoint and actuall call return types can be
|
// register because statepoint and actuall call return types can be
|
||||||
// different, and getValue() will use CopyFromReg of the wrong type,
|
// different, and getValue() will use CopyFromReg of the wrong type,
|
||||||
// which is always i32 in our case.
|
// which is always i32 in our case.
|
||||||
PointerType *CalleeType = cast<PointerType>(
|
PointerType *CalleeType =
|
||||||
ImmutableStatepoint(I).actualCallee()->getType());
|
cast<PointerType>(ImmutableStatepoint(I).actualCallee()->getType());
|
||||||
Type *RetTy = cast<FunctionType>(
|
Type *RetTy =
|
||||||
CalleeType->getElementType())->getReturnType();
|
cast<FunctionType>(CalleeType->getElementType())->getReturnType();
|
||||||
SDValue CopyFromReg = getCopyFromRegs(I, RetTy);
|
SDValue CopyFromReg = getCopyFromRegs(I, RetTy);
|
||||||
|
|
||||||
assert(CopyFromReg.getNode());
|
assert(CopyFromReg.getNode());
|
||||||
setValue(&CI, CopyFromReg);
|
setValue(&CI, CopyFromReg);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
setValue(&CI, getValue(I));
|
setValue(&CI, getValue(I));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -728,9 +718,9 @@ void SelectionDAGBuilder::visitGCRelocate(const CallInst &CI) {
|
|||||||
// it may allow more scheduling opprtunities
|
// it may allow more scheduling opprtunities
|
||||||
SDValue Chain = getRoot();
|
SDValue Chain = getRoot();
|
||||||
|
|
||||||
Loc = DAG.getLoad(SpillSlot.getValueType(), getCurSDLoc(), Chain,
|
Loc = DAG.getLoad(SpillSlot.getValueType(), getCurSDLoc(), Chain, SpillSlot,
|
||||||
SpillSlot, MachinePointerInfo::getFixedStack(FI), false,
|
MachinePointerInfo::getFixedStack(FI), false, false,
|
||||||
false, false, 0);
|
false, 0);
|
||||||
|
|
||||||
StatepointLowering.setRelocLocation(SD, Loc);
|
StatepointLowering.setRelocLocation(SD, Loc);
|
||||||
|
|
||||||
|
@ -30,8 +30,7 @@ class SelectionDAGBuilder;
|
|||||||
/// works in concert with information in FunctionLoweringInfo.
|
/// works in concert with information in FunctionLoweringInfo.
|
||||||
class StatepointLoweringState {
|
class StatepointLoweringState {
|
||||||
public:
|
public:
|
||||||
StatepointLoweringState() : NextSlotToAllocate(0) {
|
StatepointLoweringState() : NextSlotToAllocate(0) {}
|
||||||
}
|
|
||||||
|
|
||||||
/// Reset all state tracking for a newly encountered safepoint. Also
|
/// Reset all state tracking for a newly encountered safepoint. Also
|
||||||
/// performs some consistency checking.
|
/// performs some consistency checking.
|
||||||
|
Loading…
Reference in New Issue
Block a user