diff options
Diffstat (limited to 'contrib/llvm/tools/llvm-diff')
| -rw-r--r-- | contrib/llvm/tools/llvm-diff/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | contrib/llvm/tools/llvm-diff/DiffConsumer.cpp | 6 | ||||
| -rw-r--r-- | contrib/llvm/tools/llvm-diff/DiffConsumer.h | 1 | ||||
| -rw-r--r-- | contrib/llvm/tools/llvm-diff/DifferenceEngine.cpp | 18 | ||||
| -rw-r--r-- | contrib/llvm/tools/llvm-diff/DifferenceEngine.h | 4 | ||||
| -rw-r--r-- | contrib/llvm/tools/llvm-diff/Makefile | 17 | ||||
| -rw-r--r-- | contrib/llvm/tools/llvm-diff/llvm-diff.cpp | 2 | 
7 files changed, 23 insertions, 33 deletions
| diff --git a/contrib/llvm/tools/llvm-diff/CMakeLists.txt b/contrib/llvm/tools/llvm-diff/CMakeLists.txt deleted file mode 100644 index c59d69ea0d45..000000000000 --- a/contrib/llvm/tools/llvm-diff/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -set(LLVM_LINK_COMPONENTS support asmparser bitreader) - -add_llvm_tool(llvm-diff -  llvm-diff.cpp -  DiffConsumer.cpp -  DiffLog.cpp -  DifferenceEngine.cpp -  ) diff --git a/contrib/llvm/tools/llvm-diff/DiffConsumer.cpp b/contrib/llvm/tools/llvm-diff/DiffConsumer.cpp index c23e8fb91a1b..05280392a47f 100644 --- a/contrib/llvm/tools/llvm-diff/DiffConsumer.cpp +++ b/contrib/llvm/tools/llvm-diff/DiffConsumer.cpp @@ -44,6 +44,8 @@ static void ComputeNumbering(Function *F, DenseMap<Value*,unsigned> &Numbering){  } +void Consumer::anchor() { } +  void DiffConsumer::printValue(Value *V, bool isL) {    if (V->hasName()) {      out << (isa<GlobalValue>(V) ? '@' : '%') << V->getName(); @@ -64,6 +66,10 @@ void DiffConsumer::printValue(Value *V, bool isL) {      }      return;    } +  if (isa<Constant>(V)) { +    out << *V; +    return; +  }    unsigned N = contexts.size();    while (N > 0) { diff --git a/contrib/llvm/tools/llvm-diff/DiffConsumer.h b/contrib/llvm/tools/llvm-diff/DiffConsumer.h index b95d42713a64..2060fe1c944f 100644 --- a/contrib/llvm/tools/llvm-diff/DiffConsumer.h +++ b/contrib/llvm/tools/llvm-diff/DiffConsumer.h @@ -29,6 +29,7 @@ namespace llvm {    /// The interface for consumers of difference data.    class Consumer { +    virtual void anchor();    public:      /// Record that a local context has been entered.  Left and      /// Right are IR "containers" of some sort which are being diff --git a/contrib/llvm/tools/llvm-diff/DifferenceEngine.cpp b/contrib/llvm/tools/llvm-diff/DifferenceEngine.cpp index b240d8c5da5d..a5a99f5b9c47 100644 --- a/contrib/llvm/tools/llvm-diff/DifferenceEngine.cpp +++ b/contrib/llvm/tools/llvm-diff/DifferenceEngine.cpp @@ -319,15 +319,19 @@ class FunctionDifferenceEngine {        bool Difference = false;        DenseMap<ConstantInt*,BasicBlock*> LCases; -      for (unsigned I = 1, E = LI->getNumCases(); I != E; ++I) -        LCases[LI->getCaseValue(I)] = LI->getSuccessor(I); -      for (unsigned I = 1, E = RI->getNumCases(); I != E; ++I) { -        ConstantInt *CaseValue = RI->getCaseValue(I); +       +      for (SwitchInst::CaseIt I = LI->case_begin(), E = LI->case_end(); +           I != E; ++I) +        LCases[I.getCaseValue()] = I.getCaseSuccessor(); +         +      for (SwitchInst::CaseIt I = RI->case_begin(), E = RI->case_end(); +           I != E; ++I) { +        ConstantInt *CaseValue = I.getCaseValue();          BasicBlock *LCase = LCases[CaseValue];          if (LCase) { -          if (TryUnify) tryUnify(LCase, RI->getSuccessor(I)); +          if (TryUnify) tryUnify(LCase, I.getCaseSuccessor());            LCases.erase(CaseValue); -        } else if (!Difference) { +        } else if (Complain || !Difference) {            if (Complain)              Engine.logf("right switch has extra case %r") << CaseValue;            Difference = true; @@ -628,6 +632,8 @@ void FunctionDifferenceEngine::runBlockDiff(BasicBlock::iterator LStart,  } +void DifferenceEngine::Oracle::anchor() { } +  void DifferenceEngine::diff(Function *L, Function *R) {    Context C(*this, L, R); diff --git a/contrib/llvm/tools/llvm-diff/DifferenceEngine.h b/contrib/llvm/tools/llvm-diff/DifferenceEngine.h index 5b4f80b99e55..7ea79e430ff5 100644 --- a/contrib/llvm/tools/llvm-diff/DifferenceEngine.h +++ b/contrib/llvm/tools/llvm-diff/DifferenceEngine.h @@ -50,7 +50,9 @@ namespace llvm {      /// An oracle for answering whether two values are equivalent as      /// operands. -    struct Oracle { +    class Oracle { +      virtual void anchor(); +    public:        virtual bool operator()(Value *L, Value *R) = 0;      protected: diff --git a/contrib/llvm/tools/llvm-diff/Makefile b/contrib/llvm/tools/llvm-diff/Makefile deleted file mode 100644 index 58e49fa95962..000000000000 --- a/contrib/llvm/tools/llvm-diff/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -##===- tools/llvm-diff/Makefile ----------------------------*- Makefile -*-===## -#  -#                     The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -#  -##===----------------------------------------------------------------------===## - -LEVEL = ../.. -TOOLNAME = llvm-diff -LINK_COMPONENTS := asmparser bitreader - -# This tool has no plugins, optimize startup time. -TOOL_NO_EXPORTS = 1 - -include $(LEVEL)/Makefile.common diff --git a/contrib/llvm/tools/llvm-diff/llvm-diff.cpp b/contrib/llvm/tools/llvm-diff/llvm-diff.cpp index 76853f1e4330..774169bcde17 100644 --- a/contrib/llvm/tools/llvm-diff/llvm-diff.cpp +++ b/contrib/llvm/tools/llvm-diff/llvm-diff.cpp @@ -38,7 +38,7 @@ static Module *ReadModule(LLVMContext &Context, StringRef Name) {    SMDiagnostic Diag;    Module *M = ParseIRFile(Name, Diag, Context);    if (!M) -    Diag.Print("llvmdiff", errs()); +    Diag.print("llvm-diff", errs());    return M;  } | 
