You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jianglk.darker 7ee447c011
v811_spc009_project
4 months ago
..
AsmPrinter v811_spc009_project 4 months ago
GlobalISel v811_spc009_project 4 months ago
LiveDebugValues v811_spc009_project 4 months ago
MIRParser v811_spc009_project 4 months ago
SelectionDAG v811_spc009_project 4 months ago
AggressiveAntiDepBreaker.cpp v811_spc009_project 4 months ago
AggressiveAntiDepBreaker.h v811_spc009_project 4 months ago
AllocationOrder.cpp v811_spc009_project 4 months ago
AllocationOrder.h v811_spc009_project 4 months ago
Analysis.cpp v811_spc009_project 4 months ago
AtomicExpandPass.cpp v811_spc009_project 4 months ago
BasicBlockSections.cpp v811_spc009_project 4 months ago
BasicTargetTransformInfo.cpp v811_spc009_project 4 months ago
BranchFolding.cpp v811_spc009_project 4 months ago
BranchFolding.h v811_spc009_project 4 months ago
BranchRelaxation.cpp v811_spc009_project 4 months ago
BreakFalseDeps.cpp v811_spc009_project 4 months ago
BuiltinGCs.cpp v811_spc009_project 4 months ago
CFGuardLongjmp.cpp v811_spc009_project 4 months ago
CFIInstrInserter.cpp v811_spc009_project 4 months ago
CMakeLists.txt v811_spc009_project 4 months ago
CalcSpillWeights.cpp v811_spc009_project 4 months ago
CallingConvLower.cpp v811_spc009_project 4 months ago
CodeGen.cpp v811_spc009_project 4 months ago
CodeGenPrepare.cpp v811_spc009_project 4 months ago
CommandFlags.cpp v811_spc009_project 4 months ago
CriticalAntiDepBreaker.cpp v811_spc009_project 4 months ago
CriticalAntiDepBreaker.h v811_spc009_project 4 months ago
DFAPacketizer.cpp v811_spc009_project 4 months ago
DeadMachineInstructionElim.cpp v811_spc009_project 4 months ago
DetectDeadLanes.cpp v811_spc009_project 4 months ago
DwarfEHPrepare.cpp v811_spc009_project 4 months ago
EarlyIfConversion.cpp v811_spc009_project 4 months ago
EdgeBundles.cpp v811_spc009_project 4 months ago
ExecutionDomainFix.cpp v811_spc009_project 4 months ago
ExpandMemCmp.cpp v811_spc009_project 4 months ago
ExpandPostRAPseudos.cpp v811_spc009_project 4 months ago
ExpandReductions.cpp v811_spc009_project 4 months ago
FEntryInserter.cpp v811_spc009_project 4 months ago
FaultMaps.cpp v811_spc009_project 4 months ago
FinalizeISel.cpp v811_spc009_project 4 months ago
FixupStatepointCallerSaved.cpp v811_spc009_project 4 months ago
FuncletLayout.cpp v811_spc009_project 4 months ago
GCMetadata.cpp v811_spc009_project 4 months ago
GCMetadataPrinter.cpp v811_spc009_project 4 months ago
GCRootLowering.cpp v811_spc009_project 4 months ago
GCStrategy.cpp v811_spc009_project 4 months ago
GlobalMerge.cpp v811_spc009_project 4 months ago
HardwareLoops.cpp v811_spc009_project 4 months ago
IfConversion.cpp v811_spc009_project 4 months ago
ImplicitNullChecks.cpp v811_spc009_project 4 months ago
IndirectBrExpandPass.cpp v811_spc009_project 4 months ago
InlineSpiller.cpp v811_spc009_project 4 months ago
InterferenceCache.cpp v811_spc009_project 4 months ago
InterferenceCache.h v811_spc009_project 4 months ago
InterleavedAccessPass.cpp v811_spc009_project 4 months ago
InterleavedLoadCombinePass.cpp v811_spc009_project 4 months ago
IntrinsicLowering.cpp v811_spc009_project 4 months ago
LLVMTargetMachine.cpp v811_spc009_project 4 months ago
LatencyPriorityQueue.cpp v811_spc009_project 4 months ago
LazyMachineBlockFrequencyInfo.cpp v811_spc009_project 4 months ago
LexicalScopes.cpp v811_spc009_project 4 months ago
LiveDebugVariables.cpp v811_spc009_project 4 months ago
LiveDebugVariables.h v811_spc009_project 4 months ago
LiveInterval.cpp v811_spc009_project 4 months ago
LiveIntervalCalc.cpp v811_spc009_project 4 months ago
LiveIntervalUnion.cpp v811_spc009_project 4 months ago
LiveIntervals.cpp v811_spc009_project 4 months ago
LivePhysRegs.cpp v811_spc009_project 4 months ago
LiveRangeCalc.cpp v811_spc009_project 4 months ago
LiveRangeEdit.cpp v811_spc009_project 4 months ago
LiveRangeShrink.cpp v811_spc009_project 4 months ago
LiveRangeUtils.h v811_spc009_project 4 months ago
LiveRegMatrix.cpp v811_spc009_project 4 months ago
LiveRegUnits.cpp v811_spc009_project 4 months ago
LiveStacks.cpp v811_spc009_project 4 months ago
LiveVariables.cpp v811_spc009_project 4 months ago
LocalStackSlotAllocation.cpp v811_spc009_project 4 months ago
LoopTraversal.cpp v811_spc009_project 4 months ago
LowLevelType.cpp v811_spc009_project 4 months ago
LowerEmuTLS.cpp v811_spc009_project 4 months ago
MBFIWrapper.cpp v811_spc009_project 4 months ago
MIRCanonicalizerPass.cpp v811_spc009_project 4 months ago
MIRNamerPass.cpp v811_spc009_project 4 months ago
MIRPrinter.cpp v811_spc009_project 4 months ago
MIRPrintingPass.cpp v811_spc009_project 4 months ago
MIRVRegNamerUtils.cpp v811_spc009_project 4 months ago
MIRVRegNamerUtils.h v811_spc009_project 4 months ago
MachineBasicBlock.cpp v811_spc009_project 4 months ago
MachineBlockFrequencyInfo.cpp v811_spc009_project 4 months ago
MachineBlockPlacement.cpp v811_spc009_project 4 months ago
MachineBranchProbabilityInfo.cpp v811_spc009_project 4 months ago
MachineCSE.cpp v811_spc009_project 4 months ago
MachineCombiner.cpp v811_spc009_project 4 months ago
MachineCopyPropagation.cpp v811_spc009_project 4 months ago
MachineDebugify.cpp v811_spc009_project 4 months ago
MachineDominanceFrontier.cpp v811_spc009_project 4 months ago
MachineDominators.cpp v811_spc009_project 4 months ago
MachineFrameInfo.cpp v811_spc009_project 4 months ago
MachineFunction.cpp v811_spc009_project 4 months ago
MachineFunctionPass.cpp v811_spc009_project 4 months ago
MachineFunctionPrinterPass.cpp v811_spc009_project 4 months ago
MachineFunctionSplitter.cpp v811_spc009_project 4 months ago
MachineInstr.cpp v811_spc009_project 4 months ago
MachineInstrBundle.cpp v811_spc009_project 4 months ago
MachineLICM.cpp v811_spc009_project 4 months ago
MachineLoopInfo.cpp v811_spc009_project 4 months ago
MachineLoopUtils.cpp v811_spc009_project 4 months ago
MachineModuleInfo.cpp v811_spc009_project 4 months ago
MachineModuleInfoImpls.cpp v811_spc009_project 4 months ago
MachineOperand.cpp v811_spc009_project 4 months ago
MachineOptimizationRemarkEmitter.cpp v811_spc009_project 4 months ago
MachineOutliner.cpp v811_spc009_project 4 months ago
MachinePassManager.cpp v811_spc009_project 4 months ago
MachinePipeliner.cpp v811_spc009_project 4 months ago
MachinePostDominators.cpp v811_spc009_project 4 months ago
MachineRegionInfo.cpp v811_spc009_project 4 months ago
MachineRegisterInfo.cpp v811_spc009_project 4 months ago
MachineSSAUpdater.cpp v811_spc009_project 4 months ago
MachineScheduler.cpp v811_spc009_project 4 months ago
MachineSink.cpp v811_spc009_project 4 months ago
MachineSizeOpts.cpp v811_spc009_project 4 months ago
MachineStableHash.cpp v811_spc009_project 4 months ago
MachineStripDebug.cpp v811_spc009_project 4 months ago
MachineTraceMetrics.cpp v811_spc009_project 4 months ago
MachineVerifier.cpp v811_spc009_project 4 months ago
MacroFusion.cpp v811_spc009_project 4 months ago
ModuloSchedule.cpp v811_spc009_project 4 months ago
MultiHazardRecognizer.cpp v811_spc009_project 4 months ago
NonRelocatableStringpool.cpp v811_spc009_project 4 months ago
OptimizePHIs.cpp v811_spc009_project 4 months ago
PHIElimination.cpp v811_spc009_project 4 months ago
PHIEliminationUtils.cpp v811_spc009_project 4 months ago
PHIEliminationUtils.h v811_spc009_project 4 months ago
ParallelCG.cpp v811_spc009_project 4 months ago
PatchableFunction.cpp v811_spc009_project 4 months ago
PeepholeOptimizer.cpp v811_spc009_project 4 months ago
PostRAHazardRecognizer.cpp v811_spc009_project 4 months ago
PostRASchedulerList.cpp v811_spc009_project 4 months ago
PreISelIntrinsicLowering.cpp v811_spc009_project 4 months ago
ProcessImplicitDefs.cpp v811_spc009_project 4 months ago
PrologEpilogInserter.cpp v811_spc009_project 4 months ago
PseudoProbeInserter.cpp v811_spc009_project 4 months ago
PseudoSourceValue.cpp v811_spc009_project 4 months ago
RDFGraph.cpp v811_spc009_project 4 months ago
RDFLiveness.cpp v811_spc009_project 4 months ago
RDFRegisters.cpp v811_spc009_project 4 months ago
README.txt v811_spc009_project 4 months ago
ReachingDefAnalysis.cpp v811_spc009_project 4 months ago
RegAllocBase.cpp v811_spc009_project 4 months ago
RegAllocBase.h v811_spc009_project 4 months ago
RegAllocBasic.cpp v811_spc009_project 4 months ago
RegAllocFast.cpp v811_spc009_project 4 months ago
RegAllocGreedy.cpp v811_spc009_project 4 months ago
RegAllocPBQP.cpp v811_spc009_project 4 months ago
RegUsageInfoCollector.cpp v811_spc009_project 4 months ago
RegUsageInfoPropagate.cpp v811_spc009_project 4 months ago
RegisterClassInfo.cpp v811_spc009_project 4 months ago
RegisterCoalescer.cpp v811_spc009_project 4 months ago
RegisterCoalescer.h v811_spc009_project 4 months ago
RegisterPressure.cpp v811_spc009_project 4 months ago
RegisterScavenging.cpp v811_spc009_project 4 months ago
RegisterUsageInfo.cpp v811_spc009_project 4 months ago
RenameIndependentSubregs.cpp v811_spc009_project 4 months ago
ResetMachineFunctionPass.cpp v811_spc009_project 4 months ago
SafeStack.cpp v811_spc009_project 4 months ago
SafeStackLayout.cpp v811_spc009_project 4 months ago
SafeStackLayout.h v811_spc009_project 4 months ago
ScheduleDAG.cpp v811_spc009_project 4 months ago
ScheduleDAGInstrs.cpp v811_spc009_project 4 months ago
ScheduleDAGPrinter.cpp v811_spc009_project 4 months ago
ScoreboardHazardRecognizer.cpp v811_spc009_project 4 months ago
ShadowStackGCLowering.cpp v811_spc009_project 4 months ago
ShrinkWrap.cpp v811_spc009_project 4 months ago
SjLjEHPrepare.cpp v811_spc009_project 4 months ago
SlotIndexes.cpp v811_spc009_project 4 months ago
SpillPlacement.cpp v811_spc009_project 4 months ago
SpillPlacement.h v811_spc009_project 4 months ago
SplitKit.cpp v811_spc009_project 4 months ago
SplitKit.h v811_spc009_project 4 months ago
StackColoring.cpp v811_spc009_project 4 months ago
StackMapLivenessAnalysis.cpp v811_spc009_project 4 months ago
StackMaps.cpp v811_spc009_project 4 months ago
StackProtector.cpp v811_spc009_project 4 months ago
StackSlotColoring.cpp v811_spc009_project 4 months ago
SwiftErrorValueTracking.cpp v811_spc009_project 4 months ago
SwitchLoweringUtils.cpp v811_spc009_project 4 months ago
TailDuplication.cpp v811_spc009_project 4 months ago
TailDuplicator.cpp v811_spc009_project 4 months ago
TargetFrameLoweringImpl.cpp v811_spc009_project 4 months ago
TargetInstrInfo.cpp v811_spc009_project 4 months ago
TargetLoweringBase.cpp v811_spc009_project 4 months ago
TargetLoweringObjectFileImpl.cpp v811_spc009_project 4 months ago
TargetOptionsImpl.cpp v811_spc009_project 4 months ago
TargetPassConfig.cpp v811_spc009_project 4 months ago
TargetRegisterInfo.cpp v811_spc009_project 4 months ago
TargetSchedule.cpp v811_spc009_project 4 months ago
TargetSubtargetInfo.cpp v811_spc009_project 4 months ago
TwoAddressInstructionPass.cpp v811_spc009_project 4 months ago
TypePromotion.cpp v811_spc009_project 4 months ago
UnreachableBlockElim.cpp v811_spc009_project 4 months ago
ValueTypes.cpp v811_spc009_project 4 months ago
VirtRegMap.cpp v811_spc009_project 4 months ago
WasmEHPrepare.cpp v811_spc009_project 4 months ago
WinEHPrepare.cpp v811_spc009_project 4 months ago
XRayInstrumentation.cpp v811_spc009_project 4 months ago

README.txt

//===---------------------------------------------------------------------===//

Common register allocation / spilling problem:

        mul lr, r4, lr
        str lr, [sp, #+52]
        ldr lr, [r1, #+32]
        sxth r3, r3
        ldr r4, [sp, #+52]
        mla r4, r3, lr, r4

can be:

        mul lr, r4, lr
        mov r4, lr
        str lr, [sp, #+52]
        ldr lr, [r1, #+32]
        sxth r3, r3
        mla r4, r3, lr, r4

and then "merge" mul and mov:

        mul r4, r4, lr
        str r4, [sp, #+52]
        ldr lr, [r1, #+32]
        sxth r3, r3
        mla r4, r3, lr, r4

It also increase the likelihood the store may become dead.

//===---------------------------------------------------------------------===//

bb27 ...
        ...
        %reg1037 = ADDri %reg1039, 1
        %reg1038 = ADDrs %reg1032, %reg1039, %noreg, 10
    Successors according to CFG: 0x8b03bf0 (#5)

bb76 (0x8b03bf0, LLVM BB @0x8b032d0, ID#5):
    Predecessors according to CFG: 0x8b0c5f0 (#3) 0x8b0a7c0 (#4)
        %reg1039 = PHI %reg1070, mbb<bb76.outer,0x8b0c5f0>, %reg1037, mbb<bb27,0x8b0a7c0>

Note ADDri is not a two-address instruction. However, its result %reg1037 is an
operand of the PHI node in bb76 and its operand %reg1039 is the result of the
PHI node. We should treat it as a two-address code and make sure the ADDri is
scheduled after any node that reads %reg1039.

//===---------------------------------------------------------------------===//

Use local info (i.e. register scavenger) to assign it a free register to allow
reuse:
        ldr r3, [sp, #+4]
        add r3, r3, #3
        ldr r2, [sp, #+8]
        add r2, r2, #2
        ldr r1, [sp, #+4]  <==
        add r1, r1, #1
        ldr r0, [sp, #+4]
        add r0, r0, #2

//===---------------------------------------------------------------------===//

LLVM aggressively lift CSE out of loop. Sometimes this can be negative side-
effects:

R1 = X + 4
R2 = X + 7
R3 = X + 15

loop:
load [i + R1]
...
load [i + R2]
...
load [i + R3]

Suppose there is high register pressure, R1, R2, R3, can be spilled. We need
to implement proper re-materialization to handle this:

R1 = X + 4
R2 = X + 7
R3 = X + 15

loop:
R1 = X + 4  @ re-materialized
load [i + R1]
...
R2 = X + 7 @ re-materialized
load [i + R2]
...
R3 = X + 15 @ re-materialized
load [i + R3]

Furthermore, with re-association, we can enable sharing:

R1 = X + 4
R2 = X + 7
R3 = X + 15

loop:
T = i + X
load [T + 4]
...
load [T + 7]
...
load [T + 15]
//===---------------------------------------------------------------------===//

It's not always a good idea to choose rematerialization over spilling. If all
the load / store instructions would be folded then spilling is cheaper because
it won't require new live intervals / registers. See 2003-05-31-LongShifts for
an example.

//===---------------------------------------------------------------------===//

With a copying garbage collector, derived pointers must not be retained across
collector safe points; the collector could move the objects and invalidate the
derived pointer. This is bad enough in the first place, but safe points can
crop up unpredictably. Consider:

        %array = load { i32, [0 x %obj] }** %array_addr
        %nth_el = getelementptr { i32, [0 x %obj] }* %array, i32 0, i32 %n
        %old = load %obj** %nth_el
        %z = div i64 %x, %y
        store %obj* %new, %obj** %nth_el

If the i64 division is lowered to a libcall, then a safe point will (must)
appear for the call site. If a collection occurs, %array and %nth_el no longer
point into the correct object.

The fix for this is to copy address calculations so that dependent pointers
are never live across safe point boundaries. But the loads cannot be copied
like this if there was an intervening store, so may be hard to get right.

Only a concurrent mutator can trigger a collection at the libcall safe point.
So single-threaded programs do not have this requirement, even with a copying
collector. Still, LLVM optimizations would probably undo a front-end's careful
work.

//===---------------------------------------------------------------------===//

The ocaml frametable structure supports liveness information. It would be good
to support it.

//===---------------------------------------------------------------------===//

The FIXME in ComputeCommonTailLength in BranchFolding.cpp needs to be
revisited. The check is there to work around a misuse of directives in inline
assembly.

//===---------------------------------------------------------------------===//

It would be good to detect collector/target compatibility instead of silently
doing the wrong thing.

//===---------------------------------------------------------------------===//

It would be really nice to be able to write patterns in .td files for copies,
which would eliminate a bunch of explicit predicates on them (e.g. no side
effects).  Once this is in place, it would be even better to have tblgen
synthesize the various copy insertion/inspection methods in TargetInstrInfo.

//===---------------------------------------------------------------------===//

Stack coloring improvements:

1. Do proper LiveStacks analysis on all stack objects including those which are
   not spill slots.
2. Reorder objects to fill in gaps between objects.
   e.g. 4, 1, <gap>, 4, 1, 1, 1, <gap>, 4 => 4, 1, 1, 1, 1, 4, 4

//===---------------------------------------------------------------------===//

The scheduler should be able to sort nearby instructions by their address. For
example, in an expanded memset sequence it's not uncommon to see code like this:

  movl $0, 4(%rdi)
  movl $0, 8(%rdi)
  movl $0, 12(%rdi)
  movl $0, 0(%rdi)

Each of the stores is independent, and the scheduler is currently making an
arbitrary decision about the order.

//===---------------------------------------------------------------------===//

Another opportunitiy in this code is that the $0 could be moved to a register:

  movl $0, 4(%rdi)
  movl $0, 8(%rdi)
  movl $0, 12(%rdi)
  movl $0, 0(%rdi)

This would save substantial code size, especially for longer sequences like
this. It would be easy to have a rule telling isel to avoid matching MOV32mi
if the immediate has more than some fixed number of uses. It's more involved
to teach the register allocator how to do late folding to recover from
excessive register pressure.