#include <string>
namespace llvm {
+ class AliasAnalysis;
class TargetLowering;
class TargetMachine;
class MachineDebugInfo;
/// certain types of nodes together, or eliminating superfluous nodes. When
/// the AfterLegalize argument is set to 'true', Combine takes care not to
/// generate any nodes that will be illegal on the target.
- void Combine(bool AfterLegalize);
+ void Combine(bool AfterLegalize, AliasAnalysis &AA);
/// Legalize - This transforms the SelectionDAG into a SelectionDAG that is
/// compatible with the target instruction selector, as indicated by the
#define DEBUG_TYPE "dagcombine"
#include "llvm/ADT/Statistic.h"
+#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/MathExtras.h"
// Worklist of all of the nodes that need to be simplified.
std::vector<SDNode*> WorkList;
+ // AA - Used for DAG load/store alias analysis.
+ AliasAnalysis &AA;
+
/// AddUsersToWorkList - When an instruction is simplified, add all users of
/// the instruction to the work lists because they might get more simplified
/// now.
SDOperand FindBetterChain(SDNode *N, SDOperand Chain);
public:
- DAGCombiner(SelectionDAG &D)
- : DAG(D), TLI(D.getTargetLoweringInfo()), AfterLegalize(false) {}
+ DAGCombiner(SelectionDAG &D, AliasAnalysis &A)
+ : DAG(D),
+ TLI(D.getTargetLoweringInfo()),
+ AfterLegalize(false),
+ AA(A) {}
/// Run - runs the dag combiner on all nodes in the work list
void Run(bool RunningAfterLegalize);
// SelectionDAG::Combine - This is the entry point for the file.
//
-void SelectionDAG::Combine(bool RunningAfterLegalize) {
+void SelectionDAG::Combine(bool RunningAfterLegalize, AliasAnalysis &AA) {
/// run - This is the main entry point to this class.
///
- DAGCombiner(*this).Run(RunningAfterLegalize);
+ DAGCombiner(*this, AA).Run(RunningAfterLegalize);
}
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "isel"
+#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/CodeGen/ScheduleDAG.h"
#include "llvm/CallingConv.h"
void SelectionDAGISel::getAnalysisUsage(AnalysisUsage &AU) const {
// FIXME: we only modify the CFG to split critical edges. This
// updates dom and loop info.
+ AU.addRequired<AliasAnalysis>();
}
}
void SelectionDAGISel::CodeGenAndEmitDAG(SelectionDAG &DAG) {
+ // Get alias analysis for load/store combining.
+ AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
+
// Run the DAG combiner in pre-legalize mode.
- DAG.Combine(false);
+ DAG.Combine(false, AA);
DEBUG(std::cerr << "Lowered selection DAG:\n");
DEBUG(DAG.dump());
DEBUG(DAG.dump());
// Run the DAG combiner in post-legalize mode.
- DAG.Combine(true);
+ DAG.Combine(true, AA);
if (ViewISelDAGs) DAG.viewGraph();