llvm-6502/include/llvm/Support/DataFlow.h
Chandler Carruth 0b8c9a80f2 Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-02 11:36:10 +00:00

104 lines
2.6 KiB
C++

//===-- llvm/Support/DataFlow.h - dataflow as graphs ------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines specializations of GraphTraits that allows Use-Def and
// Def-Use relations to be treated as proper graphs for generic algorithms.
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_DATAFLOW_H
#define LLVM_SUPPORT_DATAFLOW_H
#include "llvm/ADT/GraphTraits.h"
#include "llvm/IR/User.h"
namespace llvm {
//===----------------------------------------------------------------------===//
// Provide specializations of GraphTraits to be able to treat def-use/use-def
// chains as graphs
template <> struct GraphTraits<const Value*> {
typedef const Value NodeType;
typedef Value::const_use_iterator ChildIteratorType;
static NodeType *getEntryNode(const Value *G) {
return G;
}
static inline ChildIteratorType child_begin(NodeType *N) {
return N->use_begin();
}
static inline ChildIteratorType child_end(NodeType *N) {
return N->use_end();
}
};
template <> struct GraphTraits<Value*> {
typedef Value NodeType;
typedef Value::use_iterator ChildIteratorType;
static NodeType *getEntryNode(Value *G) {
return G;
}
static inline ChildIteratorType child_begin(NodeType *N) {
return N->use_begin();
}
static inline ChildIteratorType child_end(NodeType *N) {
return N->use_end();
}
};
template <> struct GraphTraits<Inverse<const User*> > {
typedef const Value NodeType;
typedef User::const_op_iterator ChildIteratorType;
static NodeType *getEntryNode(Inverse<const User*> G) {
return G.Graph;
}
static inline ChildIteratorType child_begin(NodeType *N) {
if (const User *U = dyn_cast<User>(N))
return U->op_begin();
return NULL;
}
static inline ChildIteratorType child_end(NodeType *N) {
if(const User *U = dyn_cast<User>(N))
return U->op_end();
return NULL;
}
};
template <> struct GraphTraits<Inverse<User*> > {
typedef Value NodeType;
typedef User::op_iterator ChildIteratorType;
static NodeType *getEntryNode(Inverse<User*> G) {
return G.Graph;
}
static inline ChildIteratorType child_begin(NodeType *N) {
if (User *U = dyn_cast<User>(N))
return U->op_begin();
return NULL;
}
static inline ChildIteratorType child_end(NodeType *N) {
if (User *U = dyn_cast<User>(N))
return U->op_end();
return NULL;
}
};
}
#endif