1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
llvm-mirror/lib/Target/Hexagon/RDFCopy.h
Krzysztof Parzyszek 8ef90fe4f8 RDF: Copy propagation
This is a very limited implementation of DFG-based copy propagation.
It only handles actual COPY instructions (does not handle other equivalents
such as add-immediate with a 0 operand).
The major limitation is that it does not update the DFG: that will be the
change required to make it more robust (hopefully coming up soon).

llvm-svn: 257490
2016-01-12 17:23:48 +00:00

49 lines
1.2 KiB
C++

//===--- RDFCopy.h --------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef RDF_COPY_H
#define RDF_COPY_H
#include "RDFGraph.h"
#include <map>
#include <vector>
namespace llvm {
class MachineBasicBlock;
class MachineDominatorTree;
class MachineInstr;
}
namespace rdf {
struct CopyPropagation {
CopyPropagation(DataFlowGraph &dfg) : MDT(dfg.getDT()), DFG(dfg),
Trace(false) {}
bool run();
void trace(bool On) { Trace = On; }
bool trace() const { return Trace; }
private:
const MachineDominatorTree &MDT;
DataFlowGraph &DFG;
DataFlowGraph::DefStackMap DefM;
bool Trace;
// map: register -> (map: stmt -> reaching def)
std::map<RegisterRef,std::map<NodeId,NodeId>> RDefMap;
std::vector<NodeId> Copies;
void recordCopy(NodeAddr<StmtNode*> SA, MachineInstr *MI);
void updateMap(NodeAddr<InstrNode*> IA);
bool scanBlock(MachineBasicBlock *B);
};
}
#endif