#ifndef LLVM_CODEGEN_MACHINESSAUPDATER_H
#define LLVM_CODEGEN_MACHINESSAUPDATER_H
+#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Compiler.h"
+
namespace llvm {
class MachineBasicBlock;
class MachineFunction;
class TargetInstrInfo;
class TargetRegisterClass;
template<typename T> class SmallVectorImpl;
- class BumpPtrAllocator;
+ template<typename T> class SSAUpdaterTraits;
/// MachineSSAUpdater - This class updates SSA form for a set of virtual
/// registers defined in multiple blocks. This is used when code duplication
/// or another unstructured transformation wants to rewrite a set of uses of one
/// vreg with uses of a set of vregs.
class MachineSSAUpdater {
-public:
- class BBInfo;
- typedef SmallVectorImpl<BBInfo*> BlockListTy;
+ friend class SSAUpdaterTraits<MachineSSAUpdater>;
private:
/// AvailableVals - This keeps track of which value to use on a per-block
//typedef DenseMap<MachineBasicBlock*, unsigned > AvailableValsTy;
void *AV;
- /// BBMap - The GetValueAtEndOfBlock method maintains this mapping from
- /// basic blocks to BBInfo structures.
- /// typedef DenseMap<MachineBasicBlock*, BBInfo*> BBMapTy;
- void *BM;
-
/// VR - Current virtual register whose uses are being updated.
unsigned VR;
/// MachineSSAUpdater constructor. If InsertedPHIs is specified, it will be
/// filled in with all PHI Nodes created by rewriting.
explicit MachineSSAUpdater(MachineFunction &MF,
- SmallVectorImpl<MachineInstr*> *InsertedPHIs = 0);
+ SmallVectorImpl<MachineInstr*> *InsertedPHIs = nullptr);
~MachineSSAUpdater();
/// Initialize - Reset this object to get ready for a new set of SSA
void RewriteUse(MachineOperand &U);
private:
- void ReplaceRegWith(unsigned OldReg, unsigned NewReg);
unsigned GetValueAtEndOfBlockInternal(MachineBasicBlock *BB);
- void BuildBlockList(MachineBasicBlock *BB, BlockListTy *BlockList,
- BumpPtrAllocator *Allocator);
- void FindDominators(BlockListTy *BlockList);
- void FindPHIPlacement(BlockListTy *BlockList);
- void FindAvailableVals(BlockListTy *BlockList);
- void FindExistingPHI(MachineBasicBlock *BB, BlockListTy *BlockList);
- bool CheckIfPHIMatches(MachineInstr *PHI);
- void RecordMatchingPHI(MachineInstr *PHI);
-
- void operator=(const MachineSSAUpdater&); // DO NOT IMPLEMENT
- MachineSSAUpdater(const MachineSSAUpdater&); // DO NOT IMPLEMENT
+
+ void operator=(const MachineSSAUpdater&) LLVM_DELETED_FUNCTION;
+ MachineSSAUpdater(const MachineSSAUpdater&) LLVM_DELETED_FUNCTION;
};
} // End llvm namespace