1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/lib/CodeGen
Bob Haarman 8163d702de [codeview] support emitting indirect virtual base class information
Summary:
Fixes PR28281.

MSVC lists indirect virtual base classes in the field list of a class,
using LF_IVBCLASS records. This change makes LLVM emit such records
when processing DW_TAG_inheritance tags with the DIFlagVirtual and
(newly introduced) DIFlagIndirect tags.

Reviewers: rnk, ruiu, zturner

Differential Revision: https://reviews.llvm.org/D25578

llvm-svn: 285130
2016-10-25 22:11:52 +00:00
..
AsmPrinter [codeview] support emitting indirect virtual base class information 2016-10-25 22:11:52 +00:00
GlobalISel Revert r284604. A.K.A. "TMP" 2016-10-19 15:56:12 +00:00
MIRParser [MIRParser] Parse lane masks for register live-ins 2016-10-12 21:06:45 +00:00
SelectionDAG [DAGCombiner] Enable (urem x, (shl pow2, y)) -> (and x, (add (shl pow2, y), -1)) combine for splatted vectors 2016-10-25 22:01:09 +00:00
AggressiveAntiDepBreaker.cpp
AggressiveAntiDepBreaker.h
AllocationOrder.cpp
AllocationOrder.h
Analysis.cpp [CGP] Be less conservative about tail-duplicating a ret to allow tail calls 2016-09-08 00:48:37 +00:00
AntiDepBreaker.h
AtomicExpandPass.cpp
BasicTargetTransformInfo.cpp
BranchFolding.cpp revert: "Remove debug location from common tail when tail-merging" 2016-10-25 20:17:58 +00:00
BranchFolding.h Do not remove implicit defs in BranchFolder 2016-10-12 19:50:57 +00:00
BranchRelaxation.cpp BranchRelaxation: Unique live ins when creating block 2016-10-12 15:32:04 +00:00
BuiltinGCs.cpp
CalcSpillWeights.cpp
CallingConvLower.cpp
CMakeLists.txt Move AArch64BranchRelaxation to generic code 2016-10-06 15:38:53 +00:00
CodeGen.cpp Move AArch64BranchRelaxation to generic code 2016-10-06 15:38:53 +00:00
CodeGenPrepare.cpp Use profile info to set function section prefix to group hot/cold functions. 2016-10-18 20:42:47 +00:00
CountingFunctionInserter.cpp Add a counter-function insertion pass 2016-09-01 09:42:39 +00:00
CriticalAntiDepBreaker.cpp
CriticalAntiDepBreaker.h
DeadMachineInstructionElim.cpp CodeGen: Give MachineBasicBlock::reverse_iterator a handle to the current MI 2016-09-11 18:51:28 +00:00
DetectDeadLanes.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
DFAPacketizer.cpp
DwarfEHPrepare.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
EarlyIfConversion.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
EdgeBundles.cpp Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. 2016-08-25 00:45:04 +00:00
ExecutionDepsFix.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
ExpandISelPseudos.cpp
ExpandPostRAPseudos.cpp
FaultMaps.cpp
FuncletLayout.cpp MachineFunctionProperties/MIRParser: Rename AllVRegsAllocated->NoVRegs, compute it 2016-08-25 01:27:13 +00:00
GCMetadata.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
GCMetadataPrinter.cpp
GCRootLowering.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
GCStrategy.cpp
GlobalMerge.cpp [GlobalMerge] Handle non-landingpad EH pads 2016-10-19 19:56:22 +00:00
IfConversion.cpp CodeGen/Passes: Pass MachineFunction as functor arg; NFC 2016-10-24 23:23:02 +00:00
ImplicitNullChecks.cpp Finish renaming remaining analyzeBranch functions 2016-09-14 20:43:16 +00:00
InlineSpiller.cpp Place the lowered phi instruction(s) before the DEBUG_VALUE entry 2016-09-16 14:07:29 +00:00
InterferenceCache.cpp
InterferenceCache.h
InterleavedAccessPass.cpp [InterleavedAccessPass] Remove global variable. 2016-10-18 18:59:58 +00:00
IntrinsicLowering.cpp Create llvm.addressofreturnaddress intrinsic 2016-10-12 22:13:19 +00:00
LatencyPriorityQueue.cpp
LexicalScopes.cpp Rewrite loops to use range-based for. (NFC) 2016-09-28 17:31:17 +00:00
LiveDebugValues.cpp Teach LiveDebugValues about lexical scopes. 2016-09-28 17:51:14 +00:00
LiveDebugVariables.cpp Remove dead code from LiveDebugVariables.cpp (NFC) 2016-09-28 21:34:23 +00:00
LiveDebugVariables.h
LiveInterval.cpp Create subranges for new intervals resulting from live interval splitting 2016-08-24 13:37:55 +00:00
LiveIntervalAnalysis.cpp Modify df_iterator to support post-order actions 2016-10-05 21:36:16 +00:00
LiveIntervalUnion.cpp
LivePhysRegs.cpp Handle lane masks in LivePhysRegs when adding live-ins 2016-10-12 22:53:41 +00:00
LiveRangeCalc.cpp LiveRangeCalc: Fix reporting of invalid vreg usage in liveness calculation 2016-09-19 16:49:45 +00:00
LiveRangeCalc.h Do not consider subreg defs as reads when computing subrange liveness 2016-09-02 19:48:55 +00:00
LiveRangeEdit.cpp [RegAllocGreedy] Attempt to split unspillable live intervals 2016-10-11 01:04:36 +00:00
LiveRangeUtils.h
LiveRegMatrix.cpp
LiveStackAnalysis.cpp
LiveVariables.cpp Modify df_iterator to support post-order actions 2016-10-05 21:36:16 +00:00
LLVMBuild.txt
LLVMTargetMachine.cpp llc: Add -start-before/-stop-before options 2016-09-23 21:46:02 +00:00
LocalStackSlotAllocation.cpp Fix differences in codegen between Linux and Windows toolchains 2016-10-18 00:11:19 +00:00
LowerEmuTLS.cpp
LowLevelType.cpp GlobalISel: produce correct code for signext/zeroext ABI flags. 2016-09-21 12:57:45 +00:00
MachineBasicBlock.cpp Use StringRef instead of raw pointers in MCAsmInfo/MCInstrInfo APIs (NFC) 2016-10-01 06:46:33 +00:00
MachineBlockFrequencyInfo.cpp Turn cl::values() (for enum) from a vararg function to using C++ variadic template 2016-10-08 19:41:06 +00:00
MachineBlockPlacement.cpp Codegen: Tail-duplicate during placement. 2016-10-11 20:36:43 +00:00
MachineBranchProbabilityInfo.cpp
MachineCombiner.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
MachineCopyPropagation.cpp MachineFunctionProperties/MIRParser: Rename AllVRegsAllocated->NoVRegs, compute it 2016-08-25 01:27:13 +00:00
MachineCSE.cpp [CodeGen] Rename MachineInstr::isInvariantLoad to isDereferenceableInvariantLoad. NFC 2016-09-10 01:03:20 +00:00
MachineDominanceFrontier.cpp
MachineDominators.cpp
MachineFunction.cpp [MachineMemOperand] Move synchronization scope and atomic orderings from SDNode to MachineMemOperand, and remove redundant getAtomic* member functions from SelectionDAG. 2016-10-15 22:01:18 +00:00
MachineFunctionPass.cpp [MFProperties][NFC] Rename clear into reset to match BitVector naming. 2016-08-26 22:09:08 +00:00
MachineFunctionPrinterPass.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
MachineInstr.cpp [MachineMemOperand] Move synchronization scope and atomic orderings from SDNode to MachineMemOperand, and remove redundant getAtomic* member functions from SelectionDAG. 2016-10-15 22:01:18 +00:00
MachineInstrBundle.cpp CodeGen/Passes: Pass MachineFunction as functor arg; NFC 2016-10-24 23:23:02 +00:00
MachineLICM.cpp [CodeGen] Rename MachineInstr::isInvariantLoad to isDereferenceableInvariantLoad. NFC 2016-09-10 01:03:20 +00:00
MachineLoopInfo.cpp
MachineModuleInfo.cpp CodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePasses 2016-08-24 01:52:46 +00:00
MachineModuleInfoImpls.cpp
MachinePassRegistry.cpp
MachinePipeliner.cpp Use MachineInstr::mop_iterator instead of MIOperands; NFC 2016-10-24 21:36:43 +00:00
MachinePostDominators.cpp
MachineRegionInfo.cpp
MachineRegisterInfo.cpp Fix warning; NFC 2016-10-11 04:32:03 +00:00
MachineScheduler.cpp Fix differences in codegen between Linux and Windows toolchains 2016-10-18 00:11:19 +00:00
MachineSink.cpp Using branch probability to guide critical edge splitting. 2016-10-20 18:06:52 +00:00
MachineSSAUpdater.cpp Retire llvm::alignOf in favor of C++11 alignof. 2016-10-20 15:02:18 +00:00
MachineTraceMetrics.cpp
MachineVerifier.cpp Modify df_iterator to support post-order actions 2016-10-05 21:36:16 +00:00
MIRPrinter.cpp [MIRParser] Parse lane masks for register live-ins 2016-10-12 21:06:45 +00:00
MIRPrinter.h
MIRPrintingPass.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
OptimizePHIs.cpp
ParallelCG.cpp
PatchableFunction.cpp MachineFunctionProperties/MIRParser: Rename AllVRegsAllocated->NoVRegs, compute it 2016-08-25 01:27:13 +00:00
PeepholeOptimizer.cpp Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. 2016-08-25 00:45:04 +00:00
PHIElimination.cpp MachineFunction: Introduce NoPHIs property 2016-08-23 21:19:49 +00:00
PHIEliminationUtils.cpp Place the lowered phi instruction(s) before the DEBUG_VALUE entry 2016-09-16 14:07:29 +00:00
PHIEliminationUtils.h
PostRAHazardRecognizer.cpp
PostRASchedulerList.cpp MachineFunctionProperties/MIRParser: Rename AllVRegsAllocated->NoVRegs, compute it 2016-08-25 01:27:13 +00:00
PreISelIntrinsicLowering.cpp
ProcessImplicitDefs.cpp
PrologEpilogInserter.cpp Modify df_iterator to support post-order actions 2016-10-05 21:36:16 +00:00
PseudoSourceValue.cpp
README.txt
RegAllocBase.cpp Create subranges for new intervals resulting from live interval splitting 2016-08-24 13:37:55 +00:00
RegAllocBase.h
RegAllocBasic.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
RegAllocFast.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
RegAllocGreedy.cpp [RAGreedy] Empty live-ranges always succeed in last chance recoloring. 2016-10-13 19:27:48 +00:00
RegAllocPBQP.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
RegisterClassInfo.cpp
RegisterCoalescer.cpp Missed a semicolon in r279835 2016-08-26 16:50:57 +00:00
RegisterCoalescer.h
RegisterPressure.cpp
RegisterScavenging.cpp [RegisterScavenger] Remove aliasing registers of operands from the candidate set 2016-09-06 10:10:21 +00:00
RegisterUsageInfo.cpp
RegUsageInfoCollector.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
RegUsageInfoPropagate.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
RenameIndependentSubregs.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
ResetMachineFunctionPass.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
SafeStack.cpp Test commit. 2016-10-17 19:09:19 +00:00
SafeStackColoring.cpp [safestack] Fix assertion failure in stack coloring. 2016-09-16 22:04:10 +00:00
SafeStackColoring.h
SafeStackLayout.cpp
SafeStackLayout.h
ScheduleDAG.cpp ScheduleDAG: Match enum names when printing sdep kinds 2016-09-23 18:28:31 +00:00
ScheduleDAGInstrs.cpp MachineInstrBundle: Pass iterators to getBundle(Start|End); NFC 2016-10-25 02:55:17 +00:00
ScheduleDAGPrinter.cpp
ScoreboardHazardRecognizer.cpp
ShadowStackGCLowering.cpp
ShrinkWrap.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
SjLjEHPrepare.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
SlotIndexes.cpp
Spiller.h
SpillPlacement.cpp
SpillPlacement.h
SplitKit.cpp Place the lowered phi instruction(s) before the DEBUG_VALUE entry 2016-09-16 14:07:29 +00:00
SplitKit.h Create subranges for new intervals resulting from live interval splitting 2016-08-24 13:37:55 +00:00
StackColoring.cpp
StackMapLivenessAnalysis.cpp MachineFunctionProperties/MIRParser: Rename AllVRegsAllocated->NoVRegs, compute it 2016-08-25 01:27:13 +00:00
StackMaps.cpp [Stackmap] Added callsite counts to emitted function information. 2016-09-14 20:22:03 +00:00
StackProtector.cpp [CodeGen] stop short-circuiting the SSP code for sspstrong. 2016-09-20 21:30:01 +00:00
StackSlotColoring.cpp
TailDuplication.cpp Codegen: Tail-duplicate during placement. 2016-10-11 20:36:43 +00:00
TailDuplicator.cpp Codegen: Tail-duplicate during placement. 2016-10-11 20:36:43 +00:00
TargetFrameLoweringImpl.cpp
TargetInstrInfo.cpp Target: Remove unused entities. 2016-10-09 04:38:57 +00:00
TargetLoweringBase.cpp Add option to specify minimum number of entries for jump tables 2016-10-25 19:53:51 +00:00
TargetLoweringObjectFileImpl.cpp Target: Change various section classifiers in TargetLoweringObjectFile to take a GlobalObject. 2016-10-24 19:23:39 +00:00
TargetOptionsImpl.cpp
TargetPassConfig.cpp Turn cl::values() (for enum) from a vararg function to using C++ variadic template 2016-10-08 19:41:06 +00:00
TargetRegisterInfo.cpp
TargetSchedule.cpp TargetSchedule: Do not consider subregister definitions as reads. 2016-08-24 02:32:29 +00:00
TwoAddressInstructionPass.cpp [TwoAddressInstruction] When commuting an instruction don't assume that the destination register is operand 0. Pass it from the caller. 2016-09-11 22:10:42 +00:00
UnreachableBlockElim.cpp Modify df_iterator to support post-order actions 2016-10-05 21:36:16 +00:00
VirtRegMap.cpp MachineFunctionProperties/MIRParser: Rename AllVRegsAllocated->NoVRegs, compute it 2016-08-25 01:27:13 +00:00
WinEHPrepare.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
XRayInstrumentation.cpp [XRay] Support for for tail calls for ARM no-Thumb 2016-10-18 05:54:15 +00:00

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

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 LiveStackAnalysis 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.