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,
|
||||
"Maximum number of stack slots required for a singe statepoint");
|
||||
|
||||
void
|
||||
StatepointLoweringState::startNewStatepoint(SelectionDAGBuilder &Builder) {
|
||||
void StatepointLoweringState::startNewStatepoint(SelectionDAGBuilder &Builder) {
|
||||
// Consistency check
|
||||
assert(PendingGCRelocateCalls.empty() &&
|
||||
"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());
|
||||
Builder.CopyValueToVirtualRegister(Tmp, reg);
|
||||
Builder.FuncInfo.ValueMap[CS.getInstruction()] = reg;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// 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
|
||||
// this value.
|
||||
@ -325,11 +323,9 @@ static SDNode *lowerCallFromStatepoint(ImmutableStatepoint StatepointSite,
|
||||
/// Relocs - the gc_relocate corresponding to each base/ptr pair
|
||||
/// 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
|
||||
static void
|
||||
getIncomingStatepointGCValues(SmallVectorImpl<const Value *> &Bases,
|
||||
SmallVectorImpl<const Value *> &Ptrs,
|
||||
SmallVectorImpl<const Value *> &Relocs,
|
||||
ImmutableStatepoint StatepointSite,
|
||||
static void getIncomingStatepointGCValues(
|
||||
SmallVectorImpl<const Value *> &Bases, SmallVectorImpl<const Value *> &Ptrs,
|
||||
SmallVectorImpl<const Value *> &Relocs, ImmutableStatepoint StatepointSite,
|
||||
SelectionDAGBuilder &Builder) {
|
||||
for (GCRelocateOperands relocateOpers :
|
||||
StatepointSite.getRelocates(StatepointSite)) {
|
||||
@ -437,8 +433,8 @@ static void lowerStatepointMetaArgs(SmallVectorImpl<SDValue> &Ops,
|
||||
// be: deopt argument length, deopt arguments.., gc arguments...
|
||||
|
||||
SmallVector<const Value *, 64> Bases, Ptrs, Relocations;
|
||||
getIncomingStatepointGCValues(Bases, Ptrs, Relocations,
|
||||
StatepointSite, Builder);
|
||||
getIncomingStatepointGCValues(Bases, Ptrs, Relocations, StatepointSite,
|
||||
Builder);
|
||||
|
||||
#ifndef NDEBUG
|
||||
// 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
|
||||
|
||||
|
||||
|
||||
// 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
|
||||
// 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
|
||||
Ops.push_back(Builder.DAG.getTargetFrameIndex(FI->getIndex(),
|
||||
Incoming.getValueType()));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -553,9 +546,8 @@ void SelectionDAGBuilder::visitStatepoint(const CallInst &CI) {
|
||||
LowerStatepoint(ImmutableStatepoint(&CI));
|
||||
}
|
||||
|
||||
void
|
||||
SelectionDAGBuilder::LowerStatepoint(ImmutableStatepoint ISP,
|
||||
MachineBasicBlock *LandingPad/*=nullptr*/) {
|
||||
void SelectionDAGBuilder::LowerStatepoint(
|
||||
ImmutableStatepoint ISP, MachineBasicBlock *LandingPad /*=nullptr*/) {
|
||||
// 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
|
||||
// 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.
|
||||
SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Glue);
|
||||
|
||||
SDNode *StatepointMCNode = DAG.getMachineNode(TargetOpcode::STATEPOINT,
|
||||
getCurSDLoc(), NodeTys, Ops);
|
||||
SDNode *StatepointMCNode =
|
||||
DAG.getMachineNode(TargetOpcode::STATEPOINT, getCurSDLoc(), NodeTys, Ops);
|
||||
|
||||
// Replace original call
|
||||
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
|
||||
// call. We've already emitted this, so just grab the value.
|
||||
Instruction *I = cast<Instruction>(CI.getArgOperand(0));
|
||||
assert(isStatepoint(I) &&
|
||||
"first argument must be a statepoint token");
|
||||
assert(isStatepoint(I) && "first argument must be a statepoint token");
|
||||
|
||||
if (isa<InvokeInst>(I)) {
|
||||
// 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
|
||||
// different, and getValue() will use CopyFromReg of the wrong type,
|
||||
// which is always i32 in our case.
|
||||
PointerType *CalleeType = cast<PointerType>(
|
||||
ImmutableStatepoint(I).actualCallee()->getType());
|
||||
Type *RetTy = cast<FunctionType>(
|
||||
CalleeType->getElementType())->getReturnType();
|
||||
PointerType *CalleeType =
|
||||
cast<PointerType>(ImmutableStatepoint(I).actualCallee()->getType());
|
||||
Type *RetTy =
|
||||
cast<FunctionType>(CalleeType->getElementType())->getReturnType();
|
||||
SDValue CopyFromReg = getCopyFromRegs(I, RetTy);
|
||||
|
||||
assert(CopyFromReg.getNode());
|
||||
setValue(&CI, CopyFromReg);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setValue(&CI, getValue(I));
|
||||
}
|
||||
}
|
||||
@ -728,9 +718,9 @@ void SelectionDAGBuilder::visitGCRelocate(const CallInst &CI) {
|
||||
// it may allow more scheduling opprtunities
|
||||
SDValue Chain = getRoot();
|
||||
|
||||
Loc = DAG.getLoad(SpillSlot.getValueType(), getCurSDLoc(), Chain,
|
||||
SpillSlot, MachinePointerInfo::getFixedStack(FI), false,
|
||||
false, false, 0);
|
||||
Loc = DAG.getLoad(SpillSlot.getValueType(), getCurSDLoc(), Chain, SpillSlot,
|
||||
MachinePointerInfo::getFixedStack(FI), false, false,
|
||||
false, 0);
|
||||
|
||||
StatepointLowering.setRelocLocation(SD, Loc);
|
||||
|
||||
|
@ -30,8 +30,7 @@ class SelectionDAGBuilder;
|
||||
/// works in concert with information in FunctionLoweringInfo.
|
||||
class StatepointLoweringState {
|
||||
public:
|
||||
StatepointLoweringState() : NextSlotToAllocate(0) {
|
||||
}
|
||||
StatepointLoweringState() : NextSlotToAllocate(0) {}
|
||||
|
||||
/// Reset all state tracking for a newly encountered safepoint. Also
|
||||
/// performs some consistency checking.
|
||||
|
Loading…
Reference in New Issue
Block a user