dnl * Initialize
dnl **************************************************************************
AC_INIT([[[LLVM]]],[[[1.0]]],[llvmbugs@cs.uiuc.edu])
+dnl AC_CONFIG_SRC_DIR(lib/VMCore/Pass.cpp)
dnl Place all of the extra autoconf files into the config subdirectory
AC_CONFIG_AUX_DIR([autoconf])
#include "llvm/Instructions.h"
#include "llvm/Bytecode/Writer.h"
+using namespace llvm;
+
int main() {
// Create the "module" or "program" or "translation unit" to hold the
// function
#include "llvm/Instructions.h"
#include "llvm/Bytecode/Writer.h"
+using namespace llvm;
+
int main() {
// Create the "module" or "program" or "translation unit" to hold the
// function
#include <string>
#include <cassert>
+namespace llvm {
+
class AnnotationID;
class Annotation;
class Annotable;
return A;
}
+} // End namespace llvm
+
#endif
#include <functional>
#include <iostream>
+namespace llvm {
+
class BitSetVector {
enum { BITSET_WORDSIZE = sizeof(long)*8 };
return true;
}
+} // End llvm namespace
#endif
#ifndef SUPPORT_CASTING_H
#define SUPPORT_CASTING_H
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// isa<x> Support Templates
//===----------------------------------------------------------------------===//
#endif
+} // End llvm namespace
+
#endif
#include <cassert>
#include "boost/type_traits/object_traits.hpp"
+namespace llvm {
/// cl Namespace - This namespace contains all of the command line option
/// processing machinery. It is intentionally a short name to make qualified
/// usage concise.
} // End namespace cl
+} // End namespace llvm
+
#endif
#include <string>
+namespace llvm {
+
/// DefaultDOTGraphTraits - This class provides the default implementations of
/// all of the DOTGraphTraits methods. If a specialization does not need to
/// override all methods here it should inherit so that it can get the default
template <typename Ty>
class DOTGraphTraits : public DefaultDOTGraphTraits {};
+} // End llvm namespace
+
#endif
#ifndef SUPPORT_DEBUG_H
#define SUPPORT_DEBUG_H
+namespace llvm {
+
// DebugFlag - This boolean is set to true if the '-debug' command line option
// is specified. This should probably not be referenced directly, instead, use
// the DEBUG macro below.
do { if (DebugFlag && isCurrentDebugType(DEBUG_TYPE)) { X; } } while (0)
#endif
+} // End llvm namespace
+
#endif
#include <vector>
#include <set>
+namespace llvm {
+
// df_iterator_storage - A private class which is used to figure out where to
// store the visited set.
template<class SetType, bool External> // Non-external set
return idf_ext_iterator<T, SetTy>::end(G, S);
}
+} // End llvm namespace
#endif
#include <string>
+namespace llvm {
+
/// LinkDynamicObject - Load the named file as a dynamic library
/// and link it with the currently running process. Returns false
/// on success, true if there is an error (and sets ErrorMessage
void *GetAddressOfSymbol (const char *symbolName);
void *GetAddressOfSymbol (const std::string &symbolName);
+} // End llvm namespace
+
#endif // SUPPORT_DYNAMICLINKER_H
#include <map>
#include <vector>
+namespace llvm {
+
template <class ElemTy>
class EquivalenceClasses {
// Maps each element to the element that is the leader of its
}
};
+} // End llvm namespace
+
#endif
#include <string>
+namespace llvm {
+
/// CheckMagic - Returns true IFF the file named FN begins with Magic. FN must
/// name a readable file.
///
///
bool MakeFileReadable (const std::string & Filename);
+} // End llvm namespace
+
#endif
#ifndef SUPPORT_GRAPHTRAITS_H
#define SUPPORT_GRAPHTRAITS_H
+namespace llvm {
+
// GraphTraits - This class should be specialized by different graph types...
// which is why the default version is empty.
//
inline Inverse(GraphType &G) : Graph(G) {}
};
+} // End llvm namespace
+
#endif
#include <vector>
#include <iostream>
+namespace llvm {
+
namespace DOT { // Private functions...
inline std::string EscapeString(const std::string &Label) {
std::string Str(Label);
return O;
}
+} // End llvm namespace
+
#endif
#define SUPPORT_LEAKDETECTOR_H
#include <string>
+
+namespace llvm {
+
class Value;
struct LeakDetector {
static void checkForGarbageImpl(const std::string &Message);
};
+} // End llvm namespace
+
#endif
#include <cstdlib>
#include <memory>
+namespace llvm {
+
template<typename T>
struct MallocAllocator {
typedef size_t size_type;
};
}
+} // End llvm namespace
#endif
#include "Support/DataTypes.h"
+namespace llvm {
+
inline unsigned log2(uint64_t C) {
unsigned getPow;
for (getPow = 0; C > 1; ++getPow)
return false;
}
+} // End llvm namespace
+
#endif
#include <stack>
#include <set>
+namespace llvm {
+
template<class GraphT, class GT = GraphTraits<GraphT> >
class po_iterator : public forward_iterator<typename GT::NodeType, ptrdiff_t> {
typedef forward_iterator<typename GT::NodeType, ptrdiff_t> super;
inline rpo_iterator end() { return Blocks.rend(); }
};
+} // End llvm namespace
+
#endif
#include <vector>
#include <map>
+namespace llvm {
+
//===----------------------------------------------------------------------===//
///
/// scc_iterator - Enumerate the SCCs of a directed graph, in
return scc_iterator<T>::end(G);
}
+} // End llvm namespace
+
#endif
#include "Support/iterator"
#include "boost/type_traits/transform_traits.hpp"
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// Extra additions to <functional>
//===----------------------------------------------------------------------===//
return tier<T1, T2>(f, s);
}
+} // End llvm namespace
+
#endif
#ifndef SUPPORT_SETOPERATIONS_H
#define SUPPORT_SETOPERATIONS_H
+namespace llvm {
+
// set_union(A, B) - Compute A := A u B, return whether A changed.
//
template <class S1Ty, class S2Ty>
S1.erase(*SI);
}
+} // End llvm namespace
+
#endif
#include <string>
+namespace llvm {
+
// RemoveFileOnSignal - This function registers signal handlers to ensure that
// if a signal gets delivered that the named file is removed.
//
void RemoveFileOnSignal(const std::string &Filename);
-#endif
+} // End llvm namespace
+#endif
#include <iosfwd>
+namespace llvm {
+
// StatisticBase - Nontemplated base class for Statistic<> class...
class StatisticBase {
const char *Name;
const Statistic &operator-=(const DataType &V) { Value -= V; return *this; }
};
+} // End llvm namespace
+
#endif
#include <string>
#include <stdio.h>
+namespace llvm {
+
static inline std::string utohexstr(uint64_t X) {
char Buffer[40];
char *BufPtr = Buffer+39;
return Buffer;
}
+} // End llvm namespace
+
#endif
#include <string>
+namespace llvm {
+
/// isExecutableFile - This function returns true if the filename specified
/// exists and is executable.
///
/// wait for it to terminate.
///
int ExecWait (const char * const argv[], const char * const envp[]);
+
+} // End llvm namespace
+
#endif
#include <iosfwd>
#include <cassert>
+namespace llvm {
+
class TimerGroup;
/// Timer - This class is used to track the amount of time spent between
}
};
+} // End llvm namespace
+
#endif
#include <vector>
+namespace llvm {
+
template<class ConcreteTreeNode, class Payload>
class Tree {
std::vector<ConcreteTreeNode*> Children; // This nodes children, if any
inline const Payload &getTreeData() const { return Data; }
};
+} // End llvm namespace
#endif
#include <typeinfo>
+namespace llvm {
+
struct TypeInfo {
TypeInfo() { // needed for containers
struct Nil {}; // Anonymous class distinct from all others...
return !(lhs < rhs);
}
+} // End llvm namespace
+
#endif
#include <cstdarg>
+namespace llvm {
+
/// make_vector - Helper function which is useful for building temporary vectors
/// to pass into type construction of CallInst ctors. This turns a null
/// terminated list of pointers (or other value types) into a real live vector.
return Result;
}
+} // End llvm namespace
+
#endif
#include <Support/iterator>
#include <cassert>
+namespace llvm {
+
template<typename NodeTy, typename Traits> class iplist;
template<typename NodeTy> class ilist_iterator;
void resize(size_type newsize) { resize(newsize, NodeTy()); }
};
+} // End llvm namespace
+
namespace std {
// Ensure that swap uses the fast list swap...
template<class Ty>
- void swap(iplist<Ty> &Left, iplist<Ty> &Right) {
+ void swap(llvm::iplist<Ty> &Left, llvm::iplist<Ty> &Right) {
Left.swap(Right);
}
} // End 'std' extensions...
#include <functional>
#include <iostream>
+namespace llvm {
+
class BitSetVector {
enum { BITSET_WORDSIZE = sizeof(long)*8 };
return true;
}
+} // End llvm namespace
#endif
#include <vector>
#include <set>
+namespace llvm {
+
// df_iterator_storage - A private class which is used to figure out where to
// store the visited set.
template<class SetType, bool External> // Non-external set
return idf_ext_iterator<T, SetTy>::end(G, S);
}
+} // End llvm namespace
#endif
#include <map>
#include <vector>
+namespace llvm {
+
template <class ElemTy>
class EquivalenceClasses {
// Maps each element to the element that is the leader of its
}
};
+} // End llvm namespace
+
#endif
#ifndef SUPPORT_GRAPHTRAITS_H
#define SUPPORT_GRAPHTRAITS_H
+namespace llvm {
+
// GraphTraits - This class should be specialized by different graph types...
// which is why the default version is empty.
//
inline Inverse(GraphType &G) : Graph(G) {}
};
+} // End llvm namespace
+
#endif
#include <stack>
#include <set>
+namespace llvm {
+
template<class GraphT, class GT = GraphTraits<GraphT> >
class po_iterator : public forward_iterator<typename GT::NodeType, ptrdiff_t> {
typedef forward_iterator<typename GT::NodeType, ptrdiff_t> super;
inline rpo_iterator end() { return Blocks.rend(); }
};
+} // End llvm namespace
+
#endif
#include <vector>
#include <map>
+namespace llvm {
+
//===----------------------------------------------------------------------===//
///
/// scc_iterator - Enumerate the SCCs of a directed graph, in
return scc_iterator<T>::end(G);
}
+} // End llvm namespace
+
#endif
#include "Support/iterator"
#include "boost/type_traits/transform_traits.hpp"
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// Extra additions to <functional>
//===----------------------------------------------------------------------===//
return tier<T1, T2>(f, s);
}
+} // End llvm namespace
+
#endif
#ifndef SUPPORT_SETOPERATIONS_H
#define SUPPORT_SETOPERATIONS_H
+namespace llvm {
+
// set_union(A, B) - Compute A := A u B, return whether A changed.
//
template <class S1Ty, class S2Ty>
S1.erase(*SI);
}
+} // End llvm namespace
+
#endif
#include <iosfwd>
+namespace llvm {
+
// StatisticBase - Nontemplated base class for Statistic<> class...
class StatisticBase {
const char *Name;
const Statistic &operator-=(const DataType &V) { Value -= V; return *this; }
};
+} // End llvm namespace
+
#endif
#include <string>
#include <stdio.h>
+namespace llvm {
+
static inline std::string utohexstr(uint64_t X) {
char Buffer[40];
char *BufPtr = Buffer+39;
return Buffer;
}
+} // End llvm namespace
+
#endif
#include <vector>
+namespace llvm {
+
template<class ConcreteTreeNode, class Payload>
class Tree {
std::vector<ConcreteTreeNode*> Children; // This nodes children, if any
inline const Payload &getTreeData() const { return Data; }
};
+} // End llvm namespace
#endif
#include <cstdarg>
+namespace llvm {
+
/// make_vector - Helper function which is useful for building temporary vectors
/// to pass into type construction of CallInst ctors. This turns a null
/// terminated list of pointers (or other value types) into a real live vector.
return Result;
}
+} // End llvm namespace
+
#endif
#include <Support/iterator>
#include <cassert>
+namespace llvm {
+
template<typename NodeTy, typename Traits> class iplist;
template<typename NodeTy> class ilist_iterator;
void resize(size_type newsize) { resize(newsize, NodeTy()); }
};
+} // End llvm namespace
+
namespace std {
// Ensure that swap uses the fast list swap...
template<class Ty>
- void swap(iplist<Ty> &Left, iplist<Ty> &Right) {
+ void swap(llvm::iplist<Ty> &Left, llvm::iplist<Ty> &Right) {
Left.swap(Right);
}
} // End 'std' extensions...
//
#include <cassert>
+namespace llvm {
+
class Type;
class DerivedType;
void dropRef();
};
+} // End llvm namespace
+
#endif
#define LLVM_ANALYSIS_ALIAS_ANALYSIS_H
#include "llvm/Support/CallSite.h"
+
+namespace llvm {
+
class LoadInst;
class StoreInst;
class TargetData;
const Value *Ptr, unsigned Size);
};
+} // End llvm namespace
+
#endif
#include "Support/iterator"
#include "Support/hash_map"
#include "Support/ilist"
+
+namespace llvm {
+
class AliasAnalysis;
class LoadInst;
class StoreInst;
return OS;
}
+} // End llvm namespace
+
#endif
#include "Support/GraphTraits.h"
#include "Support/STLExtras.h"
#include "llvm/Pass.h"
+
+namespace llvm {
+
class Function;
class Module;
class CallGraphNode;
static IncludeFile
CALLGRAPH_INCLUDE_FILE((void*)&CallGraph::stub);
+} // End llvm namespace
+
#endif
#include "llvm/Support/InstIterator.h"
#include "llvm/Instruction.h"
#include "Support/iterator"
+
+namespace llvm {
+
class Constant;
class constant_iterator : public forward_iterator<const Constant, ptrdiff_t> {
return constant_iterator(F, true);
}
+} // End llvm namespace
+
#endif
#define LLVM_ANALYSIS_DSGRAPH_H
#include "llvm/Analysis/DSNode.h"
+
+namespace llvm {
+
class GlobalValue;
//===----------------------------------------------------------------------===//
void removeTriviallyDeadNodes();
};
+} // End llvm namespace
+
#endif
#include "Support/iterator"
#include "Support/STLExtras.h"
+namespace llvm {
+
template<typename NodeTy>
class DSNodeIterator : public forward_iterator<const DSNode, ptrdiff_t> {
friend class DSNode;
static ChildIteratorType child_end(const NodeType *N) { return N->end(); }
};
+} // End llvm namespace
+
#endif
#include "llvm/Analysis/DSSupport.h"
+namespace llvm {
+
template<typename BaseType>
class DSNodeIterator; // Data structure graph traversal iterator
class TargetData;
*this = Node;
}
+} // End llvm namespace
+
#endif
#include "Support/hash_set"
#include "llvm/Support/CallSite.h"
+namespace llvm {
+
class Function;
class CallInst;
class Value;
DSNode *HandleForwarding() const;
};
+} // End llvm namespace
+
namespace std {
- inline void swap(DSNodeHandle &NH1, DSNodeHandle &NH2) { NH1.swap(NH2); }
+ inline void swap(llvm::DSNodeHandle &NH1, llvm::DSNodeHandle &NH2) { NH1.swap(NH2); }
}
+namespace llvm {
+
//===----------------------------------------------------------------------===//
/// DSCallSite - Representation of a call site via its call instruction,
/// the DSNode handle for the callee function (or function pointer), and
}
};
+} // End llvm namespace
+
namespace std {
- inline void swap(DSCallSite &CS1, DSCallSite &CS2) { CS1.swap(CS2); }
+ inline void swap(llvm::DSCallSite &CS1, llvm::DSCallSite &CS2) { CS1.swap(CS2); }
}
#endif
#include "llvm/Target/TargetData.h"
#include "Support/hash_set"
+namespace llvm {
+
class Type;
class Instruction;
class DSGraph;
const BUDataStructures::ActualCalleesTy &ActualCallees);
};
+} // End llvm namespace
+
#endif
#define LLVM_ANALYSIS_DSGRAPH_H
#include "llvm/Analysis/DSNode.h"
+
+namespace llvm {
+
class GlobalValue;
//===----------------------------------------------------------------------===//
void removeTriviallyDeadNodes();
};
+} // End llvm namespace
+
#endif
#include "Support/iterator"
#include "Support/STLExtras.h"
+namespace llvm {
+
template<typename NodeTy>
class DSNodeIterator : public forward_iterator<const DSNode, ptrdiff_t> {
friend class DSNode;
static ChildIteratorType child_end(const NodeType *N) { return N->end(); }
};
+} // End llvm namespace
+
#endif
#include "llvm/Analysis/DSSupport.h"
+namespace llvm {
+
template<typename BaseType>
class DSNodeIterator; // Data structure graph traversal iterator
class TargetData;
*this = Node;
}
+} // End llvm namespace
+
#endif
#include "Support/hash_set"
#include "llvm/Support/CallSite.h"
+namespace llvm {
+
class Function;
class CallInst;
class Value;
DSNode *HandleForwarding() const;
};
+} // End llvm namespace
+
namespace std {
- inline void swap(DSNodeHandle &NH1, DSNodeHandle &NH2) { NH1.swap(NH2); }
+ inline void swap(llvm::DSNodeHandle &NH1, llvm::DSNodeHandle &NH2) { NH1.swap(NH2); }
}
+namespace llvm {
+
//===----------------------------------------------------------------------===//
/// DSCallSite - Representation of a call site via its call instruction,
/// the DSNode handle for the callee function (or function pointer), and
}
};
+} // End llvm namespace
+
namespace std {
- inline void swap(DSCallSite &CS1, DSCallSite &CS2) { CS1.swap(CS2); }
+ inline void swap(llvm::DSCallSite &CS1, llvm::DSCallSite &CS2) { CS1.swap(CS2); }
}
#endif
#include "llvm/Target/TargetData.h"
#include "Support/hash_set"
+namespace llvm {
+
class Type;
class Instruction;
class DSGraph;
const BUDataStructures::ActualCalleesTy &ActualCallees);
};
+} // End llvm namespace
+
#endif
#include <utility>
#include <cassert>
+namespace llvm {
+
class Instruction;
class Function;
class Dependence;
//===----------------------------------------------------------------------===//
+} // End llvm namespace
+
#endif
#include "llvm/Pass.h"
#include <set>
+namespace llvm {
+
class Instruction;
template <typename GraphType> struct GraphTraits;
const DominatorTree::Node *Node);
};
+} // End llvm namespace
+
#endif
#ifndef LLVM_ANALYSIS_EXPRESSIONS_H
#define LLVM_ANALYSIS_EXPRESSIONS_H
+namespace llvm {
+
class Type;
class Value;
class ConstantInt;
const Type *getExprType(const Type *Default) const;
};
+} // End llvm namespace
+
#endif
#include "llvm/Pass.h"
#include <set>
+namespace llvm {
+
class PointerType;
struct FindUnsafePointerTypes : public Pass {
}
};
+} // End llvm namespace
+
#endif
#include "llvm/Pass.h"
#include <set>
+
+namespace llvm {
+
class Type;
class FindUsedTypes : public Pass {
static IncludeFile
FIND_USED_TYPES_INCLUDE_FILE((void*)&FindUsedTypes::stub);
+} // End llvm namespace
+
#endif
#include "Support/BitSetVector.h"
#include "Support/hash_map"
+namespace llvm {
+
class Module;
class Function;
class CallSite;
//===----------------------------------------------------------------------===//
+} // End llvm namespace
+
#endif
#define LLVM_ANALYSIS_INDUCTIONVARIABLE_H
#include <iosfwd>
+
+namespace llvm {
+
class Value;
class PHINode;
class Instruction;
void print(std::ostream &OS) const;
};
+} // End llvm namespace
+
#endif
#include "Support/Tree.h"
#include <map>
+namespace llvm {
+
template<class Payload> class InstTreeNode;
template<class Payload> class InstForest;
getTreeData().first.second = InstructionNode;
}
+} // End llvm namespace
+
#endif
#include <vector>
#include <iosfwd>
+namespace llvm {
+
class BasicBlock;
//===----------------------------------------------------------------------===//
}
};
+} // End llvm namespace
+
#endif
#include <set>
#include <algorithm>
+namespace llvm {
+
// getNodeHeader - Given a source graph node and the source graph, return the
// BasicBlock that is the header node. This is the opposite of
// getSourceGraphNode.
return interval_part_interval_iterator();
}
+} // End llvm namespace
+
#endif
#include "llvm/Analysis/Interval.h"
#include "llvm/Pass.h"
+namespace llvm {
+
//===----------------------------------------------------------------------===//
//
// IntervalPartition - This class builds and holds an "interval partition" for
void updatePredecessors(Interval *Int);
};
+} // End llvm namespace
+
#endif
#ifndef LLVM_ANALYSIS_LOAD_VALUE_NUMBERING_H
#define LLVM_ANALYSIS_LOAD_VALUE_NUMBERING_H
+namespace llvm {
+
class Pass;
/// createLoadValueNumberingPass - Create and return a new pass that implements
///
Pass *createLoadValueNumberingPass();
+} // End llvm namespace
+
#endif
#include "Support/GraphTraits.h"
#include <set>
+namespace llvm {
+
class DominatorSet;
class LoopInfo;
}
};
+} // End llvm namespace
+
#endif
#include "llvm/Pass.h"
#include "Support/hash_map"
+namespace llvm {
+
class ModRefTable;
class DSGraph;
class FunctionModRefInfo;
void dump() const;
};
+} // End llvm namespace
+
#endif
#include "llvm/Pass.h"
#include "Support/iterator"
+namespace llvm {
+
class DSGraph;
class DependenceGraph;
class PgmDependenceGraph;
void dump() const;
};
-
//===----------------------------------------------------------------------===//
+} // End llvm namespace
+
#endif
#include "llvm/Analysis/Dominators.h"
+namespace llvm {
+
/// PostDominatorSet Class - Concrete subclass of DominatorSetBase that is used
/// to compute the post-dominator set. Because there can be multiple exit nodes
static IncludeFile
POST_DOMINATOR_INCLUDE_FILE((void*)&PostDominanceFrontier::stub);
+} // End llvm namespace
+
#endif
#include <vector>
#include <map>
+
+namespace llvm {
+
class Value;
class Module;
class Function;
void processSymbolTableConstants(const SymbolTable *ST);
};
+} // End llvm namespace
+
#endif
#define LLVM_ANALYSIS_VALUE_NUMBERING_H
#include <vector>
+
+namespace llvm {
+
class Value;
struct ValueNumbering {
virtual ~ValueNumbering(); // We want to be subclassed
};
+} // End llvm namespace
+
#endif
#ifndef LLVM_ANALYSIS_VERIFIER_H
#define LLVM_ANALYSIS_VERIFIER_H
+namespace llvm {
+
class FunctionPass;
class Module;
class Function;
// pass.
bool verifyFunction(const Function &F);
+} // End llvm namespace
+
#endif
#include "llvm/Value.h"
+namespace llvm {
+
class Argument : public Value { // Defined in the Function.cpp file
Function *Parent;
}
};
+} // End llvm namespace
+
#endif
#define LLVM_ASSEMBLY_ASMANNOTATIONWRITER_H
#include <iosfwd>
+
+namespace llvm {
+
class Function;
class BasicBlock;
class Instruction;
virtual void emitInstructionAnnot(const Instruction *I, std::ostream &OS) {}
};
+} // End llvm namespace
+
#endif
#define LLVM_ASSEMBLY_CWRITER_H
#include <iosfwd>
+
+namespace llvm {
+
class Pass;
Pass *createWriteToCPass(std::ostream &o);
+} // End llvm namespace
+
#endif
#include "llvm/Value.h"
#include <iostream>
+namespace llvm {
+
class Module;
class PointerType;
class SlotCalculator;
}
};
+} // End llvm namespace
+
#endif
#include <string>
+namespace llvm {
+
class Module;
class ParseException;
ParseException &operator=(const ParseException &E); // objects by reference
};
+} // End llvm namespace
+
#endif
#include "llvm/Pass.h"
#include "llvm/Module.h"
+namespace llvm {
+
class PrintModulePass : public Pass {
std::ostream *Out; // ostream to print on
bool DeleteStream; // Delete the ostream in our dtor?
}
};
+} // End llvm namespace
+
#endif
#define LLVM_ASSEMBLY_WRITER_H
#include <iosfwd>
+
+namespace llvm {
+
class Type;
class Module;
class Value;
std::ostream &WriteAsOperand(std::ostream &, const Value *, bool PrintTy = true,
bool PrintName = true, const Module *Context = 0);
+} // End llvm namespace
+
#endif
#include "llvm/SymbolTableListTraits.h"
#include "Support/ilist"
+namespace llvm {
+
class TerminatorInst;
template <class _Term, class _BB> class SuccIterator; // Successor Iterator
template <class _Ptr, class _USE_iterator> class PredIterator;
BasicBlock *splitBasicBlock(iterator I, const std::string &BBName = "");
};
+} // End llvm namespace
+
#endif
#ifndef LLVM_BYTECODE_FORMAT_H
#define LLVM_BYTECODE_FORMAT_H
+namespace llvm {
+
class BytecodeFormat { // Throw the constants into a poorman's namespace...
BytecodeFormat(); // do not implement
public:
BasicBlock = 0x31, // May contain many basic blocks
};
};
+
+} // End llvm namespace
+
#endif
#include <string>
#include <deque>
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// Reading Primitives
//===----------------------------------------------------------------------===//
if (Align) align32(Out);
}
+} // End llvm namespace
+
#endif
#include <string>
#include <vector>
+namespace llvm {
+
/// getBytecodeModuleProvider - lazy function-at-a-time loading from a file
///
ModuleProvider *getBytecodeModuleProvider(const std::string &Filename);
std::vector<Module*> &Objects,
std::string *ErrorStr = 0);
+} // End llvm namespace
+
#endif
#include "llvm/Bytecode/Writer.h"
#include <iostream>
+namespace llvm {
+
class WriteBytecodePass : public Pass {
std::ostream *Out; // ostream to print on
bool DeleteStream;
}
};
+} // End llvm namespace
+
#endif
#include <iosfwd>
+namespace llvm {
+
class Module;
void WriteBytecodeToFile(const Module *C, std::ostream &Out);
+} // End llvm namespace
+
#endif
#include "llvm/Pass.h"
+namespace llvm {
+
class CallGraphNode;
struct CallGraphSCCPass : public Pass {
virtual void getAnalysisUsage(AnalysisUsage &Info) const;
};
+} // End llvm namespace
+
#endif
#include "llvm/Pass.h"
#include "llvm/CodeGen/ValueSet.h"
+namespace llvm {
+
class BBLiveVar;
class MachineInstr;
const BasicBlock *BB = 0);
};
+} // End llvm namespace
+
#endif
#include "llvm/Instruction.h"
#include "Support/hash_map"
+namespace llvm {
+
class Constant;
class Function;
class InstrTreeNode;
class InstrForest;
+} // End llvm namespace
+
+using namespace llvm;
+
//--------------------------------------------------------------------------
// OpLabel values for special-case nodes created for instruction selection.
// All op-labels not defined here are identical to the instruction
// opcode returned by Instruction::getOpcode()
//--------------------------------------------------------------------------
+//
+
const int InvalidOp = -1;
const int VRegListOp = 97;
extern int treecost (InstrTreeNode*, int, int);
extern void printMatches (InstrTreeNode*);
+namespace llvm {
//------------------------------------------------------------------------
// class InstrTreeNode
InstructionNode* buildTreeForInstruction(Instruction* instr);
};
+} // End llvm namespace
+
#endif
#ifndef LLVM_CODEGEN_INSTR_SCHEDULING_H
#define LLVM_CODEGEN_INSTR_SCHEDULING_H
+namespace llvm {
+
class FunctionPass;
class TargetMachine;
FunctionPass *createInstructionSchedulingWithSSAPass(const TargetMachine &TM);
+} // End llvm namespace
+
#endif
#include "llvm/Instruction.h"
+namespace llvm {
+
class Function;
class InstrForest;
class MachineInstr;
}
};
+} // End llvm namespace
+
#endif
#include "llvm/CodeGen/MachineInstr.h"
#include "Support/DataTypes.h"
+
+namespace llvm {
+
class InstructionNode;
class TargetMachine;
class Instruction;
unsigned& getMachineRegNum,
int64_t& getImmedValue);
+} // End llvm namespace
+
#endif
#include "llvm/CodeGen/MachineFunctionPass.h"
#include <map>
+namespace llvm {
+
class MRegisterInfo;
class LiveVariables : public MachineFunctionPass {
void HandlePhysRegDef(unsigned Reg, MachineInstr *MI);
};
+} // End llvm namespace
+
#endif
#define LLVM_CODEGEN_MACHINEBASICBLOCK_H
#include <vector>
+
+namespace llvm {
+
class BasicBlock;
class MachineInstr;
template <typename T> struct ilist_traits;
void setNext(MachineBasicBlock *N) { Next = N; }
};
+} // End llvm namespace
#endif
#include <string>
#include "Support/DataTypes.h"
+
+namespace llvm {
+
class MachineFunction;
class MachineBasicBlock;
class MachineConstantPool;
static MachineCodeEmitter *createFilePrinterEmitter(MachineCodeEmitter&);
};
+} // End llvm namespace
+
#endif
#include "Support/Annotation.h"
#include <vector>
+namespace llvm {
+
class MachineInstr;
class Instruction;
class Value;
CallArgsDescriptor* getCallArgsDescriptor() const { return callArgsDesc; }
};
+} // End llvm namespace
+
#endif
#define LLVM_CODEGEN_MACHINECONSTANTPOOL_H
#include <vector>
+
+namespace llvm {
+
class Constant;
class MachineConstantPool {
void dump() const;
};
+} // End llvm namespace
+
#endif
#ifndef LLVM_CODEGEN_MACHINEFRAMEINFO_H
#define LLVM_CODEGEN_MACHINEFRAMEINFO_H
+namespace llvm {
+
class TargetData;
class TargetRegisterClass;
class Type;
class MachineFunction;
+
+}
+
#include <vector>
+namespace llvm {
+
class MachineFrameInfo {
// StackObject - Represent a single object allocated on the stack.
void dump(const MachineFunction &MF) const;
};
+} // End llvm namespace
+
#endif
#include "Support/Annotation.h"
#include "Support/ilist"
+namespace llvm {
+
class Function;
class TargetMachine;
class FunctionPass;
MachineBasicBlock & back() { return BasicBlocks.back(); }
};
+} // End llvm namespace
+
#endif
#include "Support/HashExtras.h"
#include "Support/hash_set"
+
+namespace llvm {
+
class MachineFunction;
class Value;
class Constant;
int allocateOptionalArg(const Type* type);
};
+} // End llvm namespace
+
#endif
#include "llvm/Pass.h"
#include "llvm/CodeGen/MachineFunction.h"
+namespace llvm {
+
struct MachineFunctionPass : public FunctionPass {
/// runOnMachineFunction - This method must be overloaded to perform the
}
};
+} // End llvm namespace
+
#endif
#include "Support/Annotation.h"
#include "Support/iterator"
+namespace llvm {
+
class Value;
class Function;
class MachineBasicBlock;
std::ostream& operator<<(std::ostream &OS, const MachineOperand &MO);
void PrintMachineInstructions(const Function *F);
+} // End llvm namespace
+
#endif
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/Target/TargetRegInfo.h"
+namespace llvm {
+
class Value;
class TmpInstruction;
class CallInst;
static CallArgsDescriptor *get(const MachineInstr* MI);
};
+} // End llvm namespace
#endif
#include "llvm/CodeGen/MachineInstr.h"
+namespace llvm {
+
class MachineInstrBuilder {
MachineInstr *MI;
public:
MOTy::Def);
}
+} // End llvm namespace
+
#endif
#ifndef LLVM_CODEGEN_PASSES_H
#define LLVM_CODEGEN_PASSES_H
+namespace llvm {
+
class FunctionPass;
class PassInfo;
class TargetMachine;
/// for the Sparc.
FunctionPass *getRegisterAllocator(TargetMachine &T);
+} // End llvm namespace
+
#endif
#include "llvm/Target/MRegisterInfo.h"
+namespace llvm {
+
class TargetRegisterClass;
class SSARegMap {
}
};
+} // End llvm namespace
+
#endif
#include "llvm/Value.h"
#include <vector>
+namespace llvm {
+
class SchedGraphEdge;
class SchedGraphNode;
~SchedGraphCommon();
};
+} // End llvm namespace
+
#endif
#include <map>
#include <vector>
#include <cassert>
+
+namespace llvm {
+
class Value;
class Type;
class Instruction;
typedef ReducedValue<float , ISD::Constant_f32_Slot> ReducedValue_Constant_f32;
typedef ReducedValue<double , ISD::Constant_f64_Slot> ReducedValue_Constant_f64;
+} // End llvm namespace
+
#endif
#define VALUE_SET_H
#include <set>
+
+namespace llvm {
+
class Value;
// RAV - Used to print values in a form used by the register allocator.
typedef std::set<const Value*> ValueSet;
void printSet(const ValueSet &S);
+} // End llvm namespace
+
#endif
#ifndef LLVM_CODEGEN_VALUETYPES_H
#define LLVM_CODEGEN_VALUETYPES_H
+namespace llvm {
+
/// MVT namespace - This namespace defines the ValueType enum, which contains
/// the various low-level value types.
///
};
};
-#endif
+} // End llvm namespace
+#endif
#include "llvm/User.h"
+namespace llvm {
+
class Constant : public User {
protected:
inline Constant(const Type *Ty) : User(Ty, Value::ConstantVal) {}
// END WARNING!!
};
+} // End llvm namespace
+
#endif
#include "llvm/Constants.h"
#include "llvm/Type.h"
+
+namespace llvm {
+
class PointerType;
//===----------------------------------------------------------------------===//
const Constant *V2);
Constant *ConstantFoldGetElementPtr(const Constant *C,
const std::vector<Constant*> &IdxList);
+
+} // End llvm namespace
+
#endif
#include "llvm/Constant.h"
#include "Support/DataTypes.h"
+namespace llvm {
+
class ArrayType;
class StructType;
class PointerType;
}
};
+} // End llvm namespace
+
#endif
#include "llvm/Type.h"
#include <vector>
+namespace llvm {
+
template<class ValType, class TypeClass> class TypeMap;
class FunctionValType;
class ArrayValType;
return *const_cast<PATypeHolder*>(this) = NewTy;
}
+} // End llvm namespace
+
#endif
#include <string>
#include <map>
#include <cassert>
+
+namespace llvm {
+
class Constant;
class Function;
union GenericValue;
GenericValue LoadValueFromMemory(GenericValue *Ptr, const Type *Ty);
};
+} // End llvm namespace
+
#endif
#include "Support/DataTypes.h"
+namespace llvm {
+
typedef uint64_t PointerTy;
union GenericValue {
inline void* GVTOP(const GenericValue &GV) {
return (void*)(intptr_t)GV.PointerVal;
}
+
+} // End llvm namespace
#endif
#include "llvm/BasicBlock.h"
#include "llvm/Argument.h"
+namespace llvm {
+
class FunctionType;
// Traits for intrusive list of instructions...
virtual bool isExternal() const { return BasicBlocks.empty(); }
/// getIntrinsicID - This method returns the ID number of the specified
- /// function, or LLVMIntrinsic::not_intrinsic if the function is not an
+ /// function, or Intrinsic::not_intrinsic if the function is not an
/// instrinsic, or if the pointer is null. This value is always defined to be
/// zero to allow easy checking for whether a function is intrinsic or not.
/// The particular intrinsic functions which correspond to this value are
void dropAllReferences();
};
+} // End llvm namespace
+
#endif
#define LLVM_GLOBALVALUE_H
#include "llvm/User.h"
+
+namespace llvm {
+
class PointerType;
class Module;
}
};
+} // End llvm namespace
+
#endif
#include "llvm/GlobalValue.h"
+namespace llvm {
+
class Module;
class Constant;
class PointerType;
}
};
+} // End llvm namespace
+
#endif
#include "llvm/Instruction.h"
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// TerminatorInst Class
//===----------------------------------------------------------------------===//
}
};
+} // End llvm namespace
+
#endif
// NOTE: NO INCLUDE GUARD DESIRED!
-// Provide definitions of macros so that users of this file don't have to define
+// Provide definitions of macros so that users of this file do not have to define
// everything to use it...
//
#ifndef FIRST_TERM_INST
#include "llvm/User.h"
+namespace llvm {
+
class AssemblyAnnotationWriter;
template<typename SC> struct ilist_traits;
};
};
+} // End llvm namespace
+
#endif
#ifndef LLVM_INTRINSICS_H
#define LLVM_INTRINSICS_H
-/// LLVMIntrinsic Namespace - This namespace contains an enum with a value for
+namespace llvm {
+
+/// Intrinsic Namespace - This namespace contains an enum with a value for
/// every intrinsic/builtin function known by LLVM. These enum values are
/// returned by Function::getIntrinsicID().
///
-namespace LLVMIntrinsic {
+namespace Intrinsic {
enum ID {
not_intrinsic = 0, // Must be zero
// second parameter, the possible values for which are
// defined in the AlphaSfpToSq enumeration
};
-}
+
+} // End Intrinsic namespace
+
+} // End llvm namespace
#endif
#define LLVM_TRANSFORMATIONS_UTILS_LINKER_H
#include <string>
+
+namespace llvm {
+
class Module;
// LinkModules - This function links two modules together, with the resulting
//
bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg = 0);
+} // End llvm namespace
+
#endif
#include "llvm/Function.h"
#include "llvm/GlobalVariable.h"
+
+namespace llvm {
+
class GlobalVariable;
class GlobalValueRefMap; // Used by ConstantVals.cpp
class ConstantPointerRef;
return O;
}
+} // End llvm namespace
+
#endif
#ifndef MODULEPROVIDER_H
#define MODULEPROVIDER_H
+namespace llvm {
+
class Function;
class Module;
}
};
+} // End llvm namespace
+
#endif
#include <iosfwd>
#include <typeinfo>
#include <cassert>
+
+namespace llvm {
+
class Value;
class BasicBlock;
class Function;
virtual void addToPassManager(PassManagerT<BasicBlock> *PM,AnalysisUsage &AU);
};
+} // End llvm namespace
+
// Include support files that contain important APIs commonly used by Passes,
// but that we want to separate out to make it easier to read the header files.
//
#ifndef LLVM_PASS_ANALYSIS_SUPPORT_H
#define LLVM_PASS_ANALYSIS_SUPPORT_H
+namespace llvm {
+
// No need to include Pass.h, we are being included by it!
//===----------------------------------------------------------------------===//
return dynamic_cast<AnalysisType*>(Resolver->getAnalysisToUpdate(PI));
}
+} // End llvm namespace
+
#endif
#ifndef LLVM_PASSMANAGER_H
#define LLVM_PASSMANAGER_H
+namespace llvm {
+
class Pass;
class Module;
class ModuleProvider;
bool run(Function &F);
};
+} // End llvm namespace
+
#endif
// No need to include Pass.h, we are being included by it!
+namespace llvm {
+
class TargetMachine;
//===---------------------------------------------------------------------------
struct IncludeFile {
IncludeFile(void *);
};
+
+} // End llvm namespace
+
#endif
#include <vector>
#include <map>
+
+namespace llvm {
+
class Value;
class Module;
class Function;
void processSymbolTableConstants(const SymbolTable *ST);
};
+} // End llvm namespace
+
#endif
#include <string>
#include <cassert>
+namespace llvm {
+
class AnnotationID;
class Annotation;
class Annotable;
return A;
}
+} // End namespace llvm
+
#endif
#include "llvm/InstrTypes.h"
#include "Support/iterator"
+namespace llvm {
+
//===--------------------------------------------------------------------===//
// BasicBlock pred_iterator definition
//===--------------------------------------------------------------------===//
}
};
+} // End llvm namespace
+
#endif
#include "llvm/Instruction.h"
+namespace llvm {
+
class CallInst;
class InvokeInst;
}
};
+} // End llvm namespace
+
#endif
#ifndef SUPPORT_CASTING_H
#define SUPPORT_CASTING_H
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// isa<x> Support Templates
//===----------------------------------------------------------------------===//
#endif
+} // End llvm namespace
+
#endif
#include <cassert>
#include "boost/type_traits/object_traits.hpp"
+namespace llvm {
/// cl Namespace - This namespace contains all of the command line option
/// processing machinery. It is intentionally a short name to make qualified
/// usage concise.
} // End namespace cl
+} // End namespace llvm
+
#endif
#include "Support/DataTypes.h"
#include <iosfwd>
+
+namespace llvm {
+
class ConstantIntegral;
class Type;
return OS;
}
+} // End llvm namespace
+
#endif
#include <string>
+namespace llvm {
+
/// DefaultDOTGraphTraits - This class provides the default implementations of
/// all of the DOTGraphTraits methods. If a specialization does not need to
/// override all methods here it should inherit so that it can get the default
template <typename Ty>
class DOTGraphTraits : public DefaultDOTGraphTraits {};
+} // End llvm namespace
+
#endif
#ifndef SUPPORT_DEBUG_H
#define SUPPORT_DEBUG_H
+namespace llvm {
+
// DebugFlag - This boolean is set to true if the '-debug' command line option
// is specified. This should probably not be referenced directly, instead, use
// the DEBUG macro below.
do { if (DebugFlag && isCurrentDebugType(DEBUG_TYPE)) { X; } } while (0)
#endif
+} // End llvm namespace
+
#endif
#include <string>
+namespace llvm {
+
/// LinkDynamicObject - Load the named file as a dynamic library
/// and link it with the currently running process. Returns false
/// on success, true if there is an error (and sets ErrorMessage
void *GetAddressOfSymbol (const char *symbolName);
void *GetAddressOfSymbol (const std::string &symbolName);
+} // End llvm namespace
+
#endif // SUPPORT_DYNAMICLINKER_H
#include <string>
+namespace llvm {
+
/// CheckMagic - Returns true IFF the file named FN begins with Magic. FN must
/// name a readable file.
///
///
bool MakeFileReadable (const std::string & Filename);
+} // End llvm namespace
+
#endif
#include <vector>
#include <iostream>
+namespace llvm {
+
namespace DOT { // Private functions...
inline std::string EscapeString(const std::string &Label) {
std::string Str(Label);
return O;
}
+} // End llvm namespace
+
#endif
#include "llvm/BasicBlock.h"
#include "llvm/Function.h"
+namespace llvm {
+
// This class implements inst_begin() & inst_end() for
// inst_iterator and const_inst_iterator's.
//
return const_inst_iterator(F, true);
}
+} // End llvm namespace
+
#endif
#include "llvm/Instruction.h"
+namespace llvm {
+
class Module;
// We operate on opaque instruction classes, so forward declare all instruction
class TerminatorInst; class BinaryOperator;
class AllocationInst;
-
#define DELEGATE(CLASS_TO_VISIT) \
return ((SubClass*)this)->visit##CLASS_TO_VISIT((CLASS_TO_VISIT&)I)
#undef DELEGATE
+} // End llvm namespace
+
#endif
#define SUPPORT_LEAKDETECTOR_H
#include <string>
+
+namespace llvm {
+
class Value;
struct LeakDetector {
static void checkForGarbageImpl(const std::string &Message);
};
+} // End llvm namespace
+
#endif
#define LLVM_TRANSFORMATIONS_UTILS_LINKER_H
#include <string>
+
+namespace llvm {
+
class Module;
// LinkModules - This function links two modules together, with the resulting
//
bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg = 0);
+} // End llvm namespace
+
#endif
#include <cstdlib>
#include <memory>
+namespace llvm {
+
template<typename T>
struct MallocAllocator {
typedef size_t size_type;
};
}
+} // End llvm namespace
#endif
#ifndef LLVM_SUPPORT_MANGLER_H
#define LLVM_SUPPORT_MANGLER_H
+namespace llvm {
+
class Value;
class Module;
+
+} // End llvm namespace
+
#include <map>
#include <set>
#include <string>
+namespace llvm {
+
class Mangler {
/// This keeps track of which global values have had their names
/// mangled in the current module.
static std::string makeNameProper(const std::string &x);
};
+} // End llvm namespace
+
#endif // LLVM_SUPPORT_MANGLER_H
#include "Support/DataTypes.h"
+namespace llvm {
+
inline unsigned log2(uint64_t C) {
unsigned getPow;
for (getPow = 0; C > 1; ++getPow)
return false;
}
+} // End llvm namespace
+
#endif
#include <algorithm>
#include <iostream>
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// PassNameParser class - Make use of the pass registration mechanism to
// automatically add a command line argument to opt for each pass.
}
};
+} // End llvm namespace
+
#endif
#include <string>
+namespace llvm {
+
/// isExecutableFile - This function returns true if the filename specified
/// exists and is executable.
///
/// wait for it to terminate.
///
int ExecWait (const char * const argv[], const char * const envp[]);
+
+} // End llvm namespace
+
#endif
#include <iosfwd>
#include <cassert>
+namespace llvm {
+
class TimerGroup;
/// Timer - This class is used to track the amount of time spent between
}
};
+} // End llvm namespace
+
#endif
#include "Support/SystemUtils.h"
#include <vector>
+namespace llvm {
+
class CBE;
class LLC;
int OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile);
};
+} // End llvm namespace
+
#endif
#include <typeinfo>
+namespace llvm {
+
struct TypeInfo {
TypeInfo() { // needed for containers
struct Nil {}; // Anonymous class distinct from all others...
return !(lhs < rhs);
}
+} // End llvm namespace
+
#endif
#include "llvm/User.h"
+namespace llvm {
+
struct ValueHolder : public User {
ValueHolder(Value *V = 0);
ValueHolder(const ValueHolder &VH) : User(VH.getType(), Value::TypeVal) {
}
};
+} // End llvm namespace
+
#endif
#include "llvm/Value.h"
#include <map>
+namespace llvm {
+
class SymbolTable : public AbstractTypeUser,
public std::map<const Type *,
std::map<const std::string, Value *> > {
virtual void typeBecameConcrete(const DerivedType *AbsTy);
};
+} // End llvm namespace
+
#endif
#ifndef LLVM_SYMBOLTABLELISTTRAITS_H
#define LLVM_SYMBOLTABLELISTTRAITS_H
+namespace llvm {
+
template<typename NodeTy> class ilist_iterator;
template<typename NodeTy, typename Traits> class iplist;
template<typename Ty> struct ilist_traits;
void setParent(SymTabClass *Parent); // This is private!
};
+} // End llvm namespace
+
#endif
#include <string>
+namespace llvm {
+
// RemoveFileOnSignal - This function registers signal handlers to ensure that
// if a signal gets delivered that the named file is removed.
//
void RemoveFileOnSignal(const std::string &Filename);
-#endif
+} // End llvm namespace
+#endif
#include "llvm/CodeGen/MachineBasicBlock.h"
#include <cassert>
+namespace llvm {
+
class Type;
class MachineFunction;
MachineBasicBlock &MBB) const = 0;
};
+} // End llvm namespace
+
#endif
#include "Support/DataTypes.h"
+namespace llvm {
+
class TargetMachine;
struct TargetCacheInfo {
}
};
+} // End llvm namespace
+
#endif
#include "Support/Annotation.h"
#include "Support/DataTypes.h"
#include <vector>
+
+namespace llvm {
+
class Value;
class Type;
class StructType;
inline StructLayout(const StructType *ST, const TargetData &TD);
};
+} // End llvm namespace
+
#endif
#ifndef LLVM_TARGET_TARGETFRAMEINFO_H
#define LLVM_TARGET_TARGETFRAMEINFO_H
+namespace llvm {
+
class MachineFunction;
struct TargetFrameInfo {
virtual int getDynamicAreaBaseRegNum() const { abort(); }
};
+} // End llvm namespace
+
#endif
#include <vector>
#include <cassert>
+namespace llvm {
+
class MachineInstr;
class TargetMachine;
class Value;
}
};
+} // End llvm namespace
+
#endif
#include "llvm/Target/TargetData.h"
#include <cassert>
+namespace llvm {
+
class TargetInstrInfo;
class TargetInstrDescriptor;
class TargetSchedInfo;
}
};
+} // End llvm namespace
+
#endif
#ifndef LLVM_TARGET_TARGETMACHINEIMPLS_H
#define LLVM_TARGET_TARGETMACHINEIMPLS_H
+namespace llvm {
+
class TargetMachine;
class Module;
//
TargetMachine *allocateX86TargetMachine(const Module &M);
+} // End llvm namespace
+
#endif
#include <string>
#include <cassert>
+namespace llvm {
+
class TargetMachine;
class IGNode;
class Type;
virtual int getSpilledRegSize(int RegType) const = 0;
};
+} // End llvm namespace
+
#endif
#include "Support/hash_map"
#include <string>
+namespace llvm {
+
typedef long long cycles_t;
static const cycles_t HUGE_LATENCY = ~((long long) 1 << (sizeof(cycles_t)-2));
static const cycles_t INVALID_LATENCY = -HUGE_LATENCY;
OpCodePair(); // disable for now
};
+} // End llvm namespace
+
namespace HASH_NAMESPACE {
- template <> struct hash<OpCodePair> {
- size_t operator()(const OpCodePair& pair) const {
+ template <> struct hash<llvm::OpCodePair> {
+ size_t operator()(const llvm::OpCodePair& pair) const {
return hash<long>()(pair.val);
}
};
-}
+} // End HASH_NAMESPACE (a macro) namespace
+
+namespace llvm {
//---------------------------------------------------------------------------
// class MachineResource
};
+} // End llvm namespace
+
#endif
#ifndef LLVM_TRANSFORMS_IPO_H
#define LLVM_TRANSFORMS_IPO_H
+namespace llvm {
+
class Pass;
class Function;
Pass *createSwapElementsPass();
Pass *createSortElementsPass();
+} // End llvm namespace
+
#endif
#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_H
#define LLVM_TRANSFORMS_INSTRUMENTATION_H
+namespace llvm {
+
class Pass;
//===----------------------------------------------------------------------===//
Pass *createTraceValuesPassForFunction(); // Just trace function entry/exit
Pass *createTraceValuesPassForBasicBlocks(); // Trace BB's and methods
+} // End llvm namespace
+
#endif
#include "llvm/Pass.h"
#include "llvm/AbstractTypeUser.h"
+namespace llvm {
+
class Value;
class Type;
class StructType;
unsigned idx = 0);
};
+} // End llvm namespace
+
#endif
#ifndef LLVM_TRANSFORMS_SCALAR_H
#define LLVM_TRANSFORMS_SCALAR_H
+namespace llvm {
+
class Pass;
class FunctionPass;
class GetElementPtrInst;
Pass *createSymbolStrippingPass();
Pass *createFullSymbolStrippingPass();
+} // End llvm namespace
+
#endif
#include "llvm/BasicBlock.h"
#include "llvm/Support/CFG.h"
+
+namespace llvm {
+
class Instruction;
class Pass;
//
void RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum);
-
/// isCriticalEdge - Return true if the specified edge is a critical edge.
/// Critical edges are edges from a block with multiple successors to a block
/// with multiple predecessors.
return MadeChange;
}
+} // End llvm namespace
#endif
#include <vector>
#include <map>
+
+namespace llvm {
+
class Module;
class Function;
class BasicBlock;
/// no jump to it) and returns the new vector of basic blocks.
std::vector<BasicBlock *> CloneTrace(const std::vector<BasicBlock*> &origTrace);
+} // End llvm namespace
+
#endif
//
//===----------------------------------------------------------------------===//
+namespace llvm {
+
class Instruction;
class AllocaInst;
AllocaInst *DemoteRegToStack(Instruction &X);
+
+} // End llvm namespace
#define LLVM_TRANSFORMATIONS_UTILS_LINKER_H
#include <string>
+
+namespace llvm {
+
class Module;
// LinkModules - This function links two modules together, with the resulting
//
bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg = 0);
+} // End llvm namespace
+
#endif
#define LLVM_TRANSFORMS_UTILS_LOCAL_H
#include "llvm/Function.h"
+
+namespace llvm {
+
class Pass;
//===----------------------------------------------------------------------===//
///
bool SimplifyCFG(BasicBlock *BB);
+} // End llvm namespace
+
#endif
#ifndef TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
#define TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
+#include <vector>
+
+namespace llvm {
+
class AllocaInst;
class DominatorTree;
class DominanceFrontier;
class TargetData;
-#include <vector>
/// isAllocaPromotable - Return true if this alloca is legal for promotion.
/// This is true if there are only loads and stores to the alloca...
DominatorTree &DT, DominanceFrontier &DF,
const TargetData &TD);
+} // End llvm namespace
+
#endif
#include "llvm/Pass.h"
+namespace llvm {
+
struct UnifyFunctionExitNodes : public FunctionPass {
BasicBlock *ReturnBlock, *UnwindBlock;
public:
Pass *createUnifyFunctionExitNodesPass();
+} // End llvm namespace
+
#endif
// NOTE: NO INCLUDE GUARD DESIRED!
-// If the user didn't specify one of the macros, give a default noop defn.
+// If the user did not specify one of the macros, give a default noop defn.
//
#ifndef HANDLE_PRIM_TYPE
#define HANDLE_PRIM_TYPE(x,y)
#include "Support/GraphTraits.h"
#include "Support/iterator"
+namespace llvm {
+
class DerivedType;
class FunctionType;
class ArrayType;
return Ty.getPrimitiveID() == Type::PointerTyID;
}
+} // End llvm namespace
+
#endif
#define LLVM_USE_H
#include "Support/ilist"
+
+namespace llvm {
+
template<typename NodeTy> struct ilist_traits;
class Value;
class User;
};
-template<> struct simplify_type<Use> {
+template<> struct std::simplify_type<Use> {
typedef Value* SimpleType;
static SimpleType getSimplifiedValue(const Use &Val) {
return (SimpleType)Val.get();
}
};
-template<> struct simplify_type<const Use> {
+template<> struct std::simplify_type<const Use> {
typedef Value* SimpleType;
static SimpleType getSimplifiedValue(const Use &Val) {
return (SimpleType)Val.get();
}
};
+} // End llvm namespace
+
#endif
#include "llvm/Value.h"
#include <vector>
+namespace llvm {
+
class User : public Value {
User(const User &); // Do not implement
protected:
template<> struct simplify_type<const User::const_op_iterator>
: public simplify_type<User::const_op_iterator> {};
+} // End llvm namespace
+
#endif
#include "Support/Casting.h"
#include <iostream>
+namespace llvm {
+
class Type;
class Constant;
class Argument;
return isa<GlobalVariable>(Val) || isa<Function>(Val);
}
+} // End llvm namespace
+
#endif
#define LLVM_IMEMORY_H
#include "llvm/Instruction.h"
+
+namespace llvm {
+
class PointerType;
//===----------------------------------------------------------------------===//
}
};
+} // End llvm namespace
+
#endif // LLVM_IMEMORY_H
#include "llvm/InstrTypes.h"
+namespace llvm {
+
/// SetCondInst class - Represent a setCC operator, where CC is eq, ne, lt, gt,
/// le, or ge.
///
}
};
+} // End llvm namespace
+
#endif
#include "llvm/InstrTypes.h"
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// CastInst Class
//===----------------------------------------------------------------------===//
}
};
+} // End llvm namespace
+
#endif
#define LLVM_IPHINODE_H
#include "llvm/Instruction.h"
+
+namespace llvm {
+
class BasicBlock;
//===----------------------------------------------------------------------===//
}
};
+} // End llvm namespace
+
#endif
#include "llvm/InstrTypes.h"
+namespace llvm {
+
//===---------------------------------------------------------------------------
// ReturnInst - Return a value (possibly void), from a function. Execution does
// not continue in this function any longer.
}
};
+} // End llvm namespace
+
#endif
#include "llvm/iMemory.h"
#include "llvm/Target/TargetData.h"
+namespace llvm {
+
// Register the AliasAnalysis interface, providing a nice name to refer to.
namespace {
RegisterAnalysisGroup<AliasAnalysis> Z("Alias Analysis");
// Declare that we implement the AliasAnalysis interface
RegisterAnalysisGroup<AliasAnalysis, NoAA> Y;
} // End of anonymous namespace
+
+} // End llvm namespace
#include "llvm/Pass.h"
#include <iostream>
+namespace llvm {
+
namespace {
class AliasAnalysisCounter : public Pass, public AliasAnalysis {
unsigned No, May, Must;
X("count-aa", "Count Alias Analysis Query Responses");
RegisterAnalysisGroup<AliasAnalysis, AliasAnalysisCounter> Y;
}
+
+} // End llvm namespace
#include "Support/CommandLine.h"
#include <set>
+namespace llvm {
+
namespace {
cl::opt<bool> PrintNo ("print-no-aliases", cl::ReallyHidden);
cl::opt<bool> PrintMay ("print-may-aliases", cl::ReallyHidden);
<< May*100/Sum << "%/" << Must*100/Sum<<"%\n";
return false;
}
+
+} // End llvm namespace
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/InstIterator.h"
+namespace llvm {
+
/// mergeSetIn - Merge the specified alias set into this alias set...
///
void AliasSet::mergeSetIn(AliasSet &AS) {
void AliasSet::dump() const { print (std::cerr); }
void AliasSetTracker::dump() const { print(std::cerr); }
-
//===----------------------------------------------------------------------===//
// AliasSetPrinter Pass
//===----------------------------------------------------------------------===//
RegisterPass<AliasSetPrinter> X("print-alias-sets", "Alias Set Printer",
PassInfo::Analysis | PassInfo::Optimization);
}
+
+} // End llvm namespace
#include "llvm/DerivedTypes.h"
#include "llvm/Target/TargetData.h"
+namespace llvm {
+
// Make sure that anything that uses AliasAnalysis pulls in this file...
void BasicAAStub() {}
-
namespace {
struct BasicAliasAnalysis : public ImmutablePass, public AliasAnalysis {
InitializeAliasAnalysis(this);
}
-
-
// hasUniqueAddress - Return true if the specified value points to something
// with a unique, discernable, address.
static inline bool hasUniqueAddress(const Value *V) {
return MayAlias;
}
+} // End llvm namespace
#include <sstream>
#include <fstream>
+namespace llvm {
+
/// CFGOnly flag - This is used to control whether or not the CFG graph printer
/// prints out the contents of basic blocks or not. This is acceptable because
/// this code is only really used for debugging purposes.
"Print CFG of function to 'dot' file");
};
-
-
-
/// viewCFG - This function is meant for use from the debugger. You can just
/// say 'call F->viewCFG()' and a ghostview window should pop up from the
/// program, displaying the CFG of the current function. This depends on there
viewCFG();
CFGOnly = false;
}
+
+} // End llvm namespace
#include "llvm/Instruction.h"
#include "llvm/ConstantHandling.h"
+namespace llvm {
+
/// Initialize a full (the default) or empty set for the specified type.
///
ConstantRange::ConstantRange(const Type *Ty, bool Full) {
void ConstantRange::dump() const {
print(std::cerr);
}
+
+} // End llvm namespace
#include "Support/Debug.h"
#include "DSCallSiteIterator.h"
+namespace llvm {
+
namespace {
Statistic<> MaxSCC("budatastructure", "Maximum SCC Size in Call Graph");
Statistic<> NumBUInlines("budatastructures", "Number of graphs inlined");
//Graph.writeGraphToFile(std::cerr, "bu_" + F.getName());
}
+} // End llvm namespace
#include "llvm/Analysis/DSGraph.h"
#include "llvm/Function.h"
+namespace llvm {
+
struct DSCallSiteIterator {
// FCs are the edges out of the current node are the call site targets...
const std::vector<DSCallSite> *FCs;
}
};
+} // End llvm namespace
+
#endif
#include "Support/Timer.h"
#include <algorithm>
+namespace llvm {
+
namespace {
Statistic<> NumFolds ("dsnode", "Number of nodes completely folded");
Statistic<> NumCallNodesMerged("dsnode", "Number of call nodes merged");
return getSize() == 1 && Ty == Type::VoidTy && isArray();
}
-
namespace {
/// TypeElementWalker Class - Used for implementation of physical subtyping...
///
}
}
};
-}
+} // end anonymous namespace
/// ElementTypesAreCompatible - Check to see if the specified types are
/// "physically" compatible. If so, return true, else return false. We only
removeTriviallyDeadNodes();
}
+
/// computeNodeMapping - Given roots in two different DSGraphs, traverse the
/// nodes reachable from the two graphs, computing the mapping of nodes from
/// the first to the second graph.
computeNodeMapping(N1->getLink(i), N2->getLink(N2Idx+i), NodeMap);
}
+} // End llvm namespace
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Module.h"
+namespace llvm {
+
namespace {
class DSAA : public Pass, public AliasAnalysis {
TDDataStructures *TD;
#endif
return getAnalysis<AliasAnalysis>().getMustAliases(P, RetVals);
}
+
+} // End llvm namespace
#include "llvm/Constant.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<>
NumGlobalsConstanted("ds-opt", "Number of globals marked constant");
RegisterOpt<DSOpt> X("ds-opt", "DSA-based simple optimizations");
}
-
/// OptimizeGlobals - This method uses information taken from DSA to optimize
/// global variables.
///
}
return Changed;
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include <vector>
+namespace llvm {
+
namespace {
Statistic<> TotalNumCallees("totalcallees",
"Total number of callee functions at all indirect call sites");
visit(F);
return true;
}
+
+} // End llvm namespace
#include "llvm/Value.h"
#include <set>
+namespace llvm {
+
namespace {
enum DSPass { local, bu, td };
cl::opt<DSPass>
}
}
}
+
+} // End llvm namespace
#include "Support/StringExtras.h"
#include <vector>
+namespace llvm {
+
//----------------------------------------------------------------------------
// Private constants and data
//----------------------------------------------------------------------------
{
print(std::cerr);
}
+
+} // End llvm namespace
//
#include "llvm/Module.h"
+namespace llvm {
+
static RegisterAnalysis<LocalDataStructures>
X("datastructure", "Local Data Structure Analysis");
return false;
}
}
-using namespace DS;
+using namespace DS;
namespace {
cl::opt<bool>
};
}
+using namespace DS;
+
//===----------------------------------------------------------------------===//
// DSGraph constructor - Simply use the GraphBuilder to construct the local
// graph.
delete GlobalsGraph;
GlobalsGraph = 0;
}
+
+} // End llvm namespace
#include "Support/hash_map"
#include "Support/hash_set"
+namespace llvm {
///--------------------------------------------------------------------------
/// struct ModRefTable:
class ModRefInfoBuilder : public InstVisitor<ModRefInfoBuilder> {
const DSGraph& funcGraph;
const FunctionModRefInfo& funcModRef;
- ModRefTable& modRefTable;
+ struct ModRefTable& modRefTable;
ModRefInfoBuilder(); // DO NOT IMPLEMENT
ModRefInfoBuilder(const ModRefInfoBuilder&); // DO NOT IMPLEMENT
static RegisterAnalysis<MemoryDepAnalysis>
Z("memdep", "Memory Dependence Analysis");
+
+} // End llvm namespace
#include <functional>
#include <algorithm>
+namespace llvm {
+
//----------------------------------------------------------------------------
// Global constants used in marking Cilk functions and function calls.
//----------------------------------------------------------------------------
return true;
}
+
+} // End llvm namespace
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Function.h"
+namespace llvm {
//----------------------------------------------------------------------------
// class DepIterState
static RegisterAnalysis<PgmDependenceGraph>
Z("pgmdep", "Enumerate Program Dependence Graph (data and control)");
+
+} // End llvm namespace
#include <fstream>
#include <sstream>
+namespace llvm {
+
// OnlyPrintMain - The DataStructure printer exposes this option to allow
// printing of only the graph for "main".
//
Statistic<> NumFoldedNodes ("dsnode", "Number of folded nodes (in final graph)");
}
-
void DSNode::dump() const { print(std::cerr, 0); }
static std::string getCaption(const DSNode *N, const DSGraph *G) {
void TDDataStructures::print(std::ostream &O, const Module *M) const {
printCollection(*this, O, M, "td.");
}
+
+} // End llvm namespace
#include "llvm/Module.h"
#include "Support/Debug.h"
+namespace llvm {
+
namespace {
class Steens : public Pass, public AliasAnalysis {
DSGraph *ResultGraph;
RegisterAnalysisGroup<AliasAnalysis, Steens> Y;
}
-
/// ResolveFunctionCall - Resolve the actual arguments of a call to function F
/// with the specified call site descriptor. This function links the arguments
/// and the return value for the call site context-insensitively.
//
return getAnalysis<AliasAnalysis>().alias(V1, V1Size, V2, V2Size);
}
+
+} // End llvm namespace
#include "Support/Debug.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
RegisterAnalysis<TDDataStructures> // Register the pass
Y("tddatastructure", "Top-down Data Structure Analysis");
<< Graph.getFunctionCalls().size() << "]\n");
}
+} // End llvm namespace
#include "llvm/ConstantHandling.h"
#include "llvm/Function.h"
+namespace llvm {
+
ExprType::ExprType(Value *Val) {
if (Val)
if (ConstantInt *CPI = dyn_cast<ConstantInt>(Val)) {
// Otherwise, I don't know anything about this value!
return I;
}
+
+} // End llvm namespace
#include "llvm/Support/CallSite.h"
#include "Support/STLExtras.h"
+namespace llvm {
+
static RegisterAnalysis<CallGraph> X("callgraph", "Call Graph Construction");
static const char * const KnownExternalFunctions[] = {
}
void CallGraph::stub() {}
+
+} // End llvm namespace
#include "llvm/Analysis/CallGraph.h"
#include "Support/SCCIterator.h"
+namespace llvm {
+
/// getAnalysisUsage - For this class, we declare that we require and preserve
/// the call graph. If the derived class implements this method, it should
/// always explicitly call the implementation here.
Changed = runOnSCC(*I);
return Changed;
}
+
+} // End llvm namespace
#include "llvm/Analysis/DependenceGraph.h"
#include "llvm/Function.h"
+namespace llvm {
//----------------------------------------------------------------------------
// class Dependence:
if (const DepGraphNode* dgNode = this->getNode(*II))
dgNode->print(O);
}
+
+} // End llvm namespace
#include "llvm/Support/InstIterator.h"
#include "Support/CommandLine.h"
+namespace llvm {
+
static RegisterAnalysis<FindUnsafePointerTypes>
X("unsafepointertypes", "Find Unsafe Pointer Types");
CW << " #" << Counter << ". " << (Value*)*I << "\n";
}
}
+
+} // End llvm namespace
#include "llvm/Assembly/CachedWriter.h"
#include "llvm/Support/InstIterator.h"
+namespace llvm {
+
static RegisterAnalysis<FindUsedTypes>
X("printusedtypes", "Find Used Types");
E = UsedTypes.end(); I != E; ++I)
o << " " << *I << "\n";
}
+
+} // End llvm namespace
#include "Support/StringExtras.h"
#include <vector>
+namespace llvm {
+
//----------------------------------------------------------------------------
// Private constants and data
//----------------------------------------------------------------------------
{
print(std::cerr);
}
+
+} // End llvm namespace
#include "Support/hash_map"
#include "Support/hash_set"
+namespace llvm {
///--------------------------------------------------------------------------
/// struct ModRefTable:
class ModRefInfoBuilder : public InstVisitor<ModRefInfoBuilder> {
const DSGraph& funcGraph;
const FunctionModRefInfo& funcModRef;
- ModRefTable& modRefTable;
+ struct ModRefTable& modRefTable;
ModRefInfoBuilder(); // DO NOT IMPLEMENT
ModRefInfoBuilder(const ModRefInfoBuilder&); // DO NOT IMPLEMENT
static RegisterAnalysis<MemoryDepAnalysis>
Z("memdep", "Memory Dependence Analysis");
+
+} // End llvm namespace
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Function.h"
+namespace llvm {
//----------------------------------------------------------------------------
// class DepIterState
static RegisterAnalysis<PgmDependenceGraph>
Z("pgmdep", "Enumerate Program Dependence Graph (data and control)");
+
+} // End llvm namespace
#include "llvm/Support/CFG.h"
#include "Support/SCCIterator.h"
+namespace llvm {
+
namespace {
struct CFGSCC : public FunctionPass {
bool runOnFunction(Function& func);
return true;
}
+
+} // End llvm namespace
#include "llvm/Assembly/Writer.h"
#include "Support/Debug.h"
+namespace llvm {
+
static bool isLoopInvariant(const Value *V, const Loop *L) {
if (const Instruction *I = dyn_cast<Instruction>(V))
return !L->contains(I->getParent());
}
o << "\n";
}
+
+} // End llvm namespace
#include "llvm/Support/InstVisitor.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> TotalInsts ("instcount", "Number of instructions (of all types)");
Statistic<> TotalBlocks("instcount", "Number of basic blocks");
visit(F);
return false;
}
+
+} // End llvm namespace
#include "llvm/Support/CFG.h"
#include <algorithm>
+using namespace llvm;
+
//===----------------------------------------------------------------------===//
// Interval Implementation
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/IntervalIterator.h"
#include "Support/STLExtras.h"
+namespace llvm {
+
static RegisterAnalysis<IntervalPartition>
X("intervals", "Interval Partition Construction", true);
for_each(Intervals.begin(), Intervals.end(),
bind_obj(this, &IntervalPartition::updatePredecessors));
}
+
+} // End llvm namespace
/// BROKEN: Should not include sparc stuff directly into here
#include "../../Target/Sparc/SparcInternals.h" // Only for PHI defn
+namespace llvm {
BBLiveVar::BBLiveVar(const BasicBlock &bb, MachineBasicBlock &mbb, unsigned id)
: BB(bb), MBB(mbb), POID(id) {
std::cerr << " Out: "; printSet(OutSet); std::cerr << "\n";
}
-
-
-
+} // End llvm namespace
#include "llvm/CodeGen/ValueSet.h"
#include "Support/hash_map"
+
+namespace llvm {
+
class BasicBlock;
class Value;
class MachineBasicBlock;
void printInOutSets() const; // for printing In/Out sets
};
+} // End llvm namespace
+
#endif
#include "Support/CommandLine.h"
#include "BBLiveVar.h"
+namespace llvm {
+
static RegisterAnalysis<FunctionLiveVarInfo>
X("livevar", "Live Variable Analysis");
SetAI = NewSet;
}
}
+
+} // End llvm namespace
#include "llvm/Value.h"
#include <iostream>
+namespace llvm {
+
std::ostream &operator<<(std::ostream &O, RAV V) { // func to print a Value
const Value &v = V.V;
if (v.hasName())
std::cerr << RAV(*I);
}
+} // End llvm namespace
#include <algorithm>
#include <set>
+namespace llvm {
+
namespace {
// FIXME: This should not be a FunctionPass.
struct LoadVN : public FunctionPass, public ValueNumbering {
RegisterAnalysisGroup<ValueNumbering, LoadVN> Y;
}
-
-
Pass *createLoadValueNumberingPass() { return new LoadVN(); }
return true;
}
}
+
+} // End llvm namespace
#include "Support/DepthFirstIterator.h"
#include <algorithm>
+namespace llvm {
+
static RegisterAnalysis<LoopInfo>
X("loops", "Natural Loop Construction", true);
I = std::find(I+1, ExitBlocks.end(), Old);
}
}
+
+} // End llvm namespace
#include "Support/DepthFirstIterator.h"
#include "Support/SetOperations.h"
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// PostDominatorSet Implementation
//===----------------------------------------------------------------------===//
// stub - a dummy function to make linking work ok.
void PostDominanceFrontier::stub() {
}
+
+} // End llvm namespace
#include "llvm/Support/CFG.h"
#include "Support/SCCIterator.h"
+namespace llvm {
+
namespace {
struct CFGSCC : public FunctionPass {
bool runOnFunction(Function& func);
return true;
}
+
+} // End llvm namespace
#include "llvm/Type.h"
#include "llvm/iMemory.h"
+namespace llvm {
+
// Register the ValueNumbering interface, providing a nice name to refer to.
static RegisterAnalysisGroup<ValueNumbering> X("Value Numbering");
// into the tool that uses it. As such, we register and implement the class
// here.
//
+
namespace {
/// BasicVN - This class is the default implementation of the ValueNumbering
/// interface. It walks the SSA def-use chains to trivially identify
// Declare that we implement the ValueNumbering interface
RegisterAnalysisGroup<ValueNumbering, BasicVN, true> Y;
-} // End of anonymous namespace
-namespace {
/// BVNImpl - Implement BasicVN in terms of a visitor class that
/// handles the different types of instructions as appropriate.
///
RetVals.push_back(Other);
}
}
+
+} // End llvm namespace
#include "Config/sys/mman.h"
#include "Config/fcntl.h"
+namespace llvm {
+
namespace {
struct ar_hdr {
char name[16];
};
}
-
// getObjectType - Determine the type of object that this header represents.
// This is capable of parsing the variety of special sections used for various
// purposes.
return Result;
}
+
+} // End llvm namespace
#define RET_TOK(type, Enum, sym) \
llvmAsmlval.type = Instruction::Enum; return sym
+namespace llvm {
// TODO: All of the static identifiers are figured out by the lexer,
// these should be hashed to reduce the lexer size
return BOut;
}
+} // End llvm namespace
+
+using namespace llvm;
+
#define YY_NEVER_INTERACTIVE 1
%}
#include "llvm/Module.h"
#include "llvm/Analysis/Verifier.h"
+namespace llvm {
+
// The useful interface defined by this file... Parse an ASCII file, and return
// the internal representation in a nice slice'n'dice'able representation.
//
return Result + ": " + Message;
}
+
+} // End llvm namespace
#include "llvm/Assembly/Parser.h"
#include "Support/StringExtras.h"
-class Module;
-
// Global variables exported from the lexer...
extern std::FILE *llvmAsmin;
extern int llvmAsmlineno;
+// Globals exported by the parser...
+extern char* llvmAsmtext;
+extern int llvmAsmleng;
+
+namespace llvm {
+
// Globals exported by the parser...
extern std::string CurFilename;
+
+class Module;
Module *RunVMAsmParser(const std::string &Filename, FILE *F);
-extern char* llvmAsmtext;
-extern int llvmAsmleng;
// UnEscapeLexed - Run through the specified buffer and change \xx codes to the
// appropriate character. If AllowNull is set to false, a \00 value will cause
}
}
+} // End llvm namespace
+
#endif
int yylex(); // declaration" of xxx warnings.
int yyparse();
+namespace llvm {
+
static Module *ParserResult;
std::string CurFilename;
return Result;
}
+} // End llvm namespace
+
+using namespace llvm;
+
%}
%union {
- Module *ModuleVal;
- Function *FunctionVal;
- std::pair<PATypeHolder*, char*> *ArgVal;
- BasicBlock *BasicBlockVal;
- TerminatorInst *TermInstVal;
- Instruction *InstVal;
- Constant *ConstVal;
-
- const Type *PrimType;
- PATypeHolder *TypeVal;
- Value *ValueVal;
-
- std::vector<std::pair<PATypeHolder*,char*> > *ArgList;
- std::vector<Value*> *ValueList;
- std::list<PATypeHolder> *TypeList;
- std::list<std::pair<Value*,
- BasicBlock*> > *PHIList; // Represent the RHS of PHI node
- std::vector<std::pair<Constant*, BasicBlock*> > *JumpTable;
- std::vector<Constant*> *ConstVector;
-
- GlobalValue::LinkageTypes Linkage;
+ llvm::Module *ModuleVal;
+ llvm::Function *FunctionVal;
+ std::pair<llvm::PATypeHolder*, char*> *ArgVal;
+ llvm::BasicBlock *BasicBlockVal;
+ llvm::TerminatorInst *TermInstVal;
+ llvm::Instruction *InstVal;
+ llvm::Constant *ConstVal;
+
+ const llvm::Type *PrimType;
+ llvm::PATypeHolder *TypeVal;
+ llvm::Value *ValueVal;
+
+ std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
+ std::vector<llvm::Value*> *ValueList;
+ std::list<llvm::PATypeHolder> *TypeList;
+ std::list<std::pair<llvm::Value*,
+ llvm::BasicBlock*> > *PHIList; // Represent the RHS of PHI node
+ std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
+ std::vector<llvm::Constant*> *ConstVector;
+
+ llvm::GlobalValue::LinkageTypes Linkage;
int64_t SInt64Val;
uint64_t UInt64Val;
int SIntVal;
bool BoolVal;
char *StrVal; // This memory is strdup'd!
- ValID ValIDVal; // strdup'd memory maybe!
+ llvm::ValID ValIDVal; // strdup'd memory maybe!
- Instruction::BinaryOps BinaryOpVal;
- Instruction::TermOps TermOpVal;
- Instruction::MemoryOps MemOpVal;
- Instruction::OtherOps OtherOpVal;
- Module::Endianness Endianness;
+ llvm::Instruction::BinaryOps BinaryOpVal;
+ llvm::Instruction::TermOps TermOpVal;
+ llvm::Instruction::MemoryOps MemOpVal;
+ llvm::Instruction::OtherOps OtherOpVal;
+ llvm::Module::Endianness Endianness;
}
%type <ModuleVal> Module FunctionList
delete $2; delete $4;
};
+
%%
int yyerror(const char *ErrorMsg) {
std::string where
#include "Config/sys/mman.h"
#include "Config/fcntl.h"
+namespace llvm {
+
namespace {
struct ar_hdr {
char name[16];
};
}
-
// getObjectType - Determine the type of object that this header represents.
// This is capable of parsing the variety of special sections used for various
// purposes.
return Result;
}
+
+} // End llvm namespace
#include "Config/sys/mman.h"
#include "Config/fcntl.h"
+namespace llvm {
+
namespace {
struct ar_hdr {
char name[16];
};
}
-
// getObjectType - Determine the type of object that this header represents.
// This is capable of parsing the variety of special sections used for various
// purposes.
return Result;
}
+
+} // End llvm namespace
#include "llvm/Constants.h"
#include <algorithm>
+namespace llvm {
+
const Type *BytecodeParser::parseTypeConstant(const unsigned char *&Buf,
const unsigned char *EndBuf) {
unsigned PrimType;
if (Buf > EndBuf) throw std::string("Read past end of buffer.");
}
+
+} // End llvm namespace
#include "llvm/iOther.h"
#include "llvm/Module.h"
+namespace llvm {
+
namespace {
struct RawInst { // The raw fields out of the bytecode stream...
unsigned NumOperands;
};
}
-
-
RawInst::RawInst(const unsigned char *&Buf, const unsigned char *EndBuf,
std::vector<unsigned> &Args) {
unsigned Op, Typ;
BB->getInstList().push_back(Result);
BCR_TRACE(4, *Result);
}
+
+} // End llvm namespace
#include <algorithm>
#include <memory>
+namespace llvm {
+
static inline void ALIGN32(const unsigned char *&begin,
const unsigned char *end) {
if (align32(begin, end))
throw;
}
}
+
+} // End llvm namespace
#include <utility>
#include <map>
+namespace llvm {
+
// Enable to trace to figure out what the heck is going on when parsing fails
//#define TRACE_LEVEL 10
//#define DEBUG_OUTPUT
#endif
}
+} // End llvm namespace
+
#endif
#include "Config/unistd.h"
#include "Config/sys/mman.h"
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// BytecodeFileReader - Read from an mmap'able file descriptor.
//
unsigned char Buffer[4096*4];
// Read in all of the data from stdin, we cannot mmap stdin...
- while ((BlockSize = read(0 /*stdin*/, Buffer, 4096*4))) {
+ while ((BlockSize = ::read(0 /*stdin*/, Buffer, 4096*4))) {
if (BlockSize == -1)
throw std::string("Error reading from stdin!");
return MP;
}
-
//===----------------------------------------------------------------------===//
// Wrapper functions
//===----------------------------------------------------------------------===//
return 0;
}
}
+
+} // End llvm namespace
#include "llvm/SymbolTable.h"
#include "llvm/DerivedTypes.h"
+namespace llvm {
+
void BytecodeWriter::outputType(const Type *T) {
output_vbr((unsigned)T->getPrimitiveID(), Out);
}
return false;
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include <algorithm>
+namespace llvm {
+
static Statistic<>
NumInstrs("bytecodewriter", "Number of instructions");
// operands or a large operand index that we are referring to.
outputInstructionFormat0(&I, Opcode, Table, Type, Out);
}
+
+} // End llvm namespace
#include "Support/STLExtras.h"
#include <algorithm>
+namespace llvm {
+
#if 0
#define SC_DEBUG(X) std::cerr << X
#else
SC_DEBUG("]\n");
return (int)DestSlot;
}
+
+} // End llvm namespace
#include <vector>
#include <map>
+
+namespace llvm {
+
class Value;
class Module;
class Function;
void processSymbolTableConstants(const SymbolTable *ST);
};
+} // End llvm namespace
+
#endif
#include "Config/string.h"
#include <algorithm>
+namespace llvm {
+
static RegisterPass<WriteBytecodePass> X("emitbytecode", "Bytecode Writer");
static Statistic<>
Out.flush();
}
+
+} // End llvm namespace
#include "llvm/SlotCalculator.h"
#include "llvm/Instruction.h"
+namespace llvm {
+
class BytecodeWriter {
std::deque<unsigned char> &Out;
SlotCalculator Table;
}
};
+} // End llvm namespace
#endif
#include "Support/CommandLine.h"
#include <algorithm>
+namespace llvm {
+
SchedDebugLevel_t SchedDebugLevel;
static cl::opt<bool> EnableFillingDelaySlots("sched-fill-delay-slots",
FunctionPass *createInstructionSchedulingWithSSAPass(const TargetMachine &tgt) {
return new InstructionSchedulingWithSSA(tgt);
}
+
+} // End llvm namespace
+
#include "llvm/Target/TargetRegInfo.h"
#include "Support/STLExtras.h"
+namespace llvm {
+
//*********************** Internal Data Structures *************************/
// The following two types need to be classes, not typedefs, so we can use
os << std::string(16, ' ') << *outEdges[i];
}
}
+
+} // End llvm namespace
#include "Support/hash_map"
#include "Support/GraphTraits.h"
+namespace llvm {
+
class RegToRefVecMap;
class ValueToDefVecMap;
class RefVec;
}
};
+} // End llvm namespace
+
#endif
#include "llvm/CodeGen/SchedGraphCommon.h"
#include "Support/STLExtras.h"
+namespace llvm {
+
class SchedGraphCommon;
//
this->eraseOutgoingEdges(node, addDummyEdges);
}
+} // End llvm namespace
#include "llvm/Support/CFG.h"
#include "Support/PostOrderIterator.h"
+namespace llvm {
+
std::ostream &operator<<(std::ostream &os, const NodeDelayPair* nd) {
return os << "Delay for node " << nd->node->getNodeId()
<< " = " << (long)nd->delay << "\n";
return lastUseMap[MI] = hasLastUse;
}
+} // End llvm namespace
#include "Support/hash_set"
#include <list>
+namespace llvm {
+
class Function;
class MachineInstr;
class SchedulingManager;
std::ostream &operator<<(std::ostream &os, const NodeDelayPair* nd);
+} // End llvm namespace
+
#endif
#include "Support/STLExtras.h"
#include "Config/alloca.h"
+namespace llvm {
+
//------------------------------------------------------------------------
// class InstrTreeNode
//------------------------------------------------------------------------
delete [] childArray;
return treeNode;
}
+
+} // End llvm namespace
#include "Support/LeakDetector.h"
#include <vector>
+namespace llvm {
+
std::vector<MachineInstr*>
FixConstantOperandsForInstr(Instruction* vmInstr, MachineInstr* minstr,
TargetMachine& target);
};
}
+namespace llvm {
+
TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi,
Value *s1, Value *s2, const std::string &name)
: Instruction(s1->getType(), Instruction::UserOp1, name)
LeakDetector::removeGarbageObject(this);
}
+} // End llvm namespace
bool InstructionSelection::runOnFunction(Function &F)
{
}
-
//===----------------------------------------------------------------------===//
// createInstructionSelectionPass - Public entrypoint for instruction selection
// and this file as a whole...
FunctionPass *createInstructionSelectionPass(TargetMachine &T) {
return new InstructionSelection(T);
}
+
+} // End llvm namespace
#include "llvm/DerivedTypes.h"
#include "../../Target/Sparc/SparcInstrSelectionSupport.h" // FIXME!
+namespace llvm {
// Generate code to load the constant into a TmpInstruction (virtual reg) and
// returns the virtual register.
return MVec;
}
+
+} // End llvm namespace
#include "llvm/Support/CFG.h"
#include "Support/DepthFirstIterator.h"
+namespace llvm {
+
static RegisterAnalysis<LiveVariables> X("livevars", "Live Variable Analysis");
const std::pair<MachineBasicBlock*, unsigned> &
return false;
}
+
+} // End llvm namespace
#include "llvm/Function.h"
#include <fstream>
+namespace llvm {
+
namespace {
struct DebugMachineCodeEmitter : public MachineCodeEmitter {
void startFunction(MachineFunction &F) {
return 0;
}
};
-}
-
-
-/// createDebugMachineCodeEmitter - Return a dynamically allocated machine
-/// code emitter, which just prints the opcodes and fields out the cout. This
-/// can be used for debugging users of the MachineCodeEmitter interface.
-///
-MachineCodeEmitter *MachineCodeEmitter::createDebugEmitter() {
- return new DebugMachineCodeEmitter();
-}
-namespace {
class FilePrinterEmitter : public MachineCodeEmitter {
std::ofstream actual;
std::ostream &o;
};
}
+/// createDebugMachineCodeEmitter - Return a dynamically allocated machine
+/// code emitter, which just prints the opcodes and fields out the cout. This
+/// can be used for debugging users of the MachineCodeEmitter interface.
+///
+MachineCodeEmitter *
+MachineCodeEmitter::createDebugEmitter() {
+ return new DebugMachineCodeEmitter();
+}
+
MachineCodeEmitter *
MachineCodeEmitter::createFilePrinterEmitter(MachineCodeEmitter &MCE) {
return new FilePrinterEmitter(MCE, std::cerr);
}
+
+} // End llvm namespace
#include "llvm/CodeGen/MachineInstrAnnot.h"
#include "llvm/CodeGen/InstrSelection.h"
+namespace llvm {
+
AnnotationID MCFI_AID(
AnnotationManager::getID("CodeGen::MachineCodeForInstruction"));
if (callArgsDesc)
delete callArgsDesc;
}
+
+} // End llvm namespace
#include "llvm/Pass.h"
#include "Config/limits.h"
+namespace llvm {
+
const int INVALID_FRAME_OFFSET = INT_MAX; // std::numeric_limits<int>::max();
static AnnotationID MF_AID(
hash_map<const Value*, int>::const_iterator pair = offsets.find(val);
return (pair == offsets.end()) ? INVALID_FRAME_OFFSET : pair->second;
}
+
+} // End llvm namespace
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/MRegisterInfo.h"
+namespace llvm {
+
// Global variable holding an array of descriptors for machine instructions.
// The actual object needs to be created separately for each target machine.
// This variable is initialized and reset by class TargetInstrInfo.
// Specialize printing if op#0 is definition
if (getNumOperands() &&
(getOperand(0).opIsDefOnly() || getOperand(0).opIsDefAndUse())) {
- ::print(getOperand(0), OS, TM);
+ llvm::print(getOperand(0), OS, TM);
OS << " = ";
++StartOp; // Don't print this operand again!
}
if (i != StartOp)
OS << ",";
OS << " ";
- ::print(mop, OS, TM);
+ llvm::print(mop, OS, TM);
if (mop.opIsDefAndUse())
OS << "<def&use>";
return OS;
}
+
+} // End llvm namespace
#include "llvm/iOther.h"
#include "llvm/Type.h"
+namespace llvm {
CallArgsDescriptor::CallArgsDescriptor(CallInst* _callInstr,
TmpInstruction* _retAddrReg,
assert(desc->getCallInst()==callInstr && "Incorrect call args descriptor?");
return desc;
}
+
+} // End llvm namespace
#include "ModuloSchedGraph.h"
#include "llvm/Type.h"
+namespace llvm {
+
ModuloSchedGraphNode::ModuloSchedGraphNode(unsigned id, int index,
const Instruction *inst,
const TargetMachine &targ)
//delete all the graphs
}
+} // End llvm namespace
#include "Support/hash_map"
#include <vector>
+namespace llvm {
class ModuloSchedGraphNode : public SchedGraphNodeCommon {
};
+} // End llvm namespace
+
#endif
#include "llvm/Function.h"
#include "llvm/Pass.h"
+namespace llvm {
+
namespace {
class ModuloScheduling : public FunctionPass {
bool Changed = false;
return Changed;
}
+
+} // End llvm namespace
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/CFG.h"
+namespace llvm {
+
namespace {
struct PNE : public MachineFunctionPass {
bool runOnMachineFunction(MachineFunction &Fn) {
"Eliminate PHI nodes for register allocation");
}
+
const PassInfo *PHIEliminationID = X.getPassInfo();
/// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in
return true;
}
+
+} // End llvm namespace
#include "llvm/CodeGen/Passes.h"
#include "Support/CommandLine.h"
+namespace llvm {
+
namespace {
enum RegAllocName { simple, local };
return 0; // not reached
}
}
+
+} // End llvm namespace
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/Target/TargetInstrInfo.h"
+namespace llvm {
+
namespace {
struct PEI : public MachineFunctionPass {
const char *getPassName() const {
};
}
+
/// createPrologEpilogCodeInserter - This function returns a pass that inserts
/// prolog and epilog code, and eliminates abstract frame references.
///
break;
}
}
+
+} // End llvm namespace
#include "llvm/DerivedTypes.h"
#include "llvm/Constants.h"
+namespace llvm {
+
/// AllocInfo - Structure representing one instruction's operand's-worth of
/// register allocation state. We create tables made out of these data
/// structures to generate mapping information for this register allocator.
}
};
+} // End llvm namespace
+
#endif // ALLOCINFO_H
#include <algorithm>
#include <iostream>
+namespace llvm {
+
//-----------------------------------------------------------------------------
// Sets this IGNode on stack and reduce the degree of neighbors
//-----------------------------------------------------------------------------
std::vector<IGNode*>::iterator new_end = unique(nbrs.begin(), nbrs.end());
return new_end - nbrs.begin();
}
+
+} // End llvm namespace
#include "LiveRange.h"
#include <vector>
+
+namespace llvm {
+
class RegClass;
//----------------------------------------------------------------------------
inline LiveRange *getParentLR() const { return ParentLR; }
};
+} // End llvm namespace
+
#endif
#include "Support/STLExtras.h"
#include <algorithm>
+namespace llvm {
+
// for asserting this IG node is infact in the IGNodeList of this class
inline static void assertIGNode(const InterferenceGraph *IG,
const IGNode *Node) {
}
}
}
+
+} // End llvm namespace
#define INTERFERENCEGRAPH_H
#include <vector>
+
+namespace llvm {
+
class LiveRange;
class RegClass;
class IGNode;
void printIGNodeList() const;
};
+} // End llvm namespace
+
#endif
#include "llvm/Value.h"
#include "llvm/CodeGen/ValueSet.h"
+namespace llvm {
+
class RegClass;
class IGNode;
}
};
+} // End llvm namespace
+
#endif
#include "llvm/Target/TargetRegInfo.h"
#include "Support/SetOperations.h"
+namespace llvm {
+
unsigned LiveRange::getRegClassID() const { return getRegClass()->getID(); }
LiveRangeInfo::LiveRangeInfo(const Function *F, const TargetMachine &tm,
}
}
}
+
+} // End llvm namespace
#include "llvm/CodeGen/ValueSet.h"
#include "Support/hash_map"
+namespace llvm {
+
class LiveRange;
class MachineInstr;
class RegClass;
void printLiveRanges();
};
+} // End llvm namespace
+
#endif
#include "Support/STLExtras.h"
#include <cmath>
+namespace llvm {
+
RegAllocDebugLevel_t DEBUG_RA;
/// The reoptimizer wants to be able to grovel through the register
if (DEBUG_RA) std::cerr << "\nRegister allocation complete!\n";
return false; // Function was not modified
}
+
+} // End llvm namespace
#include "llvm/Target/TargetRegInfo.h"
#include <map>
+namespace llvm {
+
class MachineFunction;
class FunctionLiveVarInfo;
class MachineInstr;
void addInterf4PseudoInstr(const MachineInstr *MI);
};
+} // End llvm namespace
+
#endif
#ifndef REGALLOCCOMMON_H
#define REGALLOCCOMMON_H
+namespace llvm {
+
enum RegAllocDebugLevel_t {
RA_DEBUG_None = 0,
RA_DEBUG_Results = 1,
extern RegAllocDebugLevel_t DEBUG_RA;
+} // End llvm namespace
+
#endif
#include "RegClass.h"
#include "llvm/Target/TargetRegInfo.h"
+namespace llvm {
+
//----------------------------------------------------------------------------
// This constructor inits IG. The actual matrix is created by a call to
// createInterferenceGraph() above.
IG.printIG();
}
-
+} // End llvm namespace
#include "llvm/Target/TargetRegInfo.h"
#include "InterferenceGraph.h"
#include <stack>
+
+namespace llvm {
+
class TargetRegClassInfo;
void printIG();
};
+} // End llvm namespace
+
#endif
#include "Support/Statistic.h"
#include <iostream>
+namespace llvm {
+
namespace {
Statistic<> NumSpilled ("ra-local", "Number of registers spilled");
Statistic<> NumReloaded("ra-local", "Number of registers reloaded");
};
}
-
/// getStackSpaceFor - This allocates space for the specified virtual register
/// to be held on the stack.
int RA::getStackSpaceFor(unsigned VirtReg, const TargetRegisterClass *RC) {
FunctionPass *createLocalRegisterAllocator() {
return new RA();
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include <iostream>
+namespace llvm {
+
namespace {
Statistic<> NumSpilled ("ra-simple", "Number of registers spilled");
Statistic<> NumReloaded("ra-simple", "Number of registers reloaded");
FunctionPass *createSimpleRegisterAllocator() {
return new RegAllocSimple();
}
+
+} // End llvm namespace
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/InstVisitor.h"
+namespace llvm {
+
struct SelectionDAGBuilder : public InstVisitor<SelectionDAGBuilder> {
// DAG - the current dag we are building.
SelectionDAG &DAG;
SDB.visitBB(const_cast<BasicBlock&>(*I));
Root = SDB.CurRoot;
}
+
+} // End llvm namespace
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/Type.h"
+namespace llvm {
+
SelectionDAG::~SelectionDAG() {
for (unsigned i = 0, e = AllNodes.size(); i != e; ++i)
delete AllNodes[i];
std::cerr << "\n";
}
+
+} // End llvm namespace
#include "Support/DynamicLinker.h"
#include "Config/dlfcn.h"
+namespace llvm {
+
Statistic<> NumInitBytes("lli", "Number of bytes of global vars initialized");
ExecutionEngine::ExecutionEngine(ModuleProvider *P) :
InitializeMemory(I->getInitializer(), GlobalAddress[I]);
}
+} // End llvm namespace
#include "Support/Statistic.h"
#include <cmath> // For fmod
-Interpreter *TheEE = 0;
+namespace llvm {
namespace {
Statistic<> NumDynamicInsts("lli", "Number of dynamic instructions executed");
}
+Interpreter *TheEE = 0;
+
//===----------------------------------------------------------------------===//
// Value Manipulation code
//===----------------------------------------------------------------------===//
visit(I); // Dispatch to one of the visit* methods...
}
}
+
+} // End llvm namespace
#include <map>
using std::vector;
+namespace llvm {
+
typedef GenericValue (*ExFunc)(FunctionType *, const vector<GenericValue> &);
static std::map<const Function *, ExFunc> Functions;
static std::map<std::string, ExFunc> FuncNames;
FuncNames["lle_X_llvm.va_end"] = llvm_va_end;
FuncNames["lle_X_llvm.va_copy"] = llvm_va_copy;
}
+
+} // End llvm namespace
#include "llvm/Module.h"
#include "llvm/DerivedTypes.h"
+namespace llvm {
+
/// create - Create a new interpreter object. This can never fail.
///
ExecutionEngine *Interpreter::create(Module *M){
rv.IntVal = ExitCode;
return rv;
}
+
+} // End llvm namespace
#include "llvm/Target/TargetData.h"
#include "Support/DataTypes.h"
+namespace llvm {
+
struct FunctionInfo; // Defined in ExecutionAnnotations.h
// AllocaHolder - Object to track all of the blocks of memory allocated by
void popStackAndReturnValueToCaller(const Type *RetTy, GenericValue Result);
};
+} // End llvm namespace
+
#endif
#include "Support/DynamicLinker.h"
#include <iostream>
+namespace llvm {
+
// AtExitHandlers - List of functions to call when the program exits,
// registered with the atexit() library function.
static std::vector<void (*)()> AtExitHandlers;
return Ptr;
}
+
+} // End llvm namespace
#define NO_JITS_ENABLED
#endif
+namespace llvm {
+
namespace {
enum ArchName { x86, Sparc };
rv.IntVal = ExitCode;
return rv;
}
+
+} // End llvm namespace
#include "llvm/PassManager.h"
#include <map>
+namespace llvm {
+
class Function;
class GlobalValue;
class Constant;
void runJITOnFunction (Function *F);
};
+} // End llvm namespace
+
#endif
#include "Config/unistd.h"
#include "Config/sys/mman.h"
+namespace llvm {
+
namespace {
Statistic<> NumBytes("jit", "Number of bytes of machine code compiled");
VM *TheVM = 0;
return TheVM->getPointerToNamedFunction(Name);
}
}
+
+} // End llvm namespace
#include "llvm/CodeGen/MachineCodeEmitter.h"
#include "llvm/Target/TargetMachine.h"
+namespace llvm {
+
VM::~VM() {
delete MCE;
delete &TM;
TM.replaceMachineCodeForFunction (OldAddr, Addr);
return Addr;
}
+
+} // End llvm namespace
#include "llvm/PassManager.h"
#include <map>
+namespace llvm {
+
class Function;
class GlobalValue;
class Constant;
void runJITOnFunction (Function *F);
};
+} // End llvm namespace
+
#endif
#include <memory>
#include <set>
+namespace llvm {
+
/// FindLib - Try to convert Filename into the name of a file that we can open,
/// if it does not already name a file we can open, by first trying to open
/// Filename, then libFilename.<suffix> for each of a set of several common
return false;
}
+
+} // End llvm namespace
#include "llvm/iOther.h"
#include "llvm/Constants.h"
+namespace llvm {
+
// Error - Simple wrapper function to conditionally assign to E and return true.
// This just makes error return conditions a little bit simpler...
//
return false;
}
+} // End llvm namespace
#include <map>
#include "Support/Annotation.h"
+namespace llvm {
+
typedef std::map<const std::string, unsigned> IDMapType;
static unsigned IDCounter = 0; // Unique ID counter
if (I == getFactMap().end()) return 0;
return I->second.first(ID, Obj, I->second.second);
}
+
+} // End llvm namespace
#include <cstdlib>
#include <cerrno>
+namespace llvm {
+
using namespace cl;
//===----------------------------------------------------------------------===//
cl::location(HiddenPrinter), cl::Hidden, cl::ValueDisallowed);
} // End anonymous namespace
+
+} // End llvm namespace
#include "llvm/Instruction.h"
#include "llvm/ConstantHandling.h"
+namespace llvm {
+
/// Initialize a full (the default) or empty set for the specified type.
///
ConstantRange::ConstantRange(const Type *Ty, bool Full) {
void ConstantRange::dump() const {
print(std::cerr);
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include "Support/CommandLine.h"
+namespace llvm {
+
bool DebugFlag; // DebugFlag - Exported boolean set by the -debug option
namespace {
return false;
#endif
}
+
+} // End llvm namespace
#include "Config/dlfcn.h"
#include <cassert>
+namespace llvm {
+
bool LinkDynamicObject (const char *filename, std::string *ErrorMessage) {
#if defined (HAVE_DLOPEN)
if (dlopen (filename, RTLD_NOW | RTLD_GLOBAL) == 0) {
void *GetAddressOfSymbol (const std::string &symbolName) {
return GetAddressOfSymbol (symbolName.c_str ());
}
+
+} // End llvm namespace
#include <iostream>
#include <cstdio>
+namespace llvm
+{
+
/// CheckMagic - Returns true IFF the file named FN begins with Magic. FN must
/// name a readable file.
///
bool MakeFileReadable (const std::string &Filename) {
return AddPermissionsBits (Filename, 0444);
}
+
+} // End llvm namespace
#include "llvm/Value.h"
#include <set>
+namespace llvm {
+
// Lazily allocate set so that release build doesn't have to do anything.
static std::set<const void*> *Objects = 0;
static std::set<const Value*> *LLVMObjects = 0;
Objects = 0; LLVMObjects = 0;
}
}
+
+} // End llvm namespace
#include "llvm/Type.h"
#include "Support/StringExtras.h"
+namespace llvm {
+
static char HexDigit(int V) {
return V < 10 ? V+'0' : V+'A'-10;
}
FoundNames.insert(I->getName()); // Otherwise, keep track of name
}
+} // End llvm namespace
#include "Config/link.h"
#include <iostream>
+namespace llvm {
+
namespace {
struct PluginLoader {
void operator=(const std::string &Filename) {
static cl::opt<PluginLoader, false, cl::parser<std::string> >
LoadOpt("load", cl::ZeroOrMore, cl::value_desc("plugin.so"),
cl::desc("Load the specified plugin"));
+
+} // End llvm namespace
#include <signal.h>
#include "Config/config.h" // Get the signal handler return type
+namespace llvm {
+
static std::vector<std::string> FilesToRemove;
// IntSigs - Signals that may interrupt the program at any time.
std::for_each(IntSigs, IntSigsEnd, RegisterHandler);
std::for_each(KillSigs, KillSigsEnd, RegisterHandler);
}
+
+} // End llvm namespace
#include <iostream>
#include <algorithm>
+namespace llvm {
+
// GetLibSupportInfoOutputFile - Return a file stream to print our output on...
-std::ostream *GetLibSupportInfoOutputFile();
+extern std::ostream *GetLibSupportInfoOutputFile();
unsigned StatisticBase::NumStats = 0;
delete OutStream; // Close the file...
}
}
+
+} // End llvm namespace
#include "Config/unistd.h"
#include "Config/errno.h"
+namespace llvm {
+
/// isExecutableFile - This function returns true if the filename specified
/// exists and is executable.
///
return 1;
}
+} // End llvm namespace
#include <fstream>
#include <map>
+namespace llvm {
+
// getLibSupportInfoOutputFilename - This ugly hack is brought to you courtesy
// of constructor/destructor ordering being unspecified by C++. Basically the
// problem is that a Statistic<> object gets destroyed, which ends up calling
}
// GetLibSupportInfoOutputFile - Return a file stream to print our output on...
-std::ostream *GetLibSupportInfoOutputFile() {
+std::ostream *
+GetLibSupportInfoOutputFile() {
std::string &LibSupportInfoOutputFilename = getLibSupportInfoOutputFilename();
if (LibSupportInfoOutputFilename.empty())
return &std::cerr;
DefaultTimerGroup = 0;
}
}
+
+} // End llvm namespace
#include <iostream>
#include <fstream>
+namespace llvm {
+
//===---------------------------------------------------------------------===//
// LLI Implementation of AbstractIntepreter interface
//
Message = "Found gcc: " + GCCPath + "\n";
return new GCC(GCCPath);
}
+
+} // End llvm namespace
#include "llvm/Support/ValueHolder.h"
#include "llvm/Type.h"
+namespace llvm {
+
ValueHolder::ValueHolder(Value *V) : User(Type::TypeTy, Value::TypeVal) {
Operands.push_back(Use(V, this));
}
+
+} // End llvm namespace
#include <algorithm>
#include <sstream>
+namespace llvm {
+
namespace {
class CWriter : public Pass, public InstVisitor<CWriter> {
std::ostream &Out;
void printIndexingExpression(Value *Ptr, User::op_iterator I,
User::op_iterator E);
};
-}
// Pass the Type* and the variable name and this prints out the variable
// declaration.
// compiler agreeing on the conversion process (which is pretty likely since we
// only deal in IEEE FP).
//
-static bool isFPCSafeToPrint(const ConstantFP *CFP) {
+bool isFPCSafeToPrint(const ConstantFP *CFP) {
#if HAVE_PRINTF_A
char Buffer[100];
sprintf(Buffer, "%a", CFP->getValue());
// generateCompilerSpecificCode - This is where we add conditional compilation
// directives to cater to specific compilers as need be.
//
-static void generateCompilerSpecificCode(std::ostream& Out) {
+void generateCompilerSpecificCode(std::ostream& Out) {
// Alloca is hard to get, and we don't want to include stdlib.h here...
Out << "/* get a declaration for alloca */\n"
<< "#ifdef sun\n"
emittedInvoke = true;
}
-static bool isGotoCodeNecessary(BasicBlock *From, BasicBlock *To) {
+bool isGotoCodeNecessary(BasicBlock *From, BasicBlock *To) {
// If PHI nodes need copies, we need the copy code...
if (isa<PHINode>(To->front()) ||
From->getNext() != To) // Not directly successor, need goto
void CWriter::visitCallInst(CallInst &I) {
// Handle intrinsic function calls first...
if (Function *F = I.getCalledFunction())
- if (LLVMIntrinsic::ID ID = (LLVMIntrinsic::ID)F->getIntrinsicID()) {
+ if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) {
switch (ID) {
default: assert(0 && "Unknown LLVM intrinsic!");
- case LLVMIntrinsic::va_start:
+ case Intrinsic::va_start:
Out << "0; ";
Out << "va_start(*(va_list*)&" << Mang->getValueName(&I) << ", ";
writeOperand(&I.getParent()->getParent()->aback());
Out << ")";
return;
- case LLVMIntrinsic::va_end:
+ case Intrinsic::va_end:
Out << "va_end(*(va_list*)&";
writeOperand(I.getOperand(1));
Out << ")";
return;
- case LLVMIntrinsic::va_copy:
+ case Intrinsic::va_copy:
Out << "0;";
Out << "va_copy(*(va_list*)&" << Mang->getValueName(&I) << ", ";
Out << "*(va_list*)&";
writeOperand(I.getOperand(1));
Out << ")";
return;
- case LLVMIntrinsic::setjmp:
- case LLVMIntrinsic::sigsetjmp:
+ case Intrinsic::setjmp:
+ case Intrinsic::sigsetjmp:
// This intrinsic should never exist in the program, but until we get
// setjmp/longjmp transformations going on, we should codegen it to
// something reasonable. This will allow code that never calls longjmp
// to work.
Out << "0";
return;
- case LLVMIntrinsic::longjmp:
- case LLVMIntrinsic::siglongjmp:
+ case Intrinsic::longjmp:
+ case Intrinsic::siglongjmp:
// Longjmp is not implemented, and never will be. It would cause an
// exception throw.
Out << "abort()";
Out << ");\n va_end(Tmp); }";
}
+}
//===----------------------------------------------------------------------===//
// External Interface declaration
//===----------------------------------------------------------------------===//
Pass *createWriteToCPass(std::ostream &o) { return new CWriter(o); }
+
+} // End llvm namespace
#include <algorithm>
#include <sstream>
+namespace llvm {
+
namespace {
class CWriter : public Pass, public InstVisitor<CWriter> {
std::ostream &Out;
void printIndexingExpression(Value *Ptr, User::op_iterator I,
User::op_iterator E);
};
-}
// Pass the Type* and the variable name and this prints out the variable
// declaration.
// compiler agreeing on the conversion process (which is pretty likely since we
// only deal in IEEE FP).
//
-static bool isFPCSafeToPrint(const ConstantFP *CFP) {
+bool isFPCSafeToPrint(const ConstantFP *CFP) {
#if HAVE_PRINTF_A
char Buffer[100];
sprintf(Buffer, "%a", CFP->getValue());
// generateCompilerSpecificCode - This is where we add conditional compilation
// directives to cater to specific compilers as need be.
//
-static void generateCompilerSpecificCode(std::ostream& Out) {
+void generateCompilerSpecificCode(std::ostream& Out) {
// Alloca is hard to get, and we don't want to include stdlib.h here...
Out << "/* get a declaration for alloca */\n"
<< "#ifdef sun\n"
emittedInvoke = true;
}
-static bool isGotoCodeNecessary(BasicBlock *From, BasicBlock *To) {
+bool isGotoCodeNecessary(BasicBlock *From, BasicBlock *To) {
// If PHI nodes need copies, we need the copy code...
if (isa<PHINode>(To->front()) ||
From->getNext() != To) // Not directly successor, need goto
void CWriter::visitCallInst(CallInst &I) {
// Handle intrinsic function calls first...
if (Function *F = I.getCalledFunction())
- if (LLVMIntrinsic::ID ID = (LLVMIntrinsic::ID)F->getIntrinsicID()) {
+ if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) {
switch (ID) {
default: assert(0 && "Unknown LLVM intrinsic!");
- case LLVMIntrinsic::va_start:
+ case Intrinsic::va_start:
Out << "0; ";
Out << "va_start(*(va_list*)&" << Mang->getValueName(&I) << ", ";
writeOperand(&I.getParent()->getParent()->aback());
Out << ")";
return;
- case LLVMIntrinsic::va_end:
+ case Intrinsic::va_end:
Out << "va_end(*(va_list*)&";
writeOperand(I.getOperand(1));
Out << ")";
return;
- case LLVMIntrinsic::va_copy:
+ case Intrinsic::va_copy:
Out << "0;";
Out << "va_copy(*(va_list*)&" << Mang->getValueName(&I) << ", ";
Out << "*(va_list*)&";
writeOperand(I.getOperand(1));
Out << ")";
return;
- case LLVMIntrinsic::setjmp:
- case LLVMIntrinsic::sigsetjmp:
+ case Intrinsic::setjmp:
+ case Intrinsic::sigsetjmp:
// This intrinsic should never exist in the program, but until we get
// setjmp/longjmp transformations going on, we should codegen it to
// something reasonable. This will allow code that never calls longjmp
// to work.
Out << "0";
return;
- case LLVMIntrinsic::longjmp:
- case LLVMIntrinsic::siglongjmp:
+ case Intrinsic::longjmp:
+ case Intrinsic::siglongjmp:
// Longjmp is not implemented, and never will be. It would cause an
// exception throw.
Out << "abort()";
Out << ");\n va_end(Tmp); }";
}
+}
//===----------------------------------------------------------------------===//
// External Interface declaration
//===----------------------------------------------------------------------===//
Pass *createWriteToCPass(std::ostream &o) { return new CWriter(o); }
+
+} // End llvm namespace
#include "llvm/Target/MRegisterInfo.h"
+namespace llvm {
+
MRegisterInfo::MRegisterInfo(const MRegisterDesc *D, unsigned NR,
regclass_iterator RCB, regclass_iterator RCE,
int CFSO, int CFDO)
MRegisterInfo::~MRegisterInfo() {
delete[] PhysRegClasses;
}
+
+} // End llvm namespace
#include "llvm/Bytecode/Writer.h"
#include <iostream>
+namespace llvm {
+
using std::ostream;
namespace {
Pass *UltraSparc::getBytecodeAsmPrinterPass(std::ostream &Out) {
return new SparcBytecodeWriter(Out);
}
+
+} // End llvm namespace
#include "Support/CommandLine.h"
#include <algorithm>
+namespace llvm {
+
SchedDebugLevel_t SchedDebugLevel;
static cl::opt<bool> EnableFillingDelaySlots("sched-fill-delay-slots",
FunctionPass *createInstructionSchedulingWithSSAPass(const TargetMachine &tgt) {
return new InstructionSchedulingWithSSA(tgt);
}
+
+} // End llvm namespace
+
#include "llvm/Target/TargetRegInfo.h"
#include "Support/STLExtras.h"
+namespace llvm {
+
//*********************** Internal Data Structures *************************/
// The following two types need to be classes, not typedefs, so we can use
os << std::string(16, ' ') << *outEdges[i];
}
}
+
+} // End llvm namespace
#include "Support/hash_map"
#include "Support/GraphTraits.h"
+namespace llvm {
+
class RegToRefVecMap;
class ValueToDefVecMap;
class RefVec;
}
};
+} // End llvm namespace
+
#endif
#include "llvm/CodeGen/SchedGraphCommon.h"
#include "Support/STLExtras.h"
+namespace llvm {
+
class SchedGraphCommon;
//
this->eraseOutgoingEdges(node, addDummyEdges);
}
+} // End llvm namespace
#include "llvm/Support/CFG.h"
#include "Support/PostOrderIterator.h"
+namespace llvm {
+
std::ostream &operator<<(std::ostream &os, const NodeDelayPair* nd) {
return os << "Delay for node " << nd->node->getNodeId()
<< " = " << (long)nd->delay << "\n";
return lastUseMap[MI] = hasLastUse;
}
+} // End llvm namespace
#include "Support/hash_set"
#include <list>
+namespace llvm {
+
class Function;
class MachineInstr;
class SchedulingManager;
std::ostream &operator<<(std::ostream &os, const NodeDelayPair* nd);
+} // End llvm namespace
+
#endif
#include "Support/STLExtras.h"
#include "Config/alloca.h"
+namespace llvm {
+
//------------------------------------------------------------------------
// class InstrTreeNode
//------------------------------------------------------------------------
delete [] childArray;
return treeNode;
}
+
+} // End llvm namespace
#include "Support/LeakDetector.h"
#include <vector>
+namespace llvm {
+
std::vector<MachineInstr*>
FixConstantOperandsForInstr(Instruction* vmInstr, MachineInstr* minstr,
TargetMachine& target);
};
}
+namespace llvm {
+
TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi,
Value *s1, Value *s2, const std::string &name)
: Instruction(s1->getType(), Instruction::UserOp1, name)
LeakDetector::removeGarbageObject(this);
}
+} // End llvm namespace
bool InstructionSelection::runOnFunction(Function &F)
{
}
-
//===----------------------------------------------------------------------===//
// createInstructionSelectionPass - Public entrypoint for instruction selection
// and this file as a whole...
FunctionPass *createInstructionSelectionPass(TargetMachine &T) {
return new InstructionSelection(T);
}
+
+} // End llvm namespace
#include "llvm/DerivedTypes.h"
#include "../../Target/Sparc/SparcInstrSelectionSupport.h" // FIXME!
+namespace llvm {
// Generate code to load the constant into a TmpInstruction (virtual reg) and
// returns the virtual register.
return MVec;
}
+
+} // End llvm namespace
/// BROKEN: Should not include sparc stuff directly into here
#include "../../Target/Sparc/SparcInternals.h" // Only for PHI defn
+namespace llvm {
BBLiveVar::BBLiveVar(const BasicBlock &bb, MachineBasicBlock &mbb, unsigned id)
: BB(bb), MBB(mbb), POID(id) {
std::cerr << " Out: "; printSet(OutSet); std::cerr << "\n";
}
-
-
-
+} // End llvm namespace
#include "llvm/CodeGen/ValueSet.h"
#include "Support/hash_map"
+
+namespace llvm {
+
class BasicBlock;
class Value;
class MachineBasicBlock;
void printInOutSets() const; // for printing In/Out sets
};
+} // End llvm namespace
+
#endif
#include "Support/CommandLine.h"
#include "BBLiveVar.h"
+namespace llvm {
+
static RegisterAnalysis<FunctionLiveVarInfo>
X("livevar", "Live Variable Analysis");
SetAI = NewSet;
}
}
+
+} // End llvm namespace
#include "llvm/Value.h"
#include <iostream>
+namespace llvm {
+
std::ostream &operator<<(std::ostream &O, RAV V) { // func to print a Value
const Value &v = V.V;
if (v.hasName())
std::cerr << RAV(*I);
}
+} // End llvm namespace
#include "Support/Annotation.h"
#include <vector>
+namespace llvm {
+
class MachineInstr;
class Instruction;
class Value;
CallArgsDescriptor* getCallArgsDescriptor() const { return callArgsDesc; }
};
+} // End llvm namespace
+
#endif
#include "Support/HashExtras.h"
#include "Support/hash_set"
+
+namespace llvm {
+
class MachineFunction;
class Value;
class Constant;
int allocateOptionalArg(const Type* type);
};
+} // End llvm namespace
+
#endif
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/Target/TargetRegInfo.h"
+namespace llvm {
+
class Value;
class TmpInstruction;
class CallInst;
static CallArgsDescriptor *get(const MachineInstr* MI);
};
+} // End llvm namespace
#endif
#include "llvm/CodeGen/MachineCodeForInstruction.h"
#include "Support/StringExtras.h"
+namespace llvm {
+
namespace {
class MappingInfoAsmPrinter : public FunctionPass {
std::ostream &Out;
return false;
}
+} // End llvm namespace
+
#include <iosfwd>
#include <vector>
#include <string>
+
+namespace llvm {
+
class Pass;
Pass *getMappingInfoAsmPrinterPass(std::ostream &out);
}
};
+} // End llvm namespace
+
#endif
#include "ModuloSchedGraph.h"
#include "llvm/Type.h"
+namespace llvm {
+
ModuloSchedGraphNode::ModuloSchedGraphNode(unsigned id, int index,
const Instruction *inst,
const TargetMachine &targ)
//delete all the graphs
}
+} // End llvm namespace
#include "Support/hash_map"
#include <vector>
+namespace llvm {
class ModuloSchedGraphNode : public SchedGraphNodeCommon {
};
+} // End llvm namespace
+
#endif
#include "llvm/Function.h"
#include "llvm/Pass.h"
+namespace llvm {
+
namespace {
class ModuloScheduling : public FunctionPass {
bool Changed = false;
return Changed;
}
+
+} // End llvm namespace
#include "llvm/DerivedTypes.h"
#include "llvm/Constants.h"
+namespace llvm {
+
/// AllocInfo - Structure representing one instruction's operand's-worth of
/// register allocation state. We create tables made out of these data
/// structures to generate mapping information for this register allocator.
}
};
+} // End llvm namespace
+
#endif // ALLOCINFO_H
#include <algorithm>
#include <iostream>
+namespace llvm {
+
//-----------------------------------------------------------------------------
// Sets this IGNode on stack and reduce the degree of neighbors
//-----------------------------------------------------------------------------
std::vector<IGNode*>::iterator new_end = unique(nbrs.begin(), nbrs.end());
return new_end - nbrs.begin();
}
+
+} // End llvm namespace
#include "LiveRange.h"
#include <vector>
+
+namespace llvm {
+
class RegClass;
//----------------------------------------------------------------------------
inline LiveRange *getParentLR() const { return ParentLR; }
};
+} // End llvm namespace
+
#endif
#include "Support/STLExtras.h"
#include <algorithm>
+namespace llvm {
+
// for asserting this IG node is infact in the IGNodeList of this class
inline static void assertIGNode(const InterferenceGraph *IG,
const IGNode *Node) {
}
}
}
+
+} // End llvm namespace
#define INTERFERENCEGRAPH_H
#include <vector>
+
+namespace llvm {
+
class LiveRange;
class RegClass;
class IGNode;
void printIGNodeList() const;
};
+} // End llvm namespace
+
#endif
#include "llvm/Value.h"
#include "llvm/CodeGen/ValueSet.h"
+namespace llvm {
+
class RegClass;
class IGNode;
}
};
+} // End llvm namespace
+
#endif
#include "llvm/Target/TargetRegInfo.h"
#include "Support/SetOperations.h"
+namespace llvm {
+
unsigned LiveRange::getRegClassID() const { return getRegClass()->getID(); }
LiveRangeInfo::LiveRangeInfo(const Function *F, const TargetMachine &tm,
}
}
}
+
+} // End llvm namespace
#include "llvm/CodeGen/ValueSet.h"
#include "Support/hash_map"
+namespace llvm {
+
class LiveRange;
class MachineInstr;
class RegClass;
void printLiveRanges();
};
+} // End llvm namespace
+
#endif
#include "Support/STLExtras.h"
#include <cmath>
+namespace llvm {
+
RegAllocDebugLevel_t DEBUG_RA;
/// The reoptimizer wants to be able to grovel through the register
if (DEBUG_RA) std::cerr << "\nRegister allocation complete!\n";
return false; // Function was not modified
}
+
+} // End llvm namespace
#include "llvm/Target/TargetRegInfo.h"
#include <map>
+namespace llvm {
+
class MachineFunction;
class FunctionLiveVarInfo;
class MachineInstr;
void addInterf4PseudoInstr(const MachineInstr *MI);
};
+} // End llvm namespace
+
#endif
#ifndef REGALLOCCOMMON_H
#define REGALLOCCOMMON_H
+namespace llvm {
+
enum RegAllocDebugLevel_t {
RA_DEBUG_None = 0,
RA_DEBUG_Results = 1,
extern RegAllocDebugLevel_t DEBUG_RA;
+} // End llvm namespace
+
#endif
#include "RegClass.h"
#include "llvm/Target/TargetRegInfo.h"
+namespace llvm {
+
//----------------------------------------------------------------------------
// This constructor inits IG. The actual matrix is created by a call to
// createInterferenceGraph() above.
IG.printIG();
}
-
+} // End llvm namespace
#include "llvm/Target/TargetRegInfo.h"
#include "InterferenceGraph.h"
#include <stack>
+
+namespace llvm {
+
class TargetRegClassInfo;
void printIG();
};
+} // End llvm namespace
+
#endif
Xinclude <cstdio>
Xinclude <llvm/CodeGen/InstrForest.h>
-typedef InstrTreeNode* NODEPTR_TYPE;
+typedef llvm::InstrTreeNode* NODEPTR_TYPE;
Xdefine OP_LABEL(p) ((p)->opLabel)
Xdefine LEFT_CHILD(p) ((p)->LeftChild)
Xdefine RIGHT_CHILD(p) ((p)->RightChild)
#include "SparcInternals.h"
#include <string>
+namespace llvm {
+
namespace {
Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
} // End anonymous namespace
+namespace llvm {
+
Pass *UltraSparc::getFunctionAsmPrinterPass(std::ostream &Out) {
return new SparcFunctionAsmPrinter(Out, *this);
}
-
-
+} // End llvm namespace
//===----------------------------------------------------------------------===//
Pass *UltraSparc::getModuleAsmPrinterPass(std::ostream &Out) {
return new SparcModuleAsmPrinter(Out, *this);
}
+
+} // End llvm namespace
#include "SparcV9CodeEmitter.h"
#include "Config/alloca.h"
+namespace llvm {
+
namespace {
Statistic<> OverwrittenCalls("call-ovwr", "Number of over-written calls");
Statistic<> UnmodifiedCalls("call-skip", "Number of unmodified calls");
return (intptr_t)MCE.finishFunctionStub(*F)+4; /* 1 instr past the restore */
}
-
SparcV9CodeEmitter::SparcV9CodeEmitter(TargetMachine &tm,
MachineCodeEmitter &M): TM(tm), MCE(M)
{
}
}
+} // End llvm namespace
+
#include "SparcV9CodeEmitter.inc"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/Target/TargetMachine.h"
+namespace llvm {
+
class GlobalValue;
class MachineInstr;
class MachineOperand;
};
+} // End llvm namespace
+
#endif
#include "llvm/CodeGen/MachineCodeForInstruction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
+namespace llvm {
+
static const uint32_t MAXLO = (1 << 10) - 1; // set bits set by %lo(*)
static const uint32_t MAXSIMM = (1 << 12) - 1; // set bits in simm13 field of OR
CreateBitExtensionInstructions(/*signExtend*/ false, target, F, srcVal,
destVal, numLowBits, mvec, mcfi);
}
+
+} // End llvm namespace
#include <algorithm>
#include <cmath>
+namespace llvm {
+
static inline void Add3OperandInstr(unsigned Opcode, InstructionNode* Node,
std::vector<MachineInstr*>& mvec) {
mvec.push_back(BuildMI(Opcode, 3).addReg(Node->leftChild()->getValue())
// instead of a regular call. If not that kind of intrinsic, do nothing.
// Returns true if code was generated, otherwise false.
//
-bool CodeGenIntrinsic(LLVMIntrinsic::ID iid, CallInst &callInstr,
+bool CodeGenIntrinsic(Intrinsic::ID iid, CallInst &callInstr,
TargetMachine &target,
std::vector<MachineInstr*>& mvec)
{
switch (iid) {
- case LLVMIntrinsic::va_start: {
+ case Intrinsic::va_start: {
// Get the address of the first incoming vararg argument on the stack
bool ignore;
Function* func = cast<Function>(callInstr.getParent()->getParent());
return true;
}
- case LLVMIntrinsic::va_end:
+ case Intrinsic::va_end:
return true; // no-op on Sparc
- case LLVMIntrinsic::va_copy:
+ case Intrinsic::va_copy:
// Simple copy of current va_list (arg1) to new va_list (result)
mvec.push_back(BuildMI(V9::ORr, 3).
addMReg(target.getRegInfo().getZeroRegNum()).
addRegDef(&callInstr));
return true;
- case LLVMIntrinsic::sigsetjmp:
- case LLVMIntrinsic::setjmp: {
+ case Intrinsic::sigsetjmp:
+ case Intrinsic::setjmp: {
// act as if we return 0
unsigned g0 = target.getRegInfo().getZeroRegNum();
mvec.push_back(BuildMI(V9::ORr,3).addMReg(g0).addMReg(g0)
return true;
}
- case LLVMIntrinsic::siglongjmp:
- case LLVMIntrinsic::longjmp: {
+ case Intrinsic::siglongjmp:
+ case Intrinsic::longjmp: {
// call abort()
Module* M = callInstr.getParent()->getParent()->getParent();
const FunctionType *voidvoidFuncTy =
// sequence (e.g., va_start). Indirect calls cannot be special.
//
bool specialIntrinsic = false;
- LLVMIntrinsic::ID iid;
- if (calledFunc && (iid=(LLVMIntrinsic::ID)calledFunc->getIntrinsicID()))
+ Intrinsic::ID iid;
+ if (calledFunc && (iid=(Intrinsic::ID)calledFunc->getIntrinsicID()))
specialIntrinsic = CodeGenIntrinsic(iid, *callInstr, target, mvec);
// If not, generate the normal call sequence for the function.
}
}
}
+
+}
#include "llvm/DerivedTypes.h"
#include "SparcInternals.h"
+namespace llvm {
+
// Choose load instruction opcode based on type of value
inline MachineOpCode
ChooseLoadInstruction(const Type *DestTy)
}
}
+} // End llvm namespace
+
#endif
#include "SparcRegClassInfo.h"
#include "Config/sys/types.h"
+namespace llvm {
+
class LiveRange;
class UltraSparc;
class Pass;
Pass* getBytecodeAsmPrinterPass(std::ostream &Out);
};
+} // End llvm namespace
+
#endif
#include "llvm/BasicBlock.h"
#include "llvm/Pass.h"
+namespace llvm {
+
//************************* Internal Functions *****************************/
static inline void
FunctionPass* createPeepholeOptsPass(const TargetMachine &TM) {
return new PeepholeOpts(TM);
}
+
+} // End llvm namespace
#include "llvm/Transforms/Scalar.h"
#include <algorithm>
+namespace llvm {
+
namespace {
//===--------------------------------------------------------------------===//
"Specialize LLVM code for a target machine"
createPreselectionPass);
#endif
+
} // end anonymous namespace
visitOperands(I, (/*firstOp=*/ I.getCalledFunction()? 1 : 0));
}
-
//===----------------------------------------------------------------------===//
// createPreSelectionPass - Public entrypoint for pre-selection pass
// and this file as a whole...
FunctionPass* createPreSelectionPass(const TargetMachine &TM) {
return new PreSelection(TM);
}
+
+} // End llvm namespace
#include "llvm/DerivedTypes.h"
#include "llvm/Intrinsics.h"
+namespace llvm {
+
namespace {
struct InsertPrologEpilogCode : public MachineFunctionPass {
const char *getPassName() const { return "Sparc Prolog/Epilog Inserter"; }
FunctionPass *UltraSparc::getPrologEpilogInsertionPass() {
return new InsertPrologEpilogCode();
}
+
+} // End llvm namespace
#include "../../CodeGen/RegAlloc/RegAllocCommon.h" // FIXME!
#include "../../CodeGen/RegAlloc/IGNode.h" // FIXME!
+namespace llvm {
+
//-----------------------------------------------------------------------------
// Int Register Class - method for coloring a node in the interference graph.
//
return -1;
}
+
+} // End llvm namespace
#include "llvm/Target/TargetRegInfo.h"
+namespace llvm {
+
//-----------------------------------------------------------------------------
// Integer Register Class
//-----------------------------------------------------------------------------
const char * const getRegName(unsigned reg) const;
};
+} // End llvm namespace
+
#endif
#include "llvm/Function.h"
#include "llvm/DerivedTypes.h"
+namespace llvm {
+
enum {
BadRegClass = ~0
};
std::cerr << "+" << getUnifiedRegName(uRegName+1);
std::cerr << "]\n";
}
+
+} // End llvm namespace
#include "SparcInternals.h"
+using namespace llvm;
+
/*---------------------------------------------------------------------------
Scheduling guidelines for SPARC IIi:
#include "llvm/CodeGen/MachineFunctionInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
+namespace llvm {
+
namespace {
class StackSlots : public MachineFunctionPass {
const TargetMachine &Target;
Pass *createStackSlotsPass(const TargetMachine &Target) {
return new StackSlots(Target);
}
+
+} // End llvm namespace
#include "llvm/Target/TargetMachineImpls.h"
#include "Support/CommandLine.h"
+namespace llvm {
+
static const unsigned ImplicitRegUseList[] = { 0 }; /* not used yet */
// Build the MachineInstruction Description Array...
const TargetInstrDescriptor SparcMachineInstrDesc[] = {
return false; // success!
}
+
+} // End llvm namespace
#include "llvm/DerivedTypes.h"
#include "llvm/Constants.h"
+namespace llvm {
+
// Handle the Pass registration stuff necessary to use TargetData's.
namespace {
// Register the default SparcV9 implementation...
RegisterPass<TargetData> X("targetdata", "Target Data Layout");
}
-
static inline void getTypeInfo(const Type *Ty, const TargetData *TD,
uint64_t &Size, unsigned char &Alignment);
return Result;
}
+
+} // End llvm namespace
#include "llvm/Constant.h"
#include "llvm/DerivedTypes.h"
+namespace llvm {
+
// External object describing the machine instructions
// Initialized only when the TargetMachine class is created
// and reset when that class is destroyed.
assert(CV->getType()->isPrimitiveType() || isa<PointerType>(CV->getType()));
return !(CV->getType()->isIntegral() || isa<PointerType>(CV->getType()));
}
+
+} // End llvm namespace
#include "llvm/Target/TargetCacheInfo.h"
#include "llvm/Type.h"
+namespace llvm {
+
//---------------------------------------------------------------------------
// class TargetMachine
//
cacheSizes.push_back(1 << 15); cacheSizes.push_back(1 << 20);
cacheAssoc.push_back(1); cacheAssoc.push_back(4);
}
+
+} // End llvm namespace
#include "llvm/Target/TargetSchedInfo.h"
#include "llvm/Target/TargetMachine.h"
+namespace llvm {
+
resourceId_t MachineResource::nextId = 0;
// Check if fromRVec and toRVec have *any* common entries.
assert(r >= 0 && "Resource to remove was unused in cycle c!");
}
}
+
+} // End llvm namespace
#include <algorithm>
#include <iostream>
+namespace llvm {
+
namespace {
Statistic<> NumFXCH("x86-codegen", "Number of fxch instructions inserted");
Statistic<> NumFP ("x86-codegen", "Number of floating point instructions");
// getSTReg - Return the X86::ST(i) register which contains the specified
// FP<RegNo> register
unsigned getSTReg(unsigned RegNo) const {
- return StackTop - 1 - getSlot(RegNo) + X86::ST0;
+ return StackTop - 1 - getSlot(RegNo) + llvm::X86::ST0;
}
// pushReg - Push the specifiex FP<n> register onto the stack
I = MBB->erase(I)-1; // Remove the pseudo instruction
}
+
+} // End llvm namespace
// Include the generated instruction selector...
#include "X86GenInstrSelector.inc"
+namespace llvm {
+
namespace {
struct ISel : public FunctionPass, SelectionDAGTargetBuilder {
TargetMachine &TM;
assert(0 && "ISel::expandCall not implemented!");
}
-
/// createX86PatternInstructionSelector - This pass converts an LLVM function
/// into a machine code representation using pattern matching and a machine
/// description file.
FunctionPass *createX86PatternInstructionSelector(TargetMachine &TM) {
return new ISel(TM);
}
+
+} // End llvm namespace
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/InstVisitor.h"
+namespace llvm {
+
/// BMI - A special BuildMI variant that takes an iterator to insert the
/// instruction at as well as a basic block. This is the version for when you
/// have a destination register in mind.
void doCall(const ValueRecord &Ret, MachineInstr *CallMI,
const std::vector<ValueRecord> &Args);
void visitCallInst(CallInst &I);
- void visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &I);
+ void visitIntrinsicCall(Intrinsic::ID ID, CallInst &I);
// Arithmetic operators
void visitSimpleBinary(BinaryOperator &B, unsigned OpcodeClass);
MachineInstr *TheCall;
if (Function *F = CI.getCalledFunction()) {
// Is it an intrinsic function call?
- if (LLVMIntrinsic::ID ID = (LLVMIntrinsic::ID)F->getIntrinsicID()) {
+ if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) {
visitIntrinsicCall(ID, CI); // Special intrinsics are not handled here
return;
}
}
-void ISel::visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &CI) {
+void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) {
unsigned TmpReg1, TmpReg2;
switch (ID) {
- case LLVMIntrinsic::va_start:
+ case Intrinsic::va_start:
// Get the address of the first vararg value...
TmpReg1 = getReg(CI);
addFrameReference(BuildMI(BB, X86::LEAr32, 5, TmpReg1), VarArgsFrameIndex);
return;
- case LLVMIntrinsic::va_copy:
+ case Intrinsic::va_copy:
TmpReg1 = getReg(CI);
TmpReg2 = getReg(CI.getOperand(1));
BuildMI(BB, X86::MOVrr32, 1, TmpReg1).addReg(TmpReg2);
return;
- case LLVMIntrinsic::va_end: return; // Noop on X86
+ case Intrinsic::va_end: return; // Noop on X86
- case LLVMIntrinsic::longjmp:
- case LLVMIntrinsic::siglongjmp:
+ case Intrinsic::longjmp:
+ case Intrinsic::siglongjmp:
BuildMI(BB, X86::CALLpcrel32, 1).addExternalSymbol("abort", true);
return;
- case LLVMIntrinsic::setjmp:
- case LLVMIntrinsic::sigsetjmp:
+ case Intrinsic::setjmp:
+ case Intrinsic::sigsetjmp:
// Setjmp always returns zero...
BuildMI(BB, X86::MOVir32, 1, getReg(CI)).addZImm(0);
return;
doCall(ValueRecord(0, Type::VoidTy), TheCall, Args);
}
-
/// createX86SimpleInstructionSelector - This pass converts an LLVM function
/// into a machine code representation is a very simple peep-hole fashion. The
/// generated code sucks but the implementation is nice and simple.
FunctionPass *createX86SimpleInstructionSelector(TargetMachine &TM) {
return new ISel(TM);
}
+
+} // End llvm namespace
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
+namespace llvm {
+
namespace {
struct PH : public MachineFunctionPass {
virtual bool runOnMachineFunction(MachineFunction &MF);
return false;
}
}
+
+} // End llvm namespace
#include "Support/StringExtras.h"
#include "Support/CommandLine.h"
+namespace llvm {
+
namespace {
Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
delete Mang;
return false; // success
}
+
+} // End llvm namespace
#define TARGET_X86_H
#include <iosfwd>
+
+namespace llvm {
+
class TargetMachine;
class FunctionPass;
// Defines symbolic names for X86 registers. This defines a mapping from
// register name to register number.
//
+} // End llvm namespace
+
#include "X86GenRegisterNames.inc"
// Defines symbolic names for the X86 instructions.
#include "Support/StringExtras.h"
#include "Support/CommandLine.h"
+namespace llvm {
+
namespace {
Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
delete Mang;
return false; // success
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include "Config/alloca.h"
+namespace llvm {
+
namespace {
Statistic<>
NumEmitted("x86-emitter", "Number of machine instructions emitted");
break;
}
}
+
+} // End llvm namespace
#include <algorithm>
#include <iostream>
+namespace llvm {
+
namespace {
Statistic<> NumFXCH("x86-codegen", "Number of fxch instructions inserted");
Statistic<> NumFP ("x86-codegen", "Number of floating point instructions");
// getSTReg - Return the X86::ST(i) register which contains the specified
// FP<RegNo> register
unsigned getSTReg(unsigned RegNo) const {
- return StackTop - 1 - getSlot(RegNo) + X86::ST0;
+ return StackTop - 1 - getSlot(RegNo) + llvm::X86::ST0;
}
// pushReg - Push the specifiex FP<n> register onto the stack
I = MBB->erase(I)-1; // Remove the pseudo instruction
}
+
+} // End llvm namespace
// Include the generated instruction selector...
#include "X86GenInstrSelector.inc"
+namespace llvm {
+
namespace {
struct ISel : public FunctionPass, SelectionDAGTargetBuilder {
TargetMachine &TM;
assert(0 && "ISel::expandCall not implemented!");
}
-
/// createX86PatternInstructionSelector - This pass converts an LLVM function
/// into a machine code representation using pattern matching and a machine
/// description file.
FunctionPass *createX86PatternInstructionSelector(TargetMachine &TM) {
return new ISel(TM);
}
+
+} // End llvm namespace
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/InstVisitor.h"
+namespace llvm {
+
/// BMI - A special BuildMI variant that takes an iterator to insert the
/// instruction at as well as a basic block. This is the version for when you
/// have a destination register in mind.
void doCall(const ValueRecord &Ret, MachineInstr *CallMI,
const std::vector<ValueRecord> &Args);
void visitCallInst(CallInst &I);
- void visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &I);
+ void visitIntrinsicCall(Intrinsic::ID ID, CallInst &I);
// Arithmetic operators
void visitSimpleBinary(BinaryOperator &B, unsigned OpcodeClass);
MachineInstr *TheCall;
if (Function *F = CI.getCalledFunction()) {
// Is it an intrinsic function call?
- if (LLVMIntrinsic::ID ID = (LLVMIntrinsic::ID)F->getIntrinsicID()) {
+ if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) {
visitIntrinsicCall(ID, CI); // Special intrinsics are not handled here
return;
}
}
-void ISel::visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &CI) {
+void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) {
unsigned TmpReg1, TmpReg2;
switch (ID) {
- case LLVMIntrinsic::va_start:
+ case Intrinsic::va_start:
// Get the address of the first vararg value...
TmpReg1 = getReg(CI);
addFrameReference(BuildMI(BB, X86::LEAr32, 5, TmpReg1), VarArgsFrameIndex);
return;
- case LLVMIntrinsic::va_copy:
+ case Intrinsic::va_copy:
TmpReg1 = getReg(CI);
TmpReg2 = getReg(CI.getOperand(1));
BuildMI(BB, X86::MOVrr32, 1, TmpReg1).addReg(TmpReg2);
return;
- case LLVMIntrinsic::va_end: return; // Noop on X86
+ case Intrinsic::va_end: return; // Noop on X86
- case LLVMIntrinsic::longjmp:
- case LLVMIntrinsic::siglongjmp:
+ case Intrinsic::longjmp:
+ case Intrinsic::siglongjmp:
BuildMI(BB, X86::CALLpcrel32, 1).addExternalSymbol("abort", true);
return;
- case LLVMIntrinsic::setjmp:
- case LLVMIntrinsic::sigsetjmp:
+ case Intrinsic::setjmp:
+ case Intrinsic::sigsetjmp:
// Setjmp always returns zero...
BuildMI(BB, X86::MOVir32, 1, getReg(CI)).addZImm(0);
return;
doCall(ValueRecord(0, Type::VoidTy), TheCall, Args);
}
-
/// createX86SimpleInstructionSelector - This pass converts an LLVM function
/// into a machine code representation is a very simple peep-hole fashion. The
/// generated code sucks but the implementation is nice and simple.
FunctionPass *createX86SimpleInstructionSelector(TargetMachine &TM) {
return new ISel(TM);
}
+
+} // End llvm namespace
#include "llvm/CodeGen/MachineInstrBuilder.h"
+namespace llvm {
+
/// addDirectMem - This function is used to add a direct memory reference to the
/// current instruction -- that is, a dereference of an address in a register,
/// with no scale, index or displacement. An example is: DWORD PTR [EAX].
return MIB.addConstantPoolIndex(CPI).addZImm(1).addReg(0).addSImm(Offset);
}
+} // End llvm namespace
+
#endif
#include "X86GenInstrInfo.inc"
+using namespace llvm;
+
X86InstrInfo::X86InstrInfo()
: TargetInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0]), 0) {
}
#include "llvm/Target/TargetInstrInfo.h"
#include "X86RegisterInfo.h"
+namespace llvm {
+
/// X86II - This namespace holds all of the target specific flags that
/// instruction info tracks.
///
}
};
+} // End llvm namespace
+
#endif
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
+namespace llvm {
+
namespace {
struct PH : public MachineFunctionPass {
virtual bool runOnMachineFunction(MachineFunction &MF);
return false;
}
}
+
+} // End llvm namespace
#include "llvm/Target/TargetFrameInfo.h"
#include "Support/CommandLine.h"
+namespace llvm {
+
namespace {
cl::opt<bool>
NoFPElim("disable-fp-elim",
return MBB.size() - oldSize;
}
+} // End llvm namespace
+
#include "X86GenRegisterInfo.inc"
+namespace llvm {
+
const TargetRegisterClass*
X86RegisterInfo::getRegClassForType(const Type* Ty) const {
switch (Ty->getPrimitiveID()) {
case Type::DoubleTyID: return &RFPInstance;
}
}
+
+} // End llvm namespace
#include "llvm/Target/MRegisterInfo.h"
-class Type;
+class llvm::Type;
#include "X86GenRegisterInfo.h.inc"
+namespace llvm {
+
struct X86RegisterInfo : public X86GenRegisterInfo {
X86RegisterInfo();
const TargetRegisterClass* getRegClassForType(const Type* Ty) const;
int emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
};
+} // End llvm namespace
+
#endif
#include "Support/CommandLine.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
cl::opt<bool> PrintCode("print-machineinstrs",
cl::desc("Print generated machine code"));
int32_t OldAddr = (intptr_t) OldWord;
*OldWord = NewAddr - OldAddr - 4; // Emit PC-relative addr of New code.
}
+
+} // End llvm namespace
#include "llvm/PassManager.h"
#include "X86InstrInfo.h"
+namespace llvm {
+
class X86TargetMachine : public TargetMachine {
X86InstrInfo InstrInfo;
TargetFrameInfo FrameInfo;
virtual void replaceMachineCodeForFunction (void *Old, void *New);
};
+} // End llvm namespace
+
#endif
#include "Support/Debug.h"
#include <algorithm>
+namespace llvm {
+
static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty,
ValueTypeCache &ConvertedTypes,
const TargetData &TD);
// << Operands[0]->use_size() << " " << Operands[0]);
}
}
+
+} // End llvm namespace
#include "llvm/Pass.h"
#include "llvm/Function.h"
+namespace llvm {
+
namespace {
// Hello - The first implementation, without getAnalysisUsage.
struct Hello : public FunctionPass {
};
RegisterOpt<Hello2> Y("hello2", "Hello World Pass (with getAnalysisUsage implemented)");
}
+
+} // End llvm namespace
#include "llvm/Pass.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumMerged("constmerge", "Number of global constants merged");
Pass *createConstantMergePass() { return new ConstantMerge(); }
-
bool ConstantMerge::run(Module &M) {
std::map<Constant*, GlobalVariable*> CMap;
bool MadeChanges = false;
return MadeChanges;
}
+
+} // End llvm namespace
#include "Support/iterator"
#include <set>
+namespace llvm {
+
namespace {
Statistic<> NumArgumentsEliminated("deadargelim",
"Number of unread args removed");
RemoveDeadArgumentsFromFunction(*DeadRetVal.begin());
return true;
}
+
+} // End llvm namespace
+
#include "llvm/DerivedTypes.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
struct DTE : public Pass {
// doPassInitialization - For this pass, it removes global symbol table
}
-
// ShouldNukeSymtabEntry - Return true if this module level symbol table entry
// should be eliminated.
//
return Changed;
}
+
+} // End llvm namespace
#include "llvm/Pass.h"
#include "llvm/Module.h"
+namespace llvm {
+
namespace {
class FunctionExtractorPass : public Pass {
Function *Named;
Pass *createFunctionExtractionPass(Function *F) {
return new FunctionExtractorPass(F);
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include <algorithm>
+namespace llvm {
+
namespace {
Statistic<>NumResolved("funcresolve", "Number of varargs functions resolved");
Statistic<> NumGlobals("funcresolve", "Number of global variables resolved");
return Changed;
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include <set>
+namespace llvm {
+
namespace {
Statistic<> NumFunctions("globaldce","Number of functions removed");
Statistic<> NumVariables("globaldce","Number of global variables removed");
return true;
}
+
+} // End llvm namespace
#include "llvm/Support/CallSite.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumArgumentsProped("ipconstprop",
"Number of args turned into constants");
}
return MadeChange;
}
+
+} // End llvm namespace
#include "llvm/Support/CallSite.h"
#include "llvm/Transforms/IPO.h"
+namespace llvm {
+
namespace {
// FunctionInfo - For each function, calculate the size of it in blocks and
// instructions.
InlineCost += CalleeFI.NumInsts*10 + CalleeFI.NumBlocks*20;
return InlineCost;
}
+
+} // End llvm namespace
#include "Support/Debug.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumInlined("inline", "Number of functions inlined");
Statistic<> NumDeleted("inline", "Number of functions deleted because all callers found");
}
return true;
}
+
+} // End llvm namespace
#define DEBUG_TYPE "inline"
#include "llvm/CallGraphSCCPass.h"
#include <set>
+
+namespace llvm {
+
class CallSite;
/// Inliner - This class contains all of the helper code which is used to
bool performInlining(CallSite CS, std::set<Function*> &SCC);
};
+} // End llvm namespace
#endif
#include <fstream>
#include <set>
+namespace llvm {
+
namespace {
Statistic<> NumFunctions("internalize", "Number of functions internalized");
Statistic<> NumGlobals ("internalize", "Number of global vars internalized");
Pass *createInternalizePass() {
return new InternalizePass();
}
+
+} // End llvm namespace
#include "Support/StringExtras.h"
#include "Support/VectorExtras.h"
+namespace llvm {
+
namespace {
Statistic<> LongJmpsTransformed("lowersetjmp",
"Number of longjmps transformed");
{
return new LowerSetJmp();
}
+
+} // End llvm namespace
#include "Support/Debug.h"
#include <algorithm>
+using namespace llvm;
+
// ValuePlaceHolder - A stupid little marker value. It appears as an
// instruction of type Instruction::UserOp1.
//
#include <functional>
#include <algorithm>
+namespace llvm {
+
//----------------------------------------------------------------------------
// Global constants used in marking Cilk functions and function calls.
//----------------------------------------------------------------------------
return true;
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include <set>
+namespace llvm {
+
namespace {
Statistic<> NumRemoved("prune-eh", "Number of invokes removed");
return MadeChange;
}
+
+} // End llvm namespace
#include "llvm/Support/CallSite.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumRaised("raiseallocs", "Number of allocations raised");
return Changed;
}
+
+} // End llvm namespace
using std::set;
using std::pair;
+namespace llvm {
+
namespace {
struct SimpleStructMutation : public MutateStructTypes {
enum Transform { SwapElements, SortElements };
return Transforms;
}
+
+} // End llvm namespace
#include "llvm/Module.h"
#include "llvm/Pass.h"
+namespace llvm {
+
static void insertInitializationCall(Function *MainFn, const char *FnName,
GlobalValue *Array) {
const Type *ArgVTy = PointerType::get(PointerType::get(Type::SByteTy));
insertInitializationCall(Main, "llvm_start_block_profiling", Counters);
return true;
}
+
+} // End llvm namespace
#include "llvm/Pass.h"
#include "llvm/Support/CFG.h"
+namespace llvm {
+
enum Color{
WHITE,
GREY,
M.getGlobalList().push_back(fnCount);
return true; // Always modifies program
}
+
+} // End llvm namespace
#include "llvm/Function.h"
#include "llvm/Pass.h"
+namespace llvm {
+
//this is used to color vertices
//during DFS
BLACK
};
-namespace{
+namespace {
struct CombineBranches : public FunctionPass {
private:
//DominatorSet *DS;
return true;
}
+
+} // End llvm namespace
#define INSERT_LOAD_COUNT
#define INSERT_STORE
+
using std::vector;
+namespace llvm {
static void getTriggerCode(Module *M, BasicBlock *BB, int MethNo, Value *pathNo,
Value *cnt, Instruction *rInst){
}
}
+} // End llvm namespace
using std::vector;
+namespace llvm {
+
const graphListElement *findNodeInList(const Graph::nodeList &NL,
Node *N) {
for(Graph::nodeList::const_iterator NI = NL.begin(), NE=NL.end(); NI != NE;
color[u]=BLACK;//done with visiting the node and its neighbors
}
-
+} // End llvm namespace
#include <map>
#include <cstdlib>
+namespace llvm {
+
class Module;
class Function;
}
};
+} // End llvm namespace
+
namespace std {
+
+using namespace llvm;
+
template<>
struct less<Node *> : public binary_function<Node *, Node *,bool> {
bool operator()(Node *n1, Node *n2) const {
};
}
+namespace llvm {
+
struct BBSort{
bool operator()(BasicBlock *BB1, BasicBlock *BB2) const{
std::string name1=BB1->getName();
std::vector<Edge> &be);
void getBBtrace(std::vector<BasicBlock *> &vBB, int pathNo, Function *M);
-#endif
+} // End llvm namespace
+#endif
using std::vector;
using std::cerr;
+namespace llvm {
+
//check if 2 edges are equal (same endpoints and same weight)
static bool edgesEqual(Edge ed1, Edge ed2){
return ((ed1==ed2) && ed1.getWeight()==ed2.getWeight());
}
cerr<<"--------------------Graph\n";
}
+
+} // End llvm namespace
#include "llvm/Function.h"
#include "llvm/Pass.h"
+namespace llvm {
+
//this is used to color vertices
//during DFS
findAndInstrumentBackEdges(F);
return true; // Function was modified.
}
+
+} // End llvm namespace
#include <fstream>
#include <cstdio>
+namespace llvm {
+
struct ProfilePaths : public FunctionPass {
bool runOnFunction(Function &F);
return true; // Always modifies function
}
+
+} // End llvm namespace
using std::map;
using std::cerr;
+namespace llvm {
+
//Routines to get the path trace!
void getPathFrmNode(Node *n, vector<BasicBlock*> &vBB, int pathNo, Graph &g,
}
*/
}
+
+} // End llvm namespace
#include <algorithm>
#include <sstream>
+namespace llvm {
+
static cl::opt<bool>
DisablePtrHashing("tracedisablehashdisable", cl::Hidden,
cl::desc("Disable pointer hashing in the -trace or -tracem "
return true;
}
+
+} // End llvm namespace
#include "Support/STLExtras.h"
#include <algorithm>
+namespace llvm {
+
// StartInst - This enables the -raise-start-inst=foo option to cause the level
// raising pass to start at instruction "foo", which is immensely useful for
// debugging!
static Statistic<>
NumVarargCallChanges("raise", "Number of vararg call peepholes");
-
#define PRINT_PEEPHOLE(ID, NUM, I) \
DEBUG(std::cerr << "Inst P/H " << ID << "[" << NUM << "] " << I)
RegisterOpt<RPR> X("raise", "Raise Pointer References");
}
+
Pass *createRaisePointerReferencesPass() {
return new RPR();
}
-
// isReinterpretingCast - Return true if the cast instruction specified will
// cause the operand to be "reinterpreted". A value is reinterpreted if the
// cast instruction would cause the underlying bits to change.
return Changed;
}
+
+} // End llvm namespace
#include "Support/STLExtras.h"
#include <algorithm>
+namespace llvm {
+
namespace {
Statistic<> NumBlockRemoved("adce", "Number of basic blocks removed");
Statistic<> NumInstRemoved ("adce", "Number of instructions removed");
return MadeChanges;
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include <set>
+namespace llvm {
+
namespace {
Statistic<> NumInstKilled("constprop", "Number of instructions killed");
}
return Changed;
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include <algorithm>
+namespace llvm {
+
namespace {
Statistic<> NumSetCCRemoved("cee", "Number of setcc instruction eliminated");
Statistic<> NumOperandsCann("cee", "Number of operands canonicalized");
void Relation::dump() const { print(std::cerr); }
void ValueInfo::dump() const { print(std::cerr, 0); }
void RegionInfo::dump() const { print(std::cerr); }
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include <set>
+namespace llvm {
+
namespace {
Statistic<> DIEEliminated("die", "Number of insts removed");
Statistic<> DCEEliminated("dce", "Number of insts removed");
}
-
//===----------------------------------------------------------------------===//
// DeadCodeElimination pass implementation
//
Pass *createDeadCodeEliminationPass() {
return new DCE();
}
+
+} // End llvm namespace
#include "llvm/Pass.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumAdded("lowerrefs", "# of getelementptr instructions added");
RegisterOpt<DecomposePass> X("lowerrefs", "Decompose multi-dimensional "
"structure/array references");
-FunctionPass
-*createDecomposeMultiDimRefsPass()
-{
- return new DecomposePass();
-}
-
-
// runOnBasicBlock - Entry point for array or structure references with multiple
// indices.
//
return changed;
}
+FunctionPass
+*createDecomposeMultiDimRefsPass()
+{
+ return new DecomposePass();
+}
// Function: DecomposeArrayRef()
//
return true;
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include <algorithm>
+namespace llvm {
+
namespace {
Statistic<> NumInstRemoved("gcse", "Number of instructions removed");
Statistic<> NumLoadRemoved("gcse", "Number of loads removed");
// createGCSEPass - The public interface to this file...
FunctionPass *createGCSEPass() { return new GCSE(); }
-
// GCSE::runOnFunction - This is the main transformation entry point for a
// function.
//
return Ret;
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include "Support/STLExtras.h"
+namespace llvm {
+
namespace {
Statistic<> NumRemoved ("indvars", "Number of aux indvars removed");
Statistic<> NumInserted("indvars", "Number of canonical indvars added");
Pass *createIndVarSimplifyPass() {
return new InductionVariableSimplify();
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include <algorithm>
+namespace llvm {
+
namespace {
Statistic<> NumCombined ("instcombine", "Number of insts combined");
Statistic<> NumConstProp("instcombine", "Number of constant folds");
Pass *createInstructionCombiningPass() {
return new InstCombiner();
}
+
+} // End llvm namespace
#include "llvm/Assembly/Writer.h"
#include <algorithm>
+namespace llvm {
+
namespace {
cl::opt<bool>
DisablePromotion("disable-licm-promotion", cl::Hidden,
}
}
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include "Support/hash_set"
+namespace llvm {
+
namespace {
Statistic<> NumExprsEliminated("pre", "Number of expressions constantified");
Statistic<> NumRedundant ("pre", "Number of redundant exprs eliminated");
- Statistic<> NumInserted ("pre", "Number of expressions inserted");
+ static Statistic<> NumInserted ("pre", "Number of expressions inserted");
struct PRE : public FunctionPass {
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
return Changed;
}
+
+} // End llvm namespace
#include "llvm/Support/CFG.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumInserted("pinodes", "Number of Pi nodes inserted");
return true;
}
+
+} // End llvm namespace
#include "Support/PostOrderIterator.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumLinear ("reassociate","Number of insts linearized");
Statistic<> NumChanged("reassociate","Number of insts reassociated");
RegisterOpt<Reassociate> X("reassociate", "Reassociate expressions");
}
+// Public interface to the Reassociate pass
FunctionPass *createReassociatePass() { return new Reassociate(); }
void Reassociate::BuildRankMap(Function &F) {
ValueRankMap.clear();
return Changed;
}
+
+} // End llvm namespace
#include <algorithm>
#include <set>
+namespace llvm {
+
// InstVal class - This class represents the different lattice values that an
// instruction may occupy. It is a simple class with value semantics.
//
// createSCCPPass - This is the public interface to this file...
-//
Pass *createSCCPPass() {
return new SCCP();
}
markConstant(&I, ConstantExpr::getGetElementPtr(Ptr, Operands));
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include "Support/StringExtras.h"
+namespace llvm {
+
namespace {
Statistic<> NumReplaced("scalarrepl", "Number of allocas broken up");
Statistic<> NumPromoted("scalarrepl", "Number of allocas promoted");
RegisterOpt<SROA> X("scalarrepl", "Scalar Replacement of Aggregates");
}
+// Public interface to the ScalarReplAggregates pass
Pass *createScalarReplAggregatesPass() { return new SROA(); }
}
return true;
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include <set>
+namespace llvm {
+
namespace {
Statistic<> NumSimpl("cfgsimplify", "Number of blocks simplified");
RegisterOpt<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG");
}
+// Public interface to the CFGSimplification pass
FunctionPass *createCFGSimplificationPass() {
return new CFGSimplifyPass();
}
return Changed;
}
+
+} // End llvm namespace
#include "llvm/SymbolTable.h"
#include "llvm/Pass.h"
+namespace llvm {
+
static bool StripSymbolTable(SymbolTable &SymTab) {
bool RemovedSymbol = false;
Pass *createFullSymbolStrippingPass() {
return new FullSymbolStripping();
}
+
+} // End llvm namespace
#include "Support/Debug.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumEliminated("tailduplicate",
"Number of unconditional branches eliminated");
RegisterOpt<TailDup> X("tailduplicate", "Tail Duplication");
}
+// Public interface to the Tail Duplication pass
Pass *createTailDuplicationPass() { return new TailDup(); }
/// runOnFunction - Top level algorithm - Loop over each unconditional branch in
return GetValueInBlock(BB, OrigVal, ValueMap, OutValueMap);
}
+
+} // End llvm namespace
#include "llvm/Pass.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumEliminated("tailcallelim", "Number of tail calls removed");
RegisterOpt<TailCallElim> X("tailcallelim", "Tail Call Elimination");
}
+// Public interface to the TailCallElimination pass
FunctionPass *createTailCallEliminationPass() { return new TailCallElim(); }
return MadeChange;
}
+} // End llvm namespace
#include "llvm/Function.h"
#include "llvm/iOther.h"
+namespace llvm {
+
static const Type *getStructOffsetStep(const StructType *STy, uint64_t &Offset,
std::vector<Value*> &Indices,
const TargetData &TD) {
return NextTy;
}
+
+} // End llvm namespace
#include <map>
#include <set>
+namespace llvm {
+
static inline int64_t getConstantValue(const ConstantInt *CPI) {
return (int64_t)cast<ConstantInt>(CPI)->getRawValue();
}
std::vector<Value*> &Offsets,
const TargetData &TD, bool StopEarly = true);
+} // End llvm namespace
+
#endif
#include "llvm/Type.h"
#include <algorithm>
+namespace llvm {
+
// ReplaceInstWithValue - Replace all uses of an instruction (specified by BI)
// with a value, then remove and delete the original instruction.
//
if (NewTI) // If it's a different instruction, replace.
ReplaceInstWithInst(TI, NewTI);
}
+
+} // End llvm namespace
#include "llvm/Support/CFG.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumBroken("break-crit-edges", "Number of blocks inserted");
}
return true;
}
+
+} // End llvm namespace
#include "llvm/Function.h"
#include "ValueMapper.h"
+namespace llvm {
+
// RemapInstruction - Convert the instruction operands from referencing the
// current values into those specified by ValueMap.
//
CloneFunctionInto(NewF, F, ValueMap, Returns);
return NewF;
}
+
+} // End llvm namespace
#include "llvm/Constant.h"
#include "ValueMapper.h"
+namespace llvm {
+
/// CloneModule - Return an exact copy of the specified module. This is not as
/// easy as it might seem because we have to worry about making copies of global
/// variables and functions, and making their (initializers and references,
return New;
}
+
+} // End llvm namespace
#include "llvm/Function.h"
+namespace llvm {
+
//Clones the trace (a vector of basic blocks)
std::vector<BasicBlock *> CloneTrace(const std::vector<BasicBlock*> &origTrace) {
//return new vector of basic blocks
return clonedTrace;
}
+
+} // End llvm namespace
#include "llvm/Type.h"
#include "Support/hash_set"
+namespace llvm {
+
typedef hash_set<PHINode*> PhiSet;
typedef hash_set<PHINode*>::iterator PhiSetIterator;
return XSlot;
}
+
+} // End llvm namespace
#include "llvm/Support/CallSite.h"
#include "llvm/Transforms/Utils/Local.h"
+namespace llvm {
+
bool InlineFunction(CallInst *CI) { return InlineFunction(CallSite(CI)); }
bool InlineFunction(InvokeInst *II) { return InlineFunction(CallSite(II)); }
SimplifyCFG(AfterCallBB);
return true;
}
+
+} // End llvm namespace
#include "llvm/iOther.h"
#include "llvm/Constants.h"
+namespace llvm {
+
// Error - Simple wrapper function to conditionally assign to E and return true.
// This just makes error return conditions a little bit simpler...
//
return false;
}
+} // End llvm namespace
#include "llvm/iOperators.h"
#include "llvm/ConstantHandling.h"
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// Local constant propagation...
//
}
return false;
}
+
+} // End llvm namespace
#include "Support/Statistic.h"
#include "Support/DepthFirstIterator.h"
+namespace llvm {
+
namespace {
Statistic<>
NumInserted("loopsimplify", "Number of pre-header blocks inserted");
const PassInfo *LoopSimplifyID = X.getPassInfo();
Pass *createLoopSimplifyPass() { return new LoopSimplify(); }
-
/// runOnFunction - Run down all loops in the CFG (recursively, but we could do
/// it in any convenient order) inserting preheaders...
///
}
}
}
+
+} // End llvm namespace
#include "llvm/Target/TargetData.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumLowered("lowerallocs", "Number of allocations lowered");
return Changed;
}
+
+} // End llvm namespace
#include "llvm/Constant.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumLowered("lowerinvoke", "Number of invoke & unwinds replaced");
X("lowerinvoke", "Lower invoke and unwind, for unwindless code generators");
}
+// Public Interface To the LowerInvoke pass.
FunctionPass *createLowerInvokePass() { return new LowerInvoke(); }
// doInitialization - Make sure that there is a prototype for abort in the
}
return Changed;
}
+
+} // End llvm namespace
#include "Support/Debug.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumLowered("lowerswitch", "Number of SwitchInst's replaced");
// We are now done with the switch instruction, delete it.
delete SI;
}
+
+} // End llvm namespace
#include "llvm/Target/TargetData.h"
#include "Support/Statistic.h"
+namespace llvm {
+
namespace {
Statistic<> NumPromoted("mem2reg", "Number of alloca's promoted");
Pass *createPromoteMemoryToRegister() {
return new PromotePass();
}
+
+} // End llvm namespace
#include "llvm/Support/CFG.h"
#include "Support/StringExtras.h"
+namespace llvm {
+
/// isAllocaPromotable - Return true if this alloca is legal for promotion.
/// This is true if there are only loads and stores to the alloca...
///
if (Allocas.empty()) return;
PromoteMem2Reg(Allocas, DT, DF, TD).run();
}
+
+} // End llvm namespace
#include <algorithm>
#include <functional>
+namespace llvm {
+
// PropagatePredecessors - This gets "Succ" ready to have the predecessors from
// "BB". This is a little tricky because "Succ" has PHI nodes, which need to
// have extra slots added to them to hold the merge edges from BB's
return Changed;
}
+
+} // End llvm namespace
#include "llvm/iPHINode.h"
#include "llvm/Type.h"
+namespace llvm {
+
static RegisterOpt<UnifyFunctionExitNodes>
X("mergereturn", "Unify function exit nodes");
ReturnBlock = NewRetBlock;
return true;
}
+
+} // End llvm namespace
#include "llvm/Constants.h"
#include "llvm/Instruction.h"
+namespace llvm {
+
Value *MapValue(const Value *V, std::map<const Value*, Value*> &VM) {
Value *&VMSlot = VM[V];
if (VMSlot) return VMSlot; // Does it exist in the map yet?
return 0;
}
+} // End llvm namespace
#define LIB_TRANSFORMS_UTILS_VALUE_MAPPER_H
#include <map>
+
+namespace llvm {
+
class Value;
Value *MapValue(const Value *V, std::map<const Value*, Value*> &VM);
+} // End llvm namespace
+
#endif
#include "Support/STLExtras.h"
#include <algorithm>
+namespace llvm {
+
static RegisterPass<PrintModulePass>
X("printm", "Print module to stderr",PassInfo::Analysis|PassInfo::Optimization);
static RegisterPass<PrintFunctionPass>
}
return *this;
}
+
+} // End llvm namespace
#include "SymbolTableListTraitsImpl.h"
#include <algorithm>
+namespace llvm {
+
// DummyInst - An instance of this class is used to mark the end of the
// instruction list. This is not a real instruction.
//
//
bool BasicBlock::hasConstantReferences() const {
for (use_const_iterator I = use_begin(), E = use_end(); I != E; ++I)
- if (::isa<Constant>((Value*)*I))
+ if (isa<Constant>((Value*)*I))
return true;
return false;
}
return New;
}
+
+} // End llvm namespace
#include "llvm/DerivedTypes.h"
#include <cmath>
+namespace llvm {
+
AnnotationID ConstRules::AID(AnnotationManager::getID("opt::ConstRules",
&ConstRules::find));
static EmptyRules CERules;
return &CERules;
}
+
+} // End llvm namespace
#include "llvm/Constants.h"
#include "llvm/Type.h"
+
+namespace llvm {
+
class PointerType;
//===----------------------------------------------------------------------===//
const Constant *V2);
Constant *ConstantFoldGetElementPtr(const Constant *C,
const std::vector<Constant*> &IdxList);
+
+} // End llvm namespace
+
#endif
#include "llvm/Constants.h"
#include "llvm/Type.h"
+
+namespace llvm {
+
class PointerType;
//===----------------------------------------------------------------------===//
const Constant *V2);
Constant *ConstantFoldGetElementPtr(const Constant *C,
const std::vector<Constant*> &IdxList);
+
+} // End llvm namespace
+
#endif
#include "llvm/Instruction.h"
#include "llvm/ConstantHandling.h"
+namespace llvm {
+
/// Initialize a full (the default) or empty set for the specified type.
///
ConstantRange::ConstantRange(const Type *Ty, bool Full) {
void ConstantRange::dump() const {
print(std::cerr);
}
+
+} // End llvm namespace
#include "Support/StringExtras.h"
#include <algorithm>
+namespace llvm {
+
ConstantBool *ConstantBool::True = new ConstantBool(true);
ConstantBool *ConstantBool::False = new ConstantBool(false);
return NumReplaced;
}
}
+
+} // End llvm namespace
#include "Support/DepthFirstIterator.h"
#include "Support/SetOperations.h"
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// DominatorSet Implementation
//===----------------------------------------------------------------------===//
o << " is:\t" << I->second << "\n";
}
}
+
+} // End llvm namespace
#include "Support/LeakDetector.h"
#include "SymbolTableListTraitsImpl.h"
+namespace llvm {
+
BasicBlock *ilist_traits<BasicBlock>::createNode() {
BasicBlock *Ret = new BasicBlock();
// This should not be garbage monitored.
}
/// getIntrinsicID - This method returns the ID number of the specified
-/// function, or LLVMIntrinsic::not_intrinsic if the function is not an
+/// function, or Intrinsic::not_intrinsic if the function is not an
/// intrinsic, or if the pointer is null. This value is always defined to be
/// zero to allow easy checking for whether a function is intrinsic or not. The
/// particular intrinsic functions which correspond to this value are defined in
std::string name; // The name of the intrinsic
unsigned id; // Its ID number
} alpha_intrinsics[] = {
- { "llvm.alpha.ctlz", LLVMIntrinsic::alpha_ctlz },
- { "llvm.alpha.cttz", LLVMIntrinsic::alpha_cttz },
- { "llvm.alpha.ctpop", LLVMIntrinsic::alpha_ctpop },
- { "llvm.alpha.umulh", LLVMIntrinsic::alpha_umulh },
- { "llvm.alpha.vecop", LLVMIntrinsic::alpha_vecop },
- { "llvm.alpha.pup", LLVMIntrinsic::alpha_pup },
- { "llvm.alpha.bytezap", LLVMIntrinsic::alpha_bytezap },
- { "llvm.alpha.bytemanip", LLVMIntrinsic::alpha_bytemanip },
- { "llvm.alpha.dfp_bop", LLVMIntrinsic::alpha_dfpbop },
- { "llvm.alpha.dfp_uop", LLVMIntrinsic::alpha_dfpuop },
- { "llvm.alpha.unordered", LLVMIntrinsic::alpha_unordered },
- { "llvm.alpha.uqtodfp", LLVMIntrinsic::alpha_uqtodfp },
- { "llvm.alpha.uqtosfp", LLVMIntrinsic::alpha_uqtosfp },
- { "llvm.alpha.dfptosq", LLVMIntrinsic::alpha_dfptosq },
- { "llvm.alpha.sfptosq", LLVMIntrinsic::alpha_sfptosq },
+ { "llvm.alpha.ctlz", Intrinsic::alpha_ctlz },
+ { "llvm.alpha.cttz", Intrinsic::alpha_cttz },
+ { "llvm.alpha.ctpop", Intrinsic::alpha_ctpop },
+ { "llvm.alpha.umulh", Intrinsic::alpha_umulh },
+ { "llvm.alpha.vecop", Intrinsic::alpha_vecop },
+ { "llvm.alpha.pup", Intrinsic::alpha_pup },
+ { "llvm.alpha.bytezap", Intrinsic::alpha_bytezap },
+ { "llvm.alpha.bytemanip", Intrinsic::alpha_bytemanip },
+ { "llvm.alpha.dfp_bop", Intrinsic::alpha_dfpbop },
+ { "llvm.alpha.dfp_uop", Intrinsic::alpha_dfpuop },
+ { "llvm.alpha.unordered", Intrinsic::alpha_unordered },
+ { "llvm.alpha.uqtodfp", Intrinsic::alpha_uqtodfp },
+ { "llvm.alpha.uqtosfp", Intrinsic::alpha_uqtosfp },
+ { "llvm.alpha.dfptosq", Intrinsic::alpha_dfptosq },
+ { "llvm.alpha.sfptosq", Intrinsic::alpha_sfptosq },
};
const unsigned num_alpha_intrinsics =
sizeof(alpha_intrinsics) / sizeof(*alpha_intrinsics);
return alpha_intrinsics[i].id;
break;
case 'l':
- if (getName() == "llvm.longjmp") return LLVMIntrinsic::longjmp;
+ if (getName() == "llvm.longjmp") return Intrinsic::longjmp;
break;
case 's':
- if (getName() == "llvm.setjmp") return LLVMIntrinsic::setjmp;
- if (getName() == "llvm.sigsetjmp") return LLVMIntrinsic::sigsetjmp;
- if (getName() == "llvm.siglongjmp") return LLVMIntrinsic::siglongjmp;
+ if (getName() == "llvm.setjmp") return Intrinsic::setjmp;
+ if (getName() == "llvm.sigsetjmp") return Intrinsic::sigsetjmp;
+ if (getName() == "llvm.siglongjmp") return Intrinsic::siglongjmp;
break;
case 'v':
- if (getName() == "llvm.va_copy") return LLVMIntrinsic::va_copy;
- if (getName() == "llvm.va_end") return LLVMIntrinsic::va_end;
- if (getName() == "llvm.va_start") return LLVMIntrinsic::va_start;
+ if (getName() == "llvm.va_copy") return Intrinsic::va_copy;
+ if (getName() == "llvm.va_end") return Intrinsic::va_end;
+ if (getName() == "llvm.va_start") return Intrinsic::va_start;
break;
}
// The "llvm." namespace is reserved!
Value::setName(name);
if (P && getName() != "") P->getSymbolTable().insert(this);
}
+
+} // End llvm namespace
#include "llvm/Type.h"
#include <algorithm> // find
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// TerminatorInst Class
//===----------------------------------------------------------------------===//
}
return Removed;
}
+
+} // End llvm namespace
#include "llvm/Type.h"
#include "Support/LeakDetector.h"
+namespace llvm {
+
Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name,
Instruction *InsertBefore)
: User(ty, Value::InstructionVal, Name) {
return false;
}
}
+
+} // End llvm namespace
#include "llvm/Value.h"
#include <set>
+namespace llvm {
+
// Lazily allocate set so that release build doesn't have to do anything.
static std::set<const void*> *Objects = 0;
static std::set<const Value*> *LLVMObjects = 0;
Objects = 0; LLVMObjects = 0;
}
}
+
+} // End llvm namespace
#include "llvm/iOther.h"
#include "llvm/Constants.h"
+namespace llvm {
+
// Error - Simple wrapper function to conditionally assign to E and return true.
// This just makes error return conditions a little bit simpler...
//
return false;
}
+} // End llvm namespace
#include "llvm/Type.h"
#include "Support/StringExtras.h"
+namespace llvm {
+
static char HexDigit(int V) {
return V < 10 ? V+'0' : V+'A'-10;
}
FoundNames.insert(I->getName()); // Otherwise, keep track of name
}
+} // End llvm namespace
#include <cstdarg>
#include <map>
+namespace llvm {
+
Function *ilist_traits<Function>::createNode() {
FunctionType *FTy =
FunctionType::get(Type::VoidTy, std::vector<const Type*>(), false);
delete Ref;
}
}
+
+} // End llvm namespace
#include "llvm/ModuleProvider.h"
#include "llvm/Module.h"
+namespace llvm {
+
/// ctor - always have a valid Module
///
ModuleProvider::ModuleProvider() : TheModule(0) { }
return TheModule;
}
+
+} // End llvm namespace
#include "Support/TypeInfo.h"
#include <set>
+namespace llvm {
+
// IncludeFile - Stub function used to help linking out.
IncludeFile::IncludeFile(void*) {}
E = PassInfoMap->end(); I != E; ++I)
passEnumerate(I->second);
}
+
+} // End llvm namespace
#include "Support/Timer.h"
#include <algorithm>
#include <iostream>
+
+namespace llvm {
+
class Annotable;
//===----------------------------------------------------------------------===//
return Changed;
}
+} // End llvm namespace
+
#endif
#include "Support/STLExtras.h"
#include <algorithm>
+namespace llvm {
+
#if 0
#define SC_DEBUG(X) std::cerr << X
#else
SC_DEBUG("]\n");
return (int)DestSlot;
}
+
+} // End llvm namespace
#include "Support/StringExtras.h"
#include <algorithm>
+namespace llvm {
+
#define DEBUG_SYMBOL_TABLE 0
#define DEBUG_ABSTYPE 0
std::cout << "Symbol table dump:\n";
for_each(begin(), end(), DumpPlane);
}
+
+} // End llvm namespace
#include "llvm/SymbolTableListTraits.h"
#include "llvm/SymbolTable.h"
+namespace llvm {
+
template<typename ValueSubClass, typename ItemParentClass,typename SymTabClass,
typename SubClass>
void SymbolTableListTraits<ValueSubClass,ItemParentClass,SymTabClass,SubClass>
}
}
+} // End llvm namespace
+
#endif
#include "Support/STLExtras.h"
#include <algorithm>
+namespace llvm {
+
// DEBUG_MERGE_TYPES - Enable this #define to see how and when derived types are
// created and later destroyed, all in an effort to make sure that there is only
// a single canonical version of a type.
refineAbstractType(AbsTy, AbsTy);
}
+} // End llvm namespace
#include "Support/LeakDetector.h"
#include <algorithm>
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// Value Class
//===----------------------------------------------------------------------===//
setOperand(i, To); // Fix it now...
}
}
+
+} // End llvm namespace
#include "Support/STLExtras.h"
#include <algorithm>
+namespace llvm {
+
namespace { // Anonymous namespace for class
struct Verifier : public FunctionPass, InstVisitor<Verifier> {
void visitReturnInst(ReturnInst &RI);
void visitUserOp1(Instruction &I);
void visitUserOp2(Instruction &I) { visitUserOp1(I); }
- void visitIntrinsicFunctionCall(LLVMIntrinsic::ID ID, CallInst &CI);
+ void visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI);
// CheckFailed - A check failed, so print out the condition and the message
// that failed. This provides a nice place to put a breakpoint if you want
};
RegisterPass<Verifier> X("verify", "Module Verifier");
-}
// Assert - We know that cond should be true, if not print an error message.
#define Assert(C, M) \
CI.getOperand(i+1), FTy->getParamType(i));
if (Function *F = CI.getCalledFunction())
- if (LLVMIntrinsic::ID ID = (LLVMIntrinsic::ID)F->getIntrinsicID())
+ if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID())
visitIntrinsicFunctionCall(ID, CI);
visitInstruction(CI);
}
/// visitIntrinsicFunction - Allow intrinsics to be verified in different ways.
-void Verifier::visitIntrinsicFunctionCall(LLVMIntrinsic::ID ID, CallInst &CI) {
+void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
Function *IF = CI.getCalledFunction();
const FunctionType *FT = IF->getFunctionType();
Assert1(IF->isExternal(), "Intrinsic functions should never be defined!", IF);
// FIXME: this should check the return type of each intrinsic as well, also
// arguments!
switch (ID) {
- case LLVMIntrinsic::va_start:
+ case Intrinsic::va_start:
Assert1(CI.getParent()->getParent()->getFunctionType()->isVarArg(),
"llvm.va_start intrinsic may only occur in function with variable"
" args!", &CI);
NumArgs = 0;
break;
- case LLVMIntrinsic::va_end: NumArgs = 1; break;
- case LLVMIntrinsic::va_copy: NumArgs = 1; break;
+ case Intrinsic::va_end: NumArgs = 1; break;
+ case Intrinsic::va_copy: NumArgs = 1; break;
- case LLVMIntrinsic::setjmp: NumArgs = 1; break;
- case LLVMIntrinsic::longjmp: NumArgs = 2; break;
- case LLVMIntrinsic::sigsetjmp: NumArgs = 2; break;
- case LLVMIntrinsic::siglongjmp: NumArgs = 2; break;
+ case Intrinsic::setjmp: NumArgs = 1; break;
+ case Intrinsic::longjmp: NumArgs = 2; break;
+ case Intrinsic::sigsetjmp: NumArgs = 2; break;
+ case Intrinsic::siglongjmp: NumArgs = 2; break;
- case LLVMIntrinsic::alpha_ctlz: NumArgs = 1; break;
- case LLVMIntrinsic::alpha_cttz: NumArgs = 1; break;
- case LLVMIntrinsic::alpha_ctpop: NumArgs = 1; break;
- case LLVMIntrinsic::alpha_umulh: NumArgs = 2; break;
- case LLVMIntrinsic::alpha_vecop: NumArgs = 4; break;
- case LLVMIntrinsic::alpha_pup: NumArgs = 3; break;
- case LLVMIntrinsic::alpha_bytezap: NumArgs = 2; break;
- case LLVMIntrinsic::alpha_bytemanip: NumArgs = 3; break;
- case LLVMIntrinsic::alpha_dfpbop: NumArgs = 3; break;
- case LLVMIntrinsic::alpha_dfpuop: NumArgs = 2; break;
- case LLVMIntrinsic::alpha_unordered: NumArgs = 2; break;
- case LLVMIntrinsic::alpha_uqtodfp: NumArgs = 2; break;
- case LLVMIntrinsic::alpha_uqtosfp: NumArgs = 2; break;
- case LLVMIntrinsic::alpha_dfptosq: NumArgs = 2; break;
- case LLVMIntrinsic::alpha_sfptosq: NumArgs = 2; break;
-
- case LLVMIntrinsic::not_intrinsic:
+ case Intrinsic::alpha_ctlz: NumArgs = 1; break;
+ case Intrinsic::alpha_cttz: NumArgs = 1; break;
+ case Intrinsic::alpha_ctpop: NumArgs = 1; break;
+ case Intrinsic::alpha_umulh: NumArgs = 2; break;
+ case Intrinsic::alpha_vecop: NumArgs = 4; break;
+ case Intrinsic::alpha_pup: NumArgs = 3; break;
+ case Intrinsic::alpha_bytezap: NumArgs = 2; break;
+ case Intrinsic::alpha_bytemanip: NumArgs = 3; break;
+ case Intrinsic::alpha_dfpbop: NumArgs = 3; break;
+ case Intrinsic::alpha_dfpuop: NumArgs = 2; break;
+ case Intrinsic::alpha_unordered: NumArgs = 2; break;
+ case Intrinsic::alpha_uqtodfp: NumArgs = 2; break;
+ case Intrinsic::alpha_uqtosfp: NumArgs = 2; break;
+ case Intrinsic::alpha_dfptosq: NumArgs = 2; break;
+ case Intrinsic::alpha_sfptosq: NumArgs = 2; break;
+
+ case Intrinsic::not_intrinsic:
assert(0 && "Invalid intrinsic!"); NumArgs = 0; break;
}
"Illegal # arguments for intrinsic function!", IF);
}
+} // End anonymous namespace
//===----------------------------------------------------------------------===//
// Implement the public interfaces to this file...
PM.run((Module&)M);
return V->Broken;
}
+
+} // End llvm namespace
#include "llvm/BasicBlock.h"
#include "llvm/Type.h"
+namespace llvm {
+
BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond,
Instruction *InsertBefore)
: TerminatorInst(Instruction::Br, InsertBefore) {
Operands.push_back(Use(BI.Operands[2], this));
}
}
+
+} // End llvm namespace
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// CallInst Implementation
//===----------------------------------------------------------------------===//
return 0;
}
+} // End llvm namespace
+
#include "llvm/Support/CallSite.h"
+namespace llvm {
+
Function *CallSite::getCalledFunction() const {
Value *Callee = getCalledValue();
if (Function *F = dyn_cast<Function>(Callee))
return 0;
}
+} // End llvm namespace
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
+using namespace llvm;
+
AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
const std::string &Name, Instruction *InsertBef)
: Instruction(PointerType::get(Ty), iTy, Name, InsertBef) {
#include "llvm/Constants.h"
#include "llvm/BasicBlock.h"
+namespace llvm {
+
//===----------------------------------------------------------------------===//
// BinaryOperator Class
//===----------------------------------------------------------------------===//
case SetLE: return SetGE;
}
}
+
+} // End llvm namespace
#include "llvm/iTerminators.h"
#include "llvm/BasicBlock.h"
+namespace llvm {
+
SwitchInst::SwitchInst(Value *V, BasicBlock *DefaultDest,
Instruction *InsertBefore)
: TerminatorInst(Instruction::Switch, InsertBefore) {
assert(idx*2 < Operands.size() && "Successor index out of range!!!");
Operands.erase(Operands.begin()+idx*2, Operands.begin()+(idx+1)*2);
}
+
+} // End llvm namespace
#include "llvm/Instructions.h"
#include "llvm/Bytecode/Writer.h"
+using namespace llvm;
+
int main() {
// Create the "module" or "program" or "translation unit" to hold the
// function
#include "llvm/Instructions.h"
#include "llvm/Bytecode/Writer.h"
+using namespace llvm;
+
int main() {
// Create the "module" or "program" or "translation unit" to hold the
// function
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Support/InstIterator.h"
+using namespace llvm;
+
namespace {
struct InstForestHelper : public FunctionPass {
Function *F;
#include "llvm/Analysis/CallGraph.h"
#include <fstream>
+namespace llvm {
+
template<typename GraphType>
static void WriteGraphToFile(std::ostream &O, const std::string &GraphName,
const GraphType >) {
RegisterAnalysis<CallGraphPrinter> P2("print-callgraph",
"Print Call Graph to 'dot' file");
};
+
+} // End llvm namespace
#include "llvm/Support/CFG.h"
#include "Support/SCCIterator.h"
+namespace llvm {
+
namespace {
struct CFGSCC : public FunctionPass {
bool runOnFunction(Function& func);
return true;
}
+
+} // End llvm namespace
#include "Support/Timer.h"
#include <algorithm>
+using namespace llvm;
struct ModulePassPrinter : public Pass {
const PassInfo *PassToPrint;
#include "Support/FileUtilities.h"
#include <memory>
+using namespace llvm;
+
// Anonymous namespace to define command line options for debugging.
//
namespace {
"(for miscompilation detection)"));
}
+namespace llvm {
+
/// getPassesString - Turn a list of passes into a string which indicates the
/// command line options that must be passed to add the passes.
///
}
std::cout << std::flush;
}
+
+} // End llvm namespace
#include <vector>
#include <string>
+namespace llvm {
+
class PassInfo;
class Module;
class Function;
//
void DeleteFunctionBody(Function *F);
+} // End llvm namespace
+
#endif
#include <algorithm>
#include <set>
+namespace llvm {
+
extern cl::list<std::string> InputArgv;
class ReduceMisCodegenFunctions : public ListReducer<Function*> {
return false;
}
+
+} // End llvm namespace
#include <fstream>
#include <set>
+namespace llvm {
+
class DebugCrashes : public ListReducer<const PassInfo*> {
BugDriver &BD;
public:
return false;
}
+
+} // End llvm namespace
#include <fstream>
#include <iostream>
+using namespace llvm;
+
namespace {
// OutputType - Allow the user to specify the way code should be run, to test
// for miscompilation.
"into executing programs"));
}
+namespace llvm {
+
// Anything specified after the --args option are taken as arguments to the
// program being debugged.
cl::list<std::string>
bool BugDriver::isExecutingJIT() {
return InterpreterSel == RunJIT;
}
+
+} // End llvm namespace
#include "llvm/Target/TargetData.h"
#include "Support/CommandLine.h"
+
+namespace llvm {
+
bool DisableSimplifyCFG = false;
+} // End llvm namespace
+
+using namespace llvm;
+
namespace {
cl::opt<bool>
NoADCE("disable-adce",
cl::desc("Do not use the -simplifycfg pass to reduce testcases"));
}
+namespace llvm {
+
/// deleteInstructionFromProgram - This method clones the current Program and
/// deletes the specified instruction from the cloned module. It then runs a
/// series of cleanup passes (ADCE and SimplifyCFG) to eliminate any code which
}
return M;
}
+
+} // End llvm namespace
#include <vector>
+namespace llvm {
+
template<typename ElTy>
struct ListReducer {
enum TestResult {
}
};
+} // End llvm namespace
+
#endif
#include "llvm/Transforms/Utils/Linker.h"
#include "Support/FileUtilities.h"
+namespace llvm {
+
class ReduceMiscompilingPasses : public ListReducer<const PassInfo*> {
BugDriver &BD;
public:
return false;
}
+
+} // End llvm namespace
#include <sys/types.h>
#include <sys/wait.h>
+namespace llvm {
+
/// writeProgramToFile - This writes the current "Program" to the named bytecode
/// file. If an error occurs, true is returned.
///
// Was the child successful?
return !ExitedOK;
}
+
+} // End llvm namespace
#include "llvm/Pass.h"
#include "llvm/Support/InstVisitor.h"
+using namespace llvm;
+
namespace {
/// CrashOnCalls - This pass is used to test bugpoint. It intentionally
/// crashes on any call instructions.
#include <iostream>
#include <fstream>
+namespace llvm {
+
//===---------------------------------------------------------------------===//
// LLI Implementation of AbstractIntepreter interface
//
Message = "Found gcc: " + GCCPath + "\n";
return new GCC(GCCPath);
}
+
+} // End llvm namespace
#include "Support/SystemUtils.h"
#include <vector>
+namespace llvm {
+
class CBE;
class LLC;
int OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile);
};
+} // End llvm namespace
+
#endif
#include "Config/unistd.h"
#include <sys/resource.h>
+using namespace llvm;
+
static cl::list<std::string>
InputFilenames(cl::Positional, cl::OneOrMore,
cl::desc("<input llvm ll/bc files>"));
#include "Support/CommandLine.h"
#include <memory>
+using namespace llvm;
+
// InputFilename - The filename to read from.
static cl::opt<std::string>
InputFilename(cl::Positional, cl::desc("<input bytecode file>"),
#include <memory>
#include <fstream>
+using namespace llvm;
+
namespace {
cl::opt<std::string>
InputFilename(cl::Positional,cl::desc("<input llvm assembly>"),cl::init("-"));
#include "Support/SystemUtils.h"
#include "Support/CommandLine.h"
+using namespace llvm;
+
namespace {
cl::opt<bool>
DisableInline("disable-inlining", cl::desc("Do not run the inliner pass"));
}
+namespace llvm {
/// GenerateBytecode - generates a bytecode file from the specified module.
///
// Run the compiler to assembly and link together the program.
return ExecWait(&(cmd[0]), clean_env);
}
+
+} // End llvm namespace
#include <memory>
#include <set>
+namespace llvm {
+
/// FindLib - Try to convert Filename into the name of a file that we can open,
/// if it does not already name a file we can open, by first trying to open
/// Filename, then libFilename.<suffix> for each of a set of several common
return false;
}
+
+} // End llvm namespace
#include <fstream>
#include <memory>
+using namespace llvm;
+
namespace {
cl::list<std::string>
InputFilenames(cl::Positional, cl::desc("<input bytecode files>"),
CO5("eh-frame-hdr", cl::Hidden, cl::desc("Compatibility option: ignored"));
}
+namespace llvm {
+
//
// Function: PrintAndReturn ()
//
return;
}
+} // End llvm namespace
int main(int argc, char **argv, char **envp) {
cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n");
#include <set>
#include <ostream>
+namespace llvm {
+
int
PrintAndReturn (const char *progname,
const std::string &Message,
const std::vector<std::string> & Files,
bool Verbose);
+} // End llvm namespace
#include <memory>
#include <fstream>
+using namespace llvm;
+
// General options for llc. Other pass-specific options are specified
// within the corresponding llc passes, and target-specific options
// and back-end code generation options are specified with the target machine.
#include "Support/Debug.h"
#include "Support/SystemUtils.h"
+using namespace llvm;
+
namespace {
cl::opt<std::string>
InputFile(cl::desc("<input bytecode>"), cl::Positional, cl::init("-"));
#include <unistd.h>
#include <sys/mman.h>
+using namespace llvm;
+
using std::string;
using std::vector;
using std::cout;
//Option to generate symbol table or not
//running llvm-ar -s is the same as ranlib
-cl::opt<bool> SymbolTable ("s", cl::desc("Generate an archive symbol table"));
+cl::opt<bool> SymbolTableOption ("s", cl::desc("Generate an archive symbol table"));
//Archive name
cl::opt<string> Archive (cl::Positional, cl::desc("<archive file>"),
ArchiveFile << ARMAG;
//If the '-s' option was specified, generate symbol table.
- if(SymbolTable) {
+ if(SymbolTableOption) {
cout << "Symbol Table Start: " << ArchiveFile.tellp() << "\n";
if(!WriteSymbolTable(ArchiveFile)) {
std::cerr << "Error creating symbol table. Exiting program.";
#include <fstream>
#include <memory>
+using namespace llvm;
+
static cl::opt<std::string>
InputFilename(cl::Positional, cl::desc("<input .llvm file>"), cl::init("-"));
// OutputMode - The different orderings to print basic blocks in...
enum OutputMode {
- llvm = 0, // Generate LLVM assembly (the default)
+ LLVM = 0, // Generate LLVM assembly (the default)
c, // Generate C code
};
+using namespace llvm;
+
static cl::opt<std::string>
InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
static cl::opt<enum OutputMode>
WriteMode(cl::desc("Specify the output format:"),
- cl::values(clEnumVal(llvm, "Output LLVM assembly"),
- clEnumVal(c , "Output C code for program"),
+ cl::values(clEnumVal(LLVM, "Output LLVM assembly"),
+ clEnumVal(c, "Output C code for program"),
0));
int main(int argc, char **argv) {
PassManager Passes;
switch (WriteMode) {
- case llvm: // Output LLVM assembly
+ case LLVM: // Output LLVM assembly
Passes.add(new PrintModulePass(Out));
break;
case c: // Convert LLVM to C
#include "Support/CommandLine.h"
#include <memory>
+using namespace llvm;
+
// InputFilename - The filename to read from.
static cl::opt<std::string>
InputFilename(cl::Positional, cl::desc("<input bytecode file>"),
#include <sys/types.h> // For FileExists
#include <sys/stat.h>
+using namespace llvm;
+
static cl::list<std::string>
InputFilenames(cl::Positional, cl::OneOrMore,
cl::desc("<input bytecode files>"));
#include "Support/CommandLine.h"
#include <cctype>
+using namespace llvm;
+
namespace {
enum OutputFormatTy { bsd, sysv, posix };
cl::opt<OutputFormatTy>
#include <fcntl.h>
#include <stdio.h>
+using namespace llvm;
+
enum ProfilingType {
ArgumentInfo = 1, // The command line argument block
FunctionInfo = 2, // Function profiling information
#include <vector>
#include <string>
#include <utility>
+
+namespace llvm {
+
class Module;
class Function;
class BasicBlock;
void getBlockCounts(std::vector<std::pair<BasicBlock*, unsigned> > &Counts);
};
+} // End llvm namespace
+
#endif
#include <map>
#include <set>
+using namespace llvm;
+
namespace {
cl::opt<std::string>
BytecodeFile(cl::Positional, cl::desc("<program bytecode file>"),
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Support/InstIterator.h"
+using namespace llvm;
+
namespace {
struct InstForestHelper : public FunctionPass {
Function *F;
#include "llvm/Analysis/CallGraph.h"
#include <fstream>
+namespace llvm {
+
template<typename GraphType>
static void WriteGraphToFile(std::ostream &O, const std::string &GraphName,
const GraphType >) {
RegisterAnalysis<CallGraphPrinter> P2("print-callgraph",
"Print Call Graph to 'dot' file");
};
+
+} // End llvm namespace
#include "llvm/Support/CFG.h"
#include "Support/SCCIterator.h"
+namespace llvm {
+
namespace {
struct CFGSCC : public FunctionPass {
bool runOnFunction(Function& func);
return true;
}
+
+} // End llvm namespace
#include <memory>
#include <algorithm>
+using namespace llvm;
// The OptimizationList is automatically populated with registered Passes by the
// PassNameParser.
#include "Record.h"
#include "Support/Debug.h"
+namespace llvm {
+
void CodeEmitterGen::run(std::ostream &o) {
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
<< " }\n"
<< " return Value;\n"
<< "}\n";
+
+ EmitSourceFileTail(o);
}
+
+} // End llvm namespace
#include "TableGenBackend.h"
+namespace llvm {
+
class CodeEmitterGen : public TableGenBackend {
RecordKeeper &Records;
public:
void emitGetValueBit(std::ostream &o, const std::string &Namespace);
};
+} // End llvm namespace
+
#endif
#include "CodeGenWrappers.h"
#include "Record.h"
+namespace llvm {
+
/// getValueType - Return the MCV::ValueType that the specified TableGen record
/// corresponds to.
MVT::ValueType getValueType(Record *Rec) {
Record *CodeGenTarget::getInstructionSet() const {
return TargetRec->getValueAsDef("InstructionSet");
}
+
+} // End llvm namespace
#include <iosfwd>
#include <string>
#include <vector>
+
+namespace llvm {
+
class Record;
class RecordKeeper;
// CodeGenInstructionSet *getInstructionSet -
};
+} // End llvm namespace
+
#endif
#include "CodeGenWrappers.h"
#include "Record.h"
+namespace llvm {
+
/// getValueType - Return the MCV::ValueType that the specified TableGen record
/// corresponds to.
MVT::ValueType getValueType(Record *Rec) {
Record *CodeGenTarget::getInstructionSet() const {
return TargetRec->getValueAsDef("InstructionSet");
}
+
+} // End llvm namespace
#include <iosfwd>
#include <string>
#include <vector>
+
+namespace llvm {
+
class Record;
class RecordKeeper;
// CodeGenInstructionSet *getInstructionSet -
};
+} // End llvm namespace
+
#endif
%{
#include "Record.h"
-typedef std::pair<Record*, std::vector<Init*>*> SubClassRefTy;
+typedef std::pair<llvm::Record*, std::vector<llvm::Init*>*> SubClassRefTy;
#include "FileParser.h"
+int Fileparse();
+
+namespace llvm {
+
// Global variable recording the location of the include directory
std::string IncludeDirectory;
}
-int Fileparse();
//
// Function: ParseFile()
return 0;
}
+} // End llvm namespace
+
+using namespace llvm;
+
%}
Comment \/\/.*
int yyerror(const char *ErrorMsg);
int yylex();
+
+namespace llvm {
+
extern int Filelineno;
static Record *CurRec = 0;
addSuperClass(SC);
}
+} // End llvm namespace
+
+using namespace llvm;
%}
%union {
- std::string *StrVal;
- int IntVal;
- RecTy *Ty;
- Init *Initializer;
- std::vector<Init*> *FieldList;
- std::vector<unsigned>*BitList;
- Record *Rec;
- SubClassRefTy *SubClassRef;
- std::vector<SubClassRefTy> *SubClassList;
- std::vector<std::pair<Init*, std::string> > *DagValueList;
+ std::string* StrVal;
+ int IntVal;
+ llvm::RecTy* Ty;
+ llvm::Init* Initializer;
+ std::vector<llvm::Init*>* FieldList;
+ std::vector<unsigned>* BitList;
+ llvm::Record* Rec;
+ SubClassRefTy* SubClassRef;
+ std::vector<SubClassRefTy>* SubClassList;
+ std::vector<std::pair<llvm::Init*, std::string> >* DagValueList;
};
%token INT BIT STRING BITS LIST CODE DAG CLASS DEF FIELD LET IN
%type <StrVal> Declaration OptID OptVarName
%start File
+
%%
ClassID : ID {
#include "CodeGenWrappers.h"
#include "Record.h"
+namespace llvm {
+
// runEnums - Print out enum values for all of the instructions.
void InstrInfoEmitter::runEnums(std::ostream &OS) {
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
OS << " };\n";
if (!Namespace.empty())
OS << "}\n";
+ EmitSourceFileTail(OS);
}
void InstrInfoEmitter::printDefList(ListInit *LI, const std::string &Name,
if (Instructions[i] != PHI)
emitRecord(Instructions[i], i+1, InstrInfo, OS);
OS << "};\n";
+ EmitSourceFileTail(OS);
}
void InstrInfoEmitter::emitRecord(Record *R, unsigned Num, Record *InstrInfo,
std::cerr << "Unhandled initializer: " << *Val << "\n";
throw "In record '" + R->getName() + "' for TSFlag emission.";
}
+
+} // End llvm namespace
#define INSTRINFO_EMITTER_H
#include "TableGenBackend.h"
+
+namespace llvm {
+
class StringInit;
class IntInit;
class ListInit;
std::ostream &OS);
};
+} // End llvm namespace
+
#endif
#include "Support/StringExtras.h"
#include <set>
+namespace llvm {
+
NodeType::ArgResultTypes NodeType::Translate(Record *R) {
const std::string &Name = R->getName();
if (Name == "DNVT_any") return Any;
CalculateComputableValues();
+ OS << "#include \"llvm/CodeGen/MachineInstrBuilder.h\"\n";
+
EmitSourceFileHeader("Instruction Selector for the " + Target.getName() +
" target", OS);
- OS << "#include \"llvm/CodeGen/MachineInstrBuilder.h\"\n";
// Output the slot number enums...
OS << "\nenum { // Slot numbers...\n"
<< " }\n\n N->addValue(Val); // Do not ever recalculate this\n"
<< " return Val;\n}\n\n";
}
+ EmitSourceFileTail(OS);
}
+} // End llvm namespace
#include <map>
#include <cassert>
+namespace llvm {
+
class DagInit;
class Init;
class InstrSelectorEmitter;
bool PrintArg, std::ostream &OS);
};
+} // End llvm namespace
+
#endif
// Type implementations
//===----------------------------------------------------------------------===//
+namespace llvm {
+
void RecTy::dump() const { print(std::cerr); }
Init *BitRecTy::convertValue(BitsInit *BI) {
return Defs;
}
+
+} // End llvm namespace
#include <iostream>
#include <cassert>
+namespace llvm {
+
// RecTy subclasses...
class BitRecTy;
class BitsRecTy;
extern RecordKeeper Records;
+} // End llvm namespace
+
#endif
#include "Support/StringExtras.h"
#include <set>
+namespace llvm {
+
// runEnums - Print out enum values for all of the registers.
void RegisterInfoEmitter::runEnums(std::ostream &OS) {
std::vector<Record*> Registers = Records.getAllDerivedDefinitions("Register");
OS << " };\n";
if (!Namespace.empty())
OS << "}\n";
+ EmitSourceFileTail(OS);
}
void RegisterInfoEmitter::runHeader(std::ostream &OS) {
OS << " extern TargetRegisterClass *" << Name << "RegisterClass;\n";
}
OS << "} // end of namespace " << TargetName << "\n\n";
+ EmitSourceFileTail(OS);
}
// RegisterInfoEmitter::run - Main register file description emitter.
for (unsigned i = 0, e = CSR.size(); i != e; ++i)
OS << getQualifiedName(CSR[i]) << ", ";
OS << " 0\n };\n return CalleeSaveRegs;\n}\n\n";
+ EmitSourceFileTail(OS);
}
+
+} // End llvm namespace
#include "TableGenBackend.h"
+namespace llvm {
+
class RegisterInfoEmitter : public TableGenBackend {
RecordKeeper &Records;
public:
void runEnums(std::ostream &o);
};
+} // End llvm namespace
+
#endif
#include <cstdio>
#include <fstream>
+namespace llvm {
+
enum ActionType {
PrintRecords,
GenEmitter,
}
}
+} // End llvm namespace
+
+using namespace llvm;
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv);
InstrSelectorEmitter(Records).run(*Out);
break;
case PrintEnums:
+ {
std::vector<Record*> Recs = Records.getAllDerivedDefinitions(Class);
for (unsigned i = 0, e = Recs.size(); i != e; ++i)
*Out << Recs[i] << ", ";
*Out << "\n";
break;
}
+ default:
+ assert(1 && "Invalid Action");
+ return 1;
+ }
} catch (const std::string &Error) {
std::cerr << Error << "\n";
if (Out != &std::cout) {
#include "Record.h"
#include <iostream>
+namespace llvm {
+
void TableGenBackend::EmitSourceFileHeader(const std::string &Desc,
std::ostream &OS) const {
OS << "//===- TableGen'erated file -------------------------------------*-"
" C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate"
"d file, do not edit!\n//\n//===------------------------------------"
- "----------------------------------===//\n\n";
+ "----------------------------------===//\n\nnamespace llvm {\n\n";
+}
+
+void TableGenBackend::EmitSourceFileTail( std::ostream& OS ) const {
+ OS << "} // End llvm namespace \n";
}
/// getQualifiedName - Return the name of the specified record, with a
return Namespace + "::" + R->getName();
}
+} // End llvm namespace
#include <string>
#include <iosfwd>
+
+namespace llvm {
+
class Record;
class RecordKeeper;
/// ostream.
void EmitSourceFileHeader(const std::string &Desc, std::ostream &OS) const;
+ /// EmitSourceFileTail - Output an LLVm styelf ile tail to the specified
+ /// ostream.
+ void EmitSourceFileTail( std::ostream& OS ) const;
+
/// getQualifiedName - Return the name of the specified record, with a
/// namespace qualifier if the record contains one.
std::string getQualifiedName(Record *R) const;
};
+} // End llvm namespace
+
#endif