mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 23:17:16 +00:00
Factor out LiveIntervalAnalysis' code to determine whether an instruction
is trivially rematerializable and integrate it into TargetInstrInfo::isTriviallyReMaterializable. This way, all places that need to know whether an instruction is rematerializable will get the same answer. This enables the useful parts of the aggressive-remat option by default -- using AliasAnalysis to determine whether a memory location is invariant, and removes the questionable parts -- rematting operations with virtual register inputs that may not be live everywhere. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83687 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/MachineDominators.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
@@ -39,6 +40,7 @@ namespace {
|
||||
MachineFunction *CurMF; // Current MachineFunction
|
||||
MachineRegisterInfo *RegInfo; // Machine register information
|
||||
MachineDominatorTree *DT; // Machine dominator tree
|
||||
AliasAnalysis *AA;
|
||||
BitVector AllocatableSet; // Which physregs are allocatable?
|
||||
|
||||
public:
|
||||
@@ -50,6 +52,7 @@ namespace {
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesCFG();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
AU.addRequired<AliasAnalysis>();
|
||||
AU.addRequired<MachineDominatorTree>();
|
||||
AU.addPreserved<MachineDominatorTree>();
|
||||
}
|
||||
@@ -100,6 +103,7 @@ bool MachineSinking::runOnMachineFunction(MachineFunction &MF) {
|
||||
TRI = TM->getRegisterInfo();
|
||||
RegInfo = &CurMF->getRegInfo();
|
||||
DT = &getAnalysis<MachineDominatorTree>();
|
||||
AA = &getAnalysis<AliasAnalysis>();
|
||||
AllocatableSet = TRI->getAllocatableSet(*CurMF);
|
||||
|
||||
bool EverMadeChange = false;
|
||||
@@ -151,7 +155,7 @@ bool MachineSinking::ProcessBlock(MachineBasicBlock &MBB) {
|
||||
/// instruction out of its current block into a successor.
|
||||
bool MachineSinking::SinkInstruction(MachineInstr *MI, bool &SawStore) {
|
||||
// Check if it's safe to move the instruction.
|
||||
if (!MI->isSafeToMove(TII, SawStore))
|
||||
if (!MI->isSafeToMove(TII, SawStore, AA))
|
||||
return false;
|
||||
|
||||
// FIXME: This should include support for sinking instructions within the
|
||||
|
||||
Reference in New Issue
Block a user