From a70e697e291e2e1cf479994f7bbfef283214b54a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 30 Aug 2002 20:30:03 +0000 Subject: [PATCH] Initial implementation of basic value numbering This file will probably go away at some point llvm-svn: 3542 --- .../llvm/Analysis/BasicValueNumbering.h | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 llvm/include/llvm/Analysis/BasicValueNumbering.h diff --git a/llvm/include/llvm/Analysis/BasicValueNumbering.h b/llvm/include/llvm/Analysis/BasicValueNumbering.h new file mode 100644 index 000000000000..66c7d94c1ab0 --- /dev/null +++ b/llvm/include/llvm/Analysis/BasicValueNumbering.h @@ -0,0 +1,37 @@ +//===- llvm/Analysis/BasicValueNumbering.h - Value #'ing Impl ---*- C++ -*-===// +// +// This file defines the default implementation of the Value Numbering +// interface, which uses the SSA value graph to find lexically identical +// expressions. This does not require any computation ahead of time, so it is a +// very fast default implementation. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ANALYSIS_BASIC_VALUE_NUMBERING_H +#define LLVM_ANALYSIS_BASIC_VALUE_NUMBERING_H + +#include "llvm/Analysis/ValueNumbering.h" +#include "llvm/Pass.h" + +struct BasicValueNumbering : public FunctionPass, public ValueNumbering { + + /// Pass Implementation stuff. This isn't much of a pass. + /// + bool runOnFunction(Function &) { return false; } + + /// getAnalysisUsage - Does not modify anything. + /// + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } + + /// getEqualNumberNodes - Return nodes with the same value number as the + /// specified Value. This fills in the argument vector with any equal values. + /// + /// This is where our implementation is. + /// + virtual void getEqualNumberNodes(Value *V1, + std::vector &RetVals) const; +}; + +#endif