Create a new #include "Support/..." directory structure to move things
from "llvm/Support/..." that are not llvm dependant.
Move files and fix #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1400 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/docs/CommandLine.html b/docs/CommandLine.html
index 1660639..f12525b 100644
--- a/docs/CommandLine.html
+++ b/docs/CommandLine.html
@@ -64,7 +64,7 @@
To start out, you need to include the CommandLine header file into your program:<p>
<pre>
- #include "llvm/Support/CommandLine.h"
+ #include "Support/CommandLine.h"
</pre><p>
Additionally, you need to add this as the first line of your main program:<p>
@@ -353,7 +353,7 @@
<address><a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
<!-- Created: Tue Jan 23 15:19:28 CST 2001 -->
<!-- hhmts start -->
-Last modified: Mon Jul 23 17:33:57 CDT 2001
+Last modified: Mon Nov 26 17:09:39 CST 2001
<!-- hhmts end -->
</font>
</body></html>
diff --git a/include/Support/CommandLine.h b/include/Support/CommandLine.h
new file mode 100644
index 0000000..84a3bc9
--- /dev/null
+++ b/include/Support/CommandLine.h
@@ -0,0 +1,399 @@
+//===- Support/CommandLine.h - Flexible Command line parser ------*- C++ -*--=//
+//
+// This class implements a command line argument processor that is useful when
+// creating a tool. It provides a simple, minimalistic interface that is easily
+// extensible and supports nonlocal (library) command line options.
+//
+// Note that rather than trying to figure out what this code does, you could try
+// reading the library documentation located in docs/CommandLine.html
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_COMMANDLINE_H
+#define LLVM_SUPPORT_COMMANDLINE_H
+
+#include <string>
+#include <vector>
+#include <utility>
+#include <stdarg.h>
+
+namespace cl { // Short namespace to make usage concise
+
+//===----------------------------------------------------------------------===//
+// ParseCommandLineOptions - Minimalistic command line option processing entry
+//
+void cl::ParseCommandLineOptions(int &argc, char **argv,
+ const char *Overview = 0,
+ int Flags = 0);
+
+// ParserOptions - This set of option is use to control global behavior of the
+// command line processor.
+//
+enum ParserOptions {
+ // DisableSingleLetterArgGrouping - With this option enabled, multiple letter
+ // options are allowed to bunch together with only a single hyphen for the
+ // whole group. This allows emulation of the behavior that ls uses for
+ // example: ls -la === ls -l -a Providing this option, disables this.
+ //
+ DisableSingleLetterArgGrouping = 0x0001,
+
+ // EnableSingleLetterArgValue - This option allows arguments that are
+ // otherwise unrecognized to match single letter flags that take a value.
+ // This is useful for cases like a linker, where options are typically of the
+ // form '-lfoo' or '-L../../include' where -l or -L are the actual flags.
+ //
+ EnableSingleLetterArgValue = 0x0002,
+};
+
+
+//===----------------------------------------------------------------------===//
+// Global flags permitted to be passed to command line arguments
+
+enum FlagsOptions {
+ NoFlags = 0x00, // Marker to make explicit that we have no flags
+ Default = 0x00, // Equally, marker to use the default flags
+
+ GlobalsMask = 0x80,
+};
+
+enum NumOccurances { // Flags for the number of occurances allowed...
+ Optional = 0x01, // Zero or One occurance
+ ZeroOrMore = 0x02, // Zero or more occurances allowed
+ Required = 0x03, // One occurance required
+ OneOrMore = 0x04, // One or more occurances required
+
+ // ConsumeAfter - Marker for a null ("") flag that can be used to indicate
+ // that anything that matches the null marker starts a sequence of options
+ // that all get sent to the null marker. Thus, for example, all arguments
+ // to LLI are processed until a filename is found. Once a filename is found,
+ // all of the succeeding arguments are passed, unprocessed, to the null flag.
+ //
+ ConsumeAfter = 0x05,
+
+ OccurancesMask = 0x07,
+};
+
+enum ValueExpected { // Is a value required for the option?
+ ValueOptional = 0x08, // The value can oppear... or not
+ ValueRequired = 0x10, // The value is required to appear!
+ ValueDisallowed = 0x18, // A value may not be specified (for flags)
+ ValueMask = 0x18,
+};
+
+enum OptionHidden { // Control whether -help shows this option
+ NotHidden = 0x20, // Option included in --help & --help-hidden
+ Hidden = 0x40, // -help doesn't, but --help-hidden does
+ ReallyHidden = 0x60, // Neither --help nor --help-hidden show this arg
+ HiddenMask = 0x60,
+};
+
+
+//===----------------------------------------------------------------------===//
+// Option Base class
+//
+class Alias;
+class Option {
+ friend void cl::ParseCommandLineOptions(int &, char **, const char *, int);
+ friend class Alias;
+
+ // handleOccurances - Overriden by subclasses to handle the value passed into
+ // an argument. Should return true if there was an error processing the
+ // argument and the program should exit.
+ //
+ virtual bool handleOccurance(const char *ArgName, const string &Arg) = 0;
+
+ virtual enum NumOccurances getNumOccurancesFlagDefault() const {
+ return Optional;
+ }
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueOptional;
+ }
+ virtual enum OptionHidden getOptionHiddenFlagDefault() const {
+ return NotHidden;
+ }
+
+ int NumOccurances; // The number of times specified
+ const int Flags; // Flags for the argument
+public:
+ const char * const ArgStr; // The argument string itself (ex: "help", "o")
+ const char * const HelpStr; // The descriptive text message for --help
+
+ inline enum NumOccurances getNumOccurancesFlag() const {
+ int NO = Flags & OccurancesMask;
+ return NO ? (enum NumOccurances)NO : getNumOccurancesFlagDefault();
+ }
+ inline enum ValueExpected getValueExpectedFlag() const {
+ int VE = Flags & ValueMask;
+ return VE ? (enum ValueExpected)VE : getValueExpectedFlagDefault();
+ }
+ inline enum OptionHidden getOptionHiddenFlag() const {
+ int OH = Flags & HiddenMask;
+ return OH ? (enum OptionHidden)OH : getOptionHiddenFlagDefault();
+ }
+
+protected:
+ Option(const char *ArgStr, const char *Message, int Flags);
+ Option(int flags) : NumOccurances(0), Flags(flags), ArgStr(""), HelpStr("") {}
+
+public:
+ // Return the width of the option tag for printing...
+ virtual unsigned getOptionWidth() const;
+
+ // printOptionInfo - Print out information about this option. The
+ // to-be-maintained width is specified.
+ //
+ virtual void printOptionInfo(unsigned GlobalWidth) const;
+
+ // addOccurance - Wrapper around handleOccurance that enforces Flags
+ //
+ bool addOccurance(const char *ArgName, const string &Value);
+
+ // Prints option name followed by message. Always returns true.
+ bool error(string Message, const char *ArgName = 0);
+
+public:
+ inline int getNumOccurances() const { return NumOccurances; }
+ virtual ~Option() {}
+};
+
+
+//===----------------------------------------------------------------------===//
+// Aliased command line option (alias this name to a preexisting name)
+//
+class Alias : public Option {
+ Option &AliasFor;
+ virtual bool handleOccurance(const char *ArgName, const string &Arg) {
+ return AliasFor.handleOccurance(AliasFor.ArgStr, Arg);
+ }
+ virtual enum OptionHidden getOptionHiddenFlagDefault() const {return Hidden;}
+public:
+ inline Alias(const char *ArgStr, const char *Message, int Flags,
+ Option &aliasFor) : Option(ArgStr, Message, Flags),
+ AliasFor(aliasFor) {}
+};
+
+//===----------------------------------------------------------------------===//
+// Boolean/flag command line option
+//
+class Flag : public Option {
+ bool Value;
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+public:
+ inline Flag(const char *ArgStr, const char *Message, int Flags = 0,
+ bool DefaultVal = 0) : Option(ArgStr, Message, Flags),
+ Value(DefaultVal) {}
+ operator const bool() const { return Value; }
+ inline bool operator=(bool Val) { Value = Val; return Val; }
+};
+
+
+
+//===----------------------------------------------------------------------===//
+// Integer valued command line option
+//
+class Int : public Option {
+ int Value;
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueRequired;
+ }
+public:
+ inline Int(const char *ArgStr, const char *Help, int Flags = 0,
+ int DefaultVal = 0) : Option(ArgStr, Help, Flags),
+ Value(DefaultVal) {}
+ inline operator int() const { return Value; }
+ inline int operator=(int Val) { Value = Val; return Val; }
+};
+
+
+//===----------------------------------------------------------------------===//
+// String valued command line option
+//
+class String : public Option, public string {
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueRequired;
+ }
+public:
+ inline String(const char *ArgStr, const char *Help, int Flags = 0,
+ const char *DefaultVal = "")
+ : Option(ArgStr, Help, Flags), string(DefaultVal) {}
+
+ inline const string &operator=(const string &Val) {
+ return string::operator=(Val);
+ }
+};
+
+
+//===----------------------------------------------------------------------===//
+// String list command line option
+//
+class StringList : public Option, public vector<string> {
+
+ virtual enum NumOccurances getNumOccurancesFlagDefault() const {
+ return ZeroOrMore;
+ }
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueRequired;
+ }
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+
+public:
+ inline StringList(const char *ArgStr, const char *Help, int Flags = 0)
+ : Option(ArgStr, Help, Flags) {}
+};
+
+
+//===----------------------------------------------------------------------===//
+// Enum valued command line option
+//
+#define clEnumVal(ENUMVAL, DESC) #ENUMVAL, ENUMVAL, DESC
+#define clEnumValN(ENUMVAL, FLAGNAME, DESC) FLAGNAME, ENUMVAL, DESC
+
+// EnumBase - Base class for all enum/varargs related argument types...
+class EnumBase : public Option {
+protected:
+ // Use a vector instead of a map, because the lists should be short,
+ // the overhead is less, and most importantly, it keeps them in the order
+ // inserted so we can print our option out nicely.
+ vector<pair<const char *, pair<int, const char *> > > ValueMap;
+
+ inline EnumBase(const char *ArgStr, const char *Help, int Flags)
+ : Option(ArgStr, Help, Flags) {}
+ inline EnumBase(int Flags) : Option(Flags) {}
+
+ // processValues - Incorporate the specifed varargs arglist into the
+ // ValueMap.
+ //
+ void processValues(va_list Vals);
+
+ // registerArgs - notify the system about these new arguments
+ void registerArgs();
+
+public:
+ // Turn an enum into the arg name that activates it
+ const char *getArgName(int ID) const;
+ const char *getArgDescription(int ID) const;
+};
+
+class EnumValueBase : public EnumBase {
+protected:
+ int Value;
+ inline EnumValueBase(const char *ArgStr, const char *Help, int Flags)
+ : EnumBase(ArgStr, Help, Flags) {}
+ inline EnumValueBase(int Flags) : EnumBase(Flags) {}
+
+ // handleOccurance - Set Value to the enum value specified by Arg
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+
+ // Return the width of the option tag for printing...
+ virtual unsigned getOptionWidth() const;
+
+ // printOptionInfo - Print out information about this option. The
+ // to-be-maintained width is specified.
+ //
+ virtual void printOptionInfo(unsigned GlobalWidth) const;
+};
+
+template <class E> // The enum we are representing
+class Enum : public EnumValueBase {
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueRequired;
+ }
+public:
+ inline Enum(const char *ArgStr, int Flags, const char *Help, ...)
+ : EnumValueBase(ArgStr, Help, Flags) {
+ va_list Values;
+ va_start(Values, Help);
+ processValues(Values);
+ va_end(Values);
+ Value = ValueMap.front().second.first; // Grab default value
+ }
+
+ inline operator E() const { return (E)Value; }
+ inline E operator=(E Val) { Value = Val; return Val; }
+};
+
+
+//===----------------------------------------------------------------------===//
+// Enum flags command line option
+//
+class EnumFlagsBase : public EnumValueBase {
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueDisallowed;
+ }
+protected:
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+ inline EnumFlagsBase(int Flags) : EnumValueBase(Flags) {}
+
+ // Return the width of the option tag for printing...
+ virtual unsigned getOptionWidth() const;
+
+ // printOptionInfo - Print out information about this option. The
+ // to-be-maintained width is specified.
+ //
+ virtual void printOptionInfo(unsigned GlobalWidth) const;
+};
+
+template <class E> // The enum we are representing
+class EnumFlags : public EnumFlagsBase {
+public:
+ inline EnumFlags(int Flags, ...) : EnumFlagsBase(Flags) {
+ va_list Values;
+ va_start(Values, Flags);
+ processValues(Values);
+ va_end(Values);
+ registerArgs();
+ Value = ValueMap.front().second.first; // Grab default value
+ }
+
+ inline operator E() const { return (E)Value; }
+ inline E operator=(E Val) { Value = Val; return Val; }
+};
+
+
+//===----------------------------------------------------------------------===//
+// Enum list command line option
+//
+class EnumListBase : public EnumBase {
+ virtual enum NumOccurances getNumOccurancesFlagDefault() const {
+ return ZeroOrMore;
+ }
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueDisallowed;
+ }
+protected:
+ vector<int> Values; // The options specified so far.
+
+ inline EnumListBase(int Flags)
+ : EnumBase(Flags) {}
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+
+ // Return the width of the option tag for printing...
+ virtual unsigned getOptionWidth() const;
+
+ // printOptionInfo - Print out information about this option. The
+ // to-be-maintained width is specified.
+ //
+ virtual void printOptionInfo(unsigned GlobalWidth) const;
+public:
+ inline unsigned size() { return Values.size(); }
+};
+
+template <class E> // The enum we are representing
+class EnumList : public EnumListBase {
+public:
+ inline EnumList(int Flags, ...) : EnumListBase(Flags) {
+ va_list Values;
+ va_start(Values, Flags);
+ processValues(Values);
+ va_end(Values);
+ registerArgs();
+ }
+ inline E operator[](unsigned i) const { return (E)Values[i]; }
+ inline E &operator[](unsigned i) { return (E&)Values[i]; }
+};
+
+} // End namespace cl
+
+#endif
diff --git a/include/llvm/Support/DepthFirstIterator.h b/include/Support/DepthFirstIterator.h
similarity index 97%
rename from include/llvm/Support/DepthFirstIterator.h
rename to include/Support/DepthFirstIterator.h
index 7301706..a2d5a9d 100644
--- a/include/llvm/Support/DepthFirstIterator.h
+++ b/include/Support/DepthFirstIterator.h
@@ -1,4 +1,4 @@
-//===- llvm/Support/DepthFirstIterator.h - Depth First iterators -*- C++ -*--=//
+//===- Support/DepthFirstIterator.h - Depth First iterator -------*- C++ -*--=//
//
// This file builds on the Support/GraphTraits.h file to build generic depth
// first graph iterator.
@@ -8,7 +8,7 @@
#ifndef LLVM_SUPPORT_DEPTH_FIRST_ITERATOR_H
#define LLVM_SUPPORT_DEPTH_FIRST_ITERATOR_H
-#include "llvm/Support/GraphTraits.h"
+#include "Support/GraphTraits.h"
#include <iterator>
#include <stack>
#include <set>
diff --git a/include/llvm/Support/GraphTraits.h b/include/Support/GraphTraits.h
similarity index 96%
rename from include/llvm/Support/GraphTraits.h
rename to include/Support/GraphTraits.h
index 67fe7c9..00973d5 100644
--- a/include/llvm/Support/GraphTraits.h
+++ b/include/Support/GraphTraits.h
@@ -1,4 +1,4 @@
-//===-- llvm/Support/GraphTraits.h - Graph traits template -------*- C++ -*--=//
+//===-- Support/GraphTraits.h - Graph traits template ------------*- C++ -*--=//
//
// This file defines the little GraphTraits<X> template class that should be
// specialized by classes that want to be iteratable by generic graph iterators.
diff --git a/include/llvm/Support/HashExtras.h b/include/Support/HashExtras.h
similarity index 100%
rename from include/llvm/Support/HashExtras.h
rename to include/Support/HashExtras.h
diff --git a/include/Support/MathExtras.h b/include/Support/MathExtras.h
new file mode 100644
index 0000000..f3dc3de
--- /dev/null
+++ b/include/Support/MathExtras.h
@@ -0,0 +1,32 @@
+// $Id$ -*-c++-*-
+//***************************************************************************
+// File:
+// MathExtras.h
+//
+// Purpose:
+//
+// History:
+// 8/25/01 - Vikram Adve - Created
+//**************************************************************************/
+
+#ifndef LLVM_SUPPORT_MATH_EXTRAS_H
+#define LLVM_SUPPORT_MATH_EXTRAS_H
+
+#include <sys/types.h>
+
+inline bool IsPowerOf2 (int64_t C, unsigned& getPow);
+
+inline
+bool IsPowerOf2(int64_t C, unsigned& getPow)
+{
+ if (C < 0)
+ C = -C;
+ bool isBool = C > 0 && (C == (C & ~(C - 1)));
+ if (isBool)
+ for (getPow = 0; C > 1; getPow++)
+ C = C >> 1;
+
+ return isBool;
+}
+
+#endif /*LLVM_SUPPORT_MATH_EXTRAS_H*/
diff --git a/include/llvm/Support/NonCopyable.h b/include/Support/NonCopyable.h
similarity index 100%
rename from include/llvm/Support/NonCopyable.h
rename to include/Support/NonCopyable.h
diff --git a/include/llvm/Support/PostOrderIterator.h b/include/Support/PostOrderIterator.h
similarity index 97%
rename from include/llvm/Support/PostOrderIterator.h
rename to include/Support/PostOrderIterator.h
index fa135f8..89a9b4d 100644
--- a/include/llvm/Support/PostOrderIterator.h
+++ b/include/Support/PostOrderIterator.h
@@ -1,4 +1,4 @@
-//===-- llvm/Support/PostOrderIterator.h - Generic PO iterator ---*- C++ -*--=//
+//===-- Support/PostOrderIterator.h - Generic PostOrder iterator -*- C++ -*--=//
//
// This file builds on the Support/GraphTraits.h file to build a generic graph
// post order iterator. This should work over any graph type that has a
@@ -9,7 +9,7 @@
#ifndef LLVM_SUPPORT_POSTORDER_ITERATOR_H
#define LLVM_SUPPORT_POSTORDER_ITERATOR_H
-#include "llvm/Support/GraphTraits.h"
+#include "Support/GraphTraits.h"
#include <iterator>
#include <stack>
#include <set>
diff --git a/include/llvm/Support/STLExtras.h b/include/Support/STLExtras.h
similarity index 100%
rename from include/llvm/Support/STLExtras.h
rename to include/Support/STLExtras.h
diff --git a/include/llvm/Support/StringExtras.h b/include/Support/StringExtras.h
similarity index 68%
rename from include/llvm/Support/StringExtras.h
rename to include/Support/StringExtras.h
index aaae857..e67e25c 100644
--- a/include/llvm/Support/StringExtras.h
+++ b/include/Support/StringExtras.h
@@ -1,17 +1,15 @@
-//===-- StringExtras.h - Useful string functions -----------------*- C++ -*--=//
+//===-- Support/StringExtras.h - Useful string functions ---------*- C++ -*--=//
//
// This file contains some functions that are useful when dealing with strings.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_TOOLS_STRING_EXTRAS_H
-#define LLVM_TOOLS_STRING_EXTRAS_H
+#ifndef SUPPORT_STRING_EXTRAS_H
+#define SUPPORT_STRING_EXTRAS_H
+#include "Support/DataTypes.h"
#include <string>
#include <stdio.h>
-#include "Support/DataTypes.h"
-
-class ConstPoolArray;
static inline string utostr(uint64_t X, bool isNeg = false) {
char Buffer[40];
@@ -68,21 +66,4 @@
return Buffer;
}
-static inline void
-printIndent(unsigned int indent, ostream& os=cout, const char* const istr=" ")
-{
- for (unsigned i=0; i < indent; i++)
- os << istr;
-}
-
-// Can we treat the specified array as a string? Only if it is an array of
-// ubytes or non-negative sbytes.
-//
-bool isStringCompatible(ConstPoolArray *CPA);
-
-// getAsCString - Return the specified array as a C compatible string, only if
-// the predicate isStringCompatible is true.
-//
-string getAsCString(ConstPoolArray *CPA);
-
#endif
diff --git a/include/llvm/Support/Tree.h b/include/Support/Tree.h
similarity index 96%
rename from include/llvm/Support/Tree.h
rename to include/Support/Tree.h
index 679b6df..33b0bb7 100644
--- a/include/llvm/Support/Tree.h
+++ b/include/Support/Tree.h
@@ -1,4 +1,4 @@
-//===- llvm/Support/Tree.h - Generic n-way tree structure --------*- C++ -*--=//
+//===- Support/Tree.h - Generic n-way tree structure -------------*- C++ -*--=//
//
// This class defines a generic N way tree node structure. The tree structure
// is immutable after creation, but the payload contained within it is not.
diff --git a/include/llvm/Support/DepthFirstIterator.h b/include/llvm/ADT/DepthFirstIterator.h
similarity index 97%
copy from include/llvm/Support/DepthFirstIterator.h
copy to include/llvm/ADT/DepthFirstIterator.h
index 7301706..a2d5a9d 100644
--- a/include/llvm/Support/DepthFirstIterator.h
+++ b/include/llvm/ADT/DepthFirstIterator.h
@@ -1,4 +1,4 @@
-//===- llvm/Support/DepthFirstIterator.h - Depth First iterators -*- C++ -*--=//
+//===- Support/DepthFirstIterator.h - Depth First iterator -------*- C++ -*--=//
//
// This file builds on the Support/GraphTraits.h file to build generic depth
// first graph iterator.
@@ -8,7 +8,7 @@
#ifndef LLVM_SUPPORT_DEPTH_FIRST_ITERATOR_H
#define LLVM_SUPPORT_DEPTH_FIRST_ITERATOR_H
-#include "llvm/Support/GraphTraits.h"
+#include "Support/GraphTraits.h"
#include <iterator>
#include <stack>
#include <set>
diff --git a/include/llvm/Support/GraphTraits.h b/include/llvm/ADT/GraphTraits.h
similarity index 96%
copy from include/llvm/Support/GraphTraits.h
copy to include/llvm/ADT/GraphTraits.h
index 67fe7c9..00973d5 100644
--- a/include/llvm/Support/GraphTraits.h
+++ b/include/llvm/ADT/GraphTraits.h
@@ -1,4 +1,4 @@
-//===-- llvm/Support/GraphTraits.h - Graph traits template -------*- C++ -*--=//
+//===-- Support/GraphTraits.h - Graph traits template ------------*- C++ -*--=//
//
// This file defines the little GraphTraits<X> template class that should be
// specialized by classes that want to be iteratable by generic graph iterators.
diff --git a/include/llvm/Support/HashExtras.h b/include/llvm/ADT/HashExtras.h
similarity index 100%
copy from include/llvm/Support/HashExtras.h
copy to include/llvm/ADT/HashExtras.h
diff --git a/include/llvm/Support/PostOrderIterator.h b/include/llvm/ADT/PostOrderIterator.h
similarity index 97%
copy from include/llvm/Support/PostOrderIterator.h
copy to include/llvm/ADT/PostOrderIterator.h
index fa135f8..89a9b4d 100644
--- a/include/llvm/Support/PostOrderIterator.h
+++ b/include/llvm/ADT/PostOrderIterator.h
@@ -1,4 +1,4 @@
-//===-- llvm/Support/PostOrderIterator.h - Generic PO iterator ---*- C++ -*--=//
+//===-- Support/PostOrderIterator.h - Generic PostOrder iterator -*- C++ -*--=//
//
// This file builds on the Support/GraphTraits.h file to build a generic graph
// post order iterator. This should work over any graph type that has a
@@ -9,7 +9,7 @@
#ifndef LLVM_SUPPORT_POSTORDER_ITERATOR_H
#define LLVM_SUPPORT_POSTORDER_ITERATOR_H
-#include "llvm/Support/GraphTraits.h"
+#include "Support/GraphTraits.h"
#include <iterator>
#include <stack>
#include <set>
diff --git a/include/llvm/Support/STLExtras.h b/include/llvm/ADT/STLExtras.h
similarity index 100%
copy from include/llvm/Support/STLExtras.h
copy to include/llvm/ADT/STLExtras.h
diff --git a/include/llvm/Support/StringExtras.h b/include/llvm/ADT/StringExtras.h
similarity index 68%
copy from include/llvm/Support/StringExtras.h
copy to include/llvm/ADT/StringExtras.h
index aaae857..e67e25c 100644
--- a/include/llvm/Support/StringExtras.h
+++ b/include/llvm/ADT/StringExtras.h
@@ -1,17 +1,15 @@
-//===-- StringExtras.h - Useful string functions -----------------*- C++ -*--=//
+//===-- Support/StringExtras.h - Useful string functions ---------*- C++ -*--=//
//
// This file contains some functions that are useful when dealing with strings.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_TOOLS_STRING_EXTRAS_H
-#define LLVM_TOOLS_STRING_EXTRAS_H
+#ifndef SUPPORT_STRING_EXTRAS_H
+#define SUPPORT_STRING_EXTRAS_H
+#include "Support/DataTypes.h"
#include <string>
#include <stdio.h>
-#include "Support/DataTypes.h"
-
-class ConstPoolArray;
static inline string utostr(uint64_t X, bool isNeg = false) {
char Buffer[40];
@@ -68,21 +66,4 @@
return Buffer;
}
-static inline void
-printIndent(unsigned int indent, ostream& os=cout, const char* const istr=" ")
-{
- for (unsigned i=0; i < indent; i++)
- os << istr;
-}
-
-// Can we treat the specified array as a string? Only if it is an array of
-// ubytes or non-negative sbytes.
-//
-bool isStringCompatible(ConstPoolArray *CPA);
-
-// getAsCString - Return the specified array as a C compatible string, only if
-// the predicate isStringCompatible is true.
-//
-string getAsCString(ConstPoolArray *CPA);
-
#endif
diff --git a/include/llvm/Support/Tree.h b/include/llvm/ADT/Tree.h
similarity index 96%
copy from include/llvm/Support/Tree.h
copy to include/llvm/ADT/Tree.h
index 679b6df..33b0bb7 100644
--- a/include/llvm/Support/Tree.h
+++ b/include/llvm/ADT/Tree.h
@@ -1,4 +1,4 @@
-//===- llvm/Support/Tree.h - Generic n-way tree structure --------*- C++ -*--=//
+//===- Support/Tree.h - Generic n-way tree structure -------------*- C++ -*--=//
//
// This class defines a generic N way tree node structure. The tree structure
// is immutable after creation, but the payload contained within it is not.
diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h
index 62b1846..8365a4f 100644
--- a/include/llvm/Analysis/CallGraph.h
+++ b/include/llvm/Analysis/CallGraph.h
@@ -16,7 +16,7 @@
#ifndef LLVM_ANALYSIS_CALLGRAPH_H
#define LLVM_ANALYSIS_CALLGRAPH_H
-#include "llvm/Support/GraphTraits.h"
+#include "Support/GraphTraits.h"
#include <map>
#include <vector>
class Method;
diff --git a/include/llvm/Analysis/InstForest.h b/include/llvm/Analysis/InstForest.h
index 967ed45..497bb46 100644
--- a/include/llvm/Analysis/InstForest.h
+++ b/include/llvm/Analysis/InstForest.h
@@ -14,8 +14,8 @@
#ifndef LLVM_ANALYSIS_INSTFOREST_H
#define LLVM_ANALYSIS_INSTFOREST_H
-#include "llvm/Support/Tree.h"
#include "llvm/Instruction.h"
+#include "Support/Tree.h"
#include <map>
namespace analysis {
diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h
index cf29cbd..df9447f 100644
--- a/include/llvm/BasicBlock.h
+++ b/include/llvm/BasicBlock.h
@@ -24,8 +24,8 @@
#include "llvm/Value.h"
#include "llvm/ValueHolder.h"
-#include "llvm/Support/GraphTraits.h"
#include "llvm/InstrTypes.h"
+#include "Support/GraphTraits.h"
#include <iterator>
class Instruction;
diff --git a/include/llvm/CodeGen/InstrForest.h b/include/llvm/CodeGen/InstrForest.h
index 1b9af71..e7bd3ad 100644
--- a/include/llvm/CodeGen/InstrForest.h
+++ b/include/llvm/CodeGen/InstrForest.h
@@ -24,9 +24,9 @@
#ifndef LLVM_CODEGEN_INSTRFOREST_H
#define LLVM_CODEGEN_INSTRFOREST_H
-#include "llvm/Support/NonCopyable.h"
-#include "llvm/Support/HashExtras.h"
#include "llvm/Instruction.h"
+#include "Support/NonCopyable.h"
+#include "Support/HashExtras.h"
#include <hash_map>
#include <hash_set>
diff --git a/include/llvm/CodeGen/InstrScheduling.h b/include/llvm/CodeGen/InstrScheduling.h
index 8f88a61..69390fa 100644
--- a/include/llvm/CodeGen/InstrScheduling.h
+++ b/include/llvm/CodeGen/InstrScheduling.h
@@ -12,8 +12,8 @@
#ifndef LLVM_CODEGEN_INSTR_SCHEDULING_H
#define LLVM_CODEGEN_INSTR_SCHEDULING_H
-#include "llvm/Support/CommandLine.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "Support/CommandLine.h"
class Method;
class SchedulingManager;
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index 91ae9de..a204318 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -15,13 +15,13 @@
#ifndef LLVM_CODEGEN_MACHINEINSTR_H
#define LLVM_CODEGEN_MACHINEINSTR_H
-#include <iterator>
-#include "llvm/CodeGen/InstrForest.h"
#include "Support/DataTypes.h"
-#include "llvm/Support/NonCopyable.h"
+#include "Support/NonCopyable.h"
+#include "llvm/CodeGen/InstrForest.h"
#include "llvm/Target/MachineInstrInfo.h"
#include "llvm/Annotation.h"
#include "llvm/Method.h"
+#include <iterator>
#include <hash_map>
#include <hash_set>
#include <values.h>
diff --git a/include/llvm/CodeGen/RegAllocCommon.h b/include/llvm/CodeGen/RegAllocCommon.h
index 5fa51c0..02b3331 100644
--- a/include/llvm/CodeGen/RegAllocCommon.h
+++ b/include/llvm/CodeGen/RegAllocCommon.h
@@ -1,5 +1,5 @@
-#include "llvm/Support/CommandLine.h"
+#include "Support/CommandLine.h"
#ifndef REG_ALLOC_COMMON_H
#define REG_ALLOC_COMMON_H
diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h
new file mode 100644
index 0000000..84a3bc9
--- /dev/null
+++ b/include/llvm/Support/CommandLine.h
@@ -0,0 +1,399 @@
+//===- Support/CommandLine.h - Flexible Command line parser ------*- C++ -*--=//
+//
+// This class implements a command line argument processor that is useful when
+// creating a tool. It provides a simple, minimalistic interface that is easily
+// extensible and supports nonlocal (library) command line options.
+//
+// Note that rather than trying to figure out what this code does, you could try
+// reading the library documentation located in docs/CommandLine.html
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_COMMANDLINE_H
+#define LLVM_SUPPORT_COMMANDLINE_H
+
+#include <string>
+#include <vector>
+#include <utility>
+#include <stdarg.h>
+
+namespace cl { // Short namespace to make usage concise
+
+//===----------------------------------------------------------------------===//
+// ParseCommandLineOptions - Minimalistic command line option processing entry
+//
+void cl::ParseCommandLineOptions(int &argc, char **argv,
+ const char *Overview = 0,
+ int Flags = 0);
+
+// ParserOptions - This set of option is use to control global behavior of the
+// command line processor.
+//
+enum ParserOptions {
+ // DisableSingleLetterArgGrouping - With this option enabled, multiple letter
+ // options are allowed to bunch together with only a single hyphen for the
+ // whole group. This allows emulation of the behavior that ls uses for
+ // example: ls -la === ls -l -a Providing this option, disables this.
+ //
+ DisableSingleLetterArgGrouping = 0x0001,
+
+ // EnableSingleLetterArgValue - This option allows arguments that are
+ // otherwise unrecognized to match single letter flags that take a value.
+ // This is useful for cases like a linker, where options are typically of the
+ // form '-lfoo' or '-L../../include' where -l or -L are the actual flags.
+ //
+ EnableSingleLetterArgValue = 0x0002,
+};
+
+
+//===----------------------------------------------------------------------===//
+// Global flags permitted to be passed to command line arguments
+
+enum FlagsOptions {
+ NoFlags = 0x00, // Marker to make explicit that we have no flags
+ Default = 0x00, // Equally, marker to use the default flags
+
+ GlobalsMask = 0x80,
+};
+
+enum NumOccurances { // Flags for the number of occurances allowed...
+ Optional = 0x01, // Zero or One occurance
+ ZeroOrMore = 0x02, // Zero or more occurances allowed
+ Required = 0x03, // One occurance required
+ OneOrMore = 0x04, // One or more occurances required
+
+ // ConsumeAfter - Marker for a null ("") flag that can be used to indicate
+ // that anything that matches the null marker starts a sequence of options
+ // that all get sent to the null marker. Thus, for example, all arguments
+ // to LLI are processed until a filename is found. Once a filename is found,
+ // all of the succeeding arguments are passed, unprocessed, to the null flag.
+ //
+ ConsumeAfter = 0x05,
+
+ OccurancesMask = 0x07,
+};
+
+enum ValueExpected { // Is a value required for the option?
+ ValueOptional = 0x08, // The value can oppear... or not
+ ValueRequired = 0x10, // The value is required to appear!
+ ValueDisallowed = 0x18, // A value may not be specified (for flags)
+ ValueMask = 0x18,
+};
+
+enum OptionHidden { // Control whether -help shows this option
+ NotHidden = 0x20, // Option included in --help & --help-hidden
+ Hidden = 0x40, // -help doesn't, but --help-hidden does
+ ReallyHidden = 0x60, // Neither --help nor --help-hidden show this arg
+ HiddenMask = 0x60,
+};
+
+
+//===----------------------------------------------------------------------===//
+// Option Base class
+//
+class Alias;
+class Option {
+ friend void cl::ParseCommandLineOptions(int &, char **, const char *, int);
+ friend class Alias;
+
+ // handleOccurances - Overriden by subclasses to handle the value passed into
+ // an argument. Should return true if there was an error processing the
+ // argument and the program should exit.
+ //
+ virtual bool handleOccurance(const char *ArgName, const string &Arg) = 0;
+
+ virtual enum NumOccurances getNumOccurancesFlagDefault() const {
+ return Optional;
+ }
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueOptional;
+ }
+ virtual enum OptionHidden getOptionHiddenFlagDefault() const {
+ return NotHidden;
+ }
+
+ int NumOccurances; // The number of times specified
+ const int Flags; // Flags for the argument
+public:
+ const char * const ArgStr; // The argument string itself (ex: "help", "o")
+ const char * const HelpStr; // The descriptive text message for --help
+
+ inline enum NumOccurances getNumOccurancesFlag() const {
+ int NO = Flags & OccurancesMask;
+ return NO ? (enum NumOccurances)NO : getNumOccurancesFlagDefault();
+ }
+ inline enum ValueExpected getValueExpectedFlag() const {
+ int VE = Flags & ValueMask;
+ return VE ? (enum ValueExpected)VE : getValueExpectedFlagDefault();
+ }
+ inline enum OptionHidden getOptionHiddenFlag() const {
+ int OH = Flags & HiddenMask;
+ return OH ? (enum OptionHidden)OH : getOptionHiddenFlagDefault();
+ }
+
+protected:
+ Option(const char *ArgStr, const char *Message, int Flags);
+ Option(int flags) : NumOccurances(0), Flags(flags), ArgStr(""), HelpStr("") {}
+
+public:
+ // Return the width of the option tag for printing...
+ virtual unsigned getOptionWidth() const;
+
+ // printOptionInfo - Print out information about this option. The
+ // to-be-maintained width is specified.
+ //
+ virtual void printOptionInfo(unsigned GlobalWidth) const;
+
+ // addOccurance - Wrapper around handleOccurance that enforces Flags
+ //
+ bool addOccurance(const char *ArgName, const string &Value);
+
+ // Prints option name followed by message. Always returns true.
+ bool error(string Message, const char *ArgName = 0);
+
+public:
+ inline int getNumOccurances() const { return NumOccurances; }
+ virtual ~Option() {}
+};
+
+
+//===----------------------------------------------------------------------===//
+// Aliased command line option (alias this name to a preexisting name)
+//
+class Alias : public Option {
+ Option &AliasFor;
+ virtual bool handleOccurance(const char *ArgName, const string &Arg) {
+ return AliasFor.handleOccurance(AliasFor.ArgStr, Arg);
+ }
+ virtual enum OptionHidden getOptionHiddenFlagDefault() const {return Hidden;}
+public:
+ inline Alias(const char *ArgStr, const char *Message, int Flags,
+ Option &aliasFor) : Option(ArgStr, Message, Flags),
+ AliasFor(aliasFor) {}
+};
+
+//===----------------------------------------------------------------------===//
+// Boolean/flag command line option
+//
+class Flag : public Option {
+ bool Value;
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+public:
+ inline Flag(const char *ArgStr, const char *Message, int Flags = 0,
+ bool DefaultVal = 0) : Option(ArgStr, Message, Flags),
+ Value(DefaultVal) {}
+ operator const bool() const { return Value; }
+ inline bool operator=(bool Val) { Value = Val; return Val; }
+};
+
+
+
+//===----------------------------------------------------------------------===//
+// Integer valued command line option
+//
+class Int : public Option {
+ int Value;
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueRequired;
+ }
+public:
+ inline Int(const char *ArgStr, const char *Help, int Flags = 0,
+ int DefaultVal = 0) : Option(ArgStr, Help, Flags),
+ Value(DefaultVal) {}
+ inline operator int() const { return Value; }
+ inline int operator=(int Val) { Value = Val; return Val; }
+};
+
+
+//===----------------------------------------------------------------------===//
+// String valued command line option
+//
+class String : public Option, public string {
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueRequired;
+ }
+public:
+ inline String(const char *ArgStr, const char *Help, int Flags = 0,
+ const char *DefaultVal = "")
+ : Option(ArgStr, Help, Flags), string(DefaultVal) {}
+
+ inline const string &operator=(const string &Val) {
+ return string::operator=(Val);
+ }
+};
+
+
+//===----------------------------------------------------------------------===//
+// String list command line option
+//
+class StringList : public Option, public vector<string> {
+
+ virtual enum NumOccurances getNumOccurancesFlagDefault() const {
+ return ZeroOrMore;
+ }
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueRequired;
+ }
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+
+public:
+ inline StringList(const char *ArgStr, const char *Help, int Flags = 0)
+ : Option(ArgStr, Help, Flags) {}
+};
+
+
+//===----------------------------------------------------------------------===//
+// Enum valued command line option
+//
+#define clEnumVal(ENUMVAL, DESC) #ENUMVAL, ENUMVAL, DESC
+#define clEnumValN(ENUMVAL, FLAGNAME, DESC) FLAGNAME, ENUMVAL, DESC
+
+// EnumBase - Base class for all enum/varargs related argument types...
+class EnumBase : public Option {
+protected:
+ // Use a vector instead of a map, because the lists should be short,
+ // the overhead is less, and most importantly, it keeps them in the order
+ // inserted so we can print our option out nicely.
+ vector<pair<const char *, pair<int, const char *> > > ValueMap;
+
+ inline EnumBase(const char *ArgStr, const char *Help, int Flags)
+ : Option(ArgStr, Help, Flags) {}
+ inline EnumBase(int Flags) : Option(Flags) {}
+
+ // processValues - Incorporate the specifed varargs arglist into the
+ // ValueMap.
+ //
+ void processValues(va_list Vals);
+
+ // registerArgs - notify the system about these new arguments
+ void registerArgs();
+
+public:
+ // Turn an enum into the arg name that activates it
+ const char *getArgName(int ID) const;
+ const char *getArgDescription(int ID) const;
+};
+
+class EnumValueBase : public EnumBase {
+protected:
+ int Value;
+ inline EnumValueBase(const char *ArgStr, const char *Help, int Flags)
+ : EnumBase(ArgStr, Help, Flags) {}
+ inline EnumValueBase(int Flags) : EnumBase(Flags) {}
+
+ // handleOccurance - Set Value to the enum value specified by Arg
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+
+ // Return the width of the option tag for printing...
+ virtual unsigned getOptionWidth() const;
+
+ // printOptionInfo - Print out information about this option. The
+ // to-be-maintained width is specified.
+ //
+ virtual void printOptionInfo(unsigned GlobalWidth) const;
+};
+
+template <class E> // The enum we are representing
+class Enum : public EnumValueBase {
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueRequired;
+ }
+public:
+ inline Enum(const char *ArgStr, int Flags, const char *Help, ...)
+ : EnumValueBase(ArgStr, Help, Flags) {
+ va_list Values;
+ va_start(Values, Help);
+ processValues(Values);
+ va_end(Values);
+ Value = ValueMap.front().second.first; // Grab default value
+ }
+
+ inline operator E() const { return (E)Value; }
+ inline E operator=(E Val) { Value = Val; return Val; }
+};
+
+
+//===----------------------------------------------------------------------===//
+// Enum flags command line option
+//
+class EnumFlagsBase : public EnumValueBase {
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueDisallowed;
+ }
+protected:
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+ inline EnumFlagsBase(int Flags) : EnumValueBase(Flags) {}
+
+ // Return the width of the option tag for printing...
+ virtual unsigned getOptionWidth() const;
+
+ // printOptionInfo - Print out information about this option. The
+ // to-be-maintained width is specified.
+ //
+ virtual void printOptionInfo(unsigned GlobalWidth) const;
+};
+
+template <class E> // The enum we are representing
+class EnumFlags : public EnumFlagsBase {
+public:
+ inline EnumFlags(int Flags, ...) : EnumFlagsBase(Flags) {
+ va_list Values;
+ va_start(Values, Flags);
+ processValues(Values);
+ va_end(Values);
+ registerArgs();
+ Value = ValueMap.front().second.first; // Grab default value
+ }
+
+ inline operator E() const { return (E)Value; }
+ inline E operator=(E Val) { Value = Val; return Val; }
+};
+
+
+//===----------------------------------------------------------------------===//
+// Enum list command line option
+//
+class EnumListBase : public EnumBase {
+ virtual enum NumOccurances getNumOccurancesFlagDefault() const {
+ return ZeroOrMore;
+ }
+ virtual enum ValueExpected getValueExpectedFlagDefault() const {
+ return ValueDisallowed;
+ }
+protected:
+ vector<int> Values; // The options specified so far.
+
+ inline EnumListBase(int Flags)
+ : EnumBase(Flags) {}
+ virtual bool handleOccurance(const char *ArgName, const string &Arg);
+
+ // Return the width of the option tag for printing...
+ virtual unsigned getOptionWidth() const;
+
+ // printOptionInfo - Print out information about this option. The
+ // to-be-maintained width is specified.
+ //
+ virtual void printOptionInfo(unsigned GlobalWidth) const;
+public:
+ inline unsigned size() { return Values.size(); }
+};
+
+template <class E> // The enum we are representing
+class EnumList : public EnumListBase {
+public:
+ inline EnumList(int Flags, ...) : EnumListBase(Flags) {
+ va_list Values;
+ va_start(Values, Flags);
+ processValues(Values);
+ va_end(Values);
+ registerArgs();
+ }
+ inline E operator[](unsigned i) const { return (E)Values[i]; }
+ inline E &operator[](unsigned i) { return (E&)Values[i]; }
+};
+
+} // End namespace cl
+
+#endif
diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h
new file mode 100644
index 0000000..f3dc3de
--- /dev/null
+++ b/include/llvm/Support/MathExtras.h
@@ -0,0 +1,32 @@
+// $Id$ -*-c++-*-
+//***************************************************************************
+// File:
+// MathExtras.h
+//
+// Purpose:
+//
+// History:
+// 8/25/01 - Vikram Adve - Created
+//**************************************************************************/
+
+#ifndef LLVM_SUPPORT_MATH_EXTRAS_H
+#define LLVM_SUPPORT_MATH_EXTRAS_H
+
+#include <sys/types.h>
+
+inline bool IsPowerOf2 (int64_t C, unsigned& getPow);
+
+inline
+bool IsPowerOf2(int64_t C, unsigned& getPow)
+{
+ if (C < 0)
+ C = -C;
+ bool isBool = C > 0 && (C == (C & ~(C - 1)));
+ if (isBool)
+ for (getPow = 0; C > 1; getPow++)
+ C = C >> 1;
+
+ return isBool;
+}
+
+#endif /*LLVM_SUPPORT_MATH_EXTRAS_H*/
diff --git a/include/llvm/Target/TargetFrameInfo.h b/include/llvm/Target/TargetFrameInfo.h
index 4f19cc9..df16c73 100644
--- a/include/llvm/Target/TargetFrameInfo.h
+++ b/include/llvm/Target/TargetFrameInfo.h
@@ -13,7 +13,7 @@
#ifndef LLVM_CODEGEN_FRAMEINFO_H
#define LLVM_CODEGEN_FRAMEINFO_H
-#include "llvm/Support/NonCopyable.h"
+#include "Support/NonCopyable.h"
#include <vector>
diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h
index 4f0b934..ad1f105 100644
--- a/include/llvm/Target/TargetMachine.h
+++ b/include/llvm/Target/TargetMachine.h
@@ -8,7 +8,7 @@
#define LLVM_TARGET_TARGETMACHINE_H
#include "llvm/Target/TargetData.h"
-#include "llvm/Support/NonCopyable.h"
+#include "Support/NonCopyable.h"
class TargetMachine;
class MachineInstrInfo;
diff --git a/include/llvm/Target/TargetRegInfo.h b/include/llvm/Target/TargetRegInfo.h
index 8f7fad5..4bd2319 100644
--- a/include/llvm/Target/TargetRegInfo.h
+++ b/include/llvm/Target/TargetRegInfo.h
@@ -8,7 +8,7 @@
#ifndef LLVM_TARGET_MACHINEREGINFO_H
#define LLVM_TARGET_MACHINEREGINFO_H
-#include "llvm/Support/NonCopyable.h"
+#include "Support/NonCopyable.h"
#include <hash_map>
#include <string>
diff --git a/include/llvm/Type.h b/include/llvm/Type.h
index 04780e9..905aa2d 100644
--- a/include/llvm/Type.h
+++ b/include/llvm/Type.h
@@ -27,7 +27,7 @@
#define LLVM_TYPE_H
#include "llvm/Value.h"
-#include "llvm/Support/GraphTraits.h"
+#include "Support/GraphTraits.h"
class DerivedType;
class MethodType;
diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp
index a323610..47dbde7 100644
--- a/lib/Analysis/IPA/CallGraph.cpp
+++ b/lib/Analysis/IPA/CallGraph.cpp
@@ -12,11 +12,11 @@
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Analysis/Writer.h"
-#include "llvm/Support/STLExtras.h"
#include "llvm/Module.h"
#include "llvm/Method.h"
#include "llvm/iOther.h"
#include "llvm/iTerminators.h"
+#include "Support/STLExtras.h"
#include <algorithm>
// getNodeFor - Return the node for the specified method or create one if it
diff --git a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp b/lib/Analysis/IPA/FindUnsafePointerTypes.cpp
index d47e1d7..8527637 100644
--- a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp
+++ b/lib/Analysis/IPA/FindUnsafePointerTypes.cpp
@@ -18,8 +18,8 @@
#include "llvm/Analysis/FindUnsafePointerTypes.h"
#include "llvm/Assembly/CachedWriter.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Type.h"
+#include "Support/CommandLine.h"
// Provide a command line option to turn on printing of which instructions cause
// a type to become invalid
diff --git a/lib/Analysis/IntervalPartition.cpp b/lib/Analysis/IntervalPartition.cpp
index 4bff950..8616cb7 100644
--- a/lib/Analysis/IntervalPartition.cpp
+++ b/lib/Analysis/IntervalPartition.cpp
@@ -6,7 +6,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/IntervalIterator.h"
-#include "llvm/Support/STLExtras.h"
+#include "Support/STLExtras.h"
using namespace cfg;
diff --git a/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp b/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp
index 32201be..e981a86 100644
--- a/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp
+++ b/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp
@@ -11,7 +11,7 @@
#include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/Support/PostOrderIterator.h"
+#include "Support/PostOrderIterator.h"
/************************** Constructor/Destructor ***************************/
diff --git a/lib/Analysis/LoopDepth.cpp b/lib/Analysis/LoopDepth.cpp
index 7518606..ed96bd4 100644
--- a/lib/Analysis/LoopDepth.cpp
+++ b/lib/Analysis/LoopDepth.cpp
@@ -7,7 +7,7 @@
#include "llvm/Analysis/LoopDepth.h"
#include "llvm/Analysis/IntervalPartition.h"
-#include "llvm/Support/STLExtras.h"
+#include "Support/STLExtras.h"
#include <algorithm>
inline void LoopDepthCalculator::AddBB(const BasicBlock *BB) {
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index a240ec8..40a195b 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/lib/Analysis/LoopInfo.cpp
@@ -9,8 +9,8 @@
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/Dominators.h"
-#include "llvm/Support/DepthFirstIterator.h"
#include "llvm/BasicBlock.h"
+#include "Support/DepthFirstIterator.h"
#include <algorithm>
bool cfg::Loop::contains(const BasicBlock *BB) const {
diff --git a/lib/Analysis/ModuleAnalyzer.cpp b/lib/Analysis/ModuleAnalyzer.cpp
index d543216..dc6ee71 100644
--- a/lib/Analysis/ModuleAnalyzer.cpp
+++ b/lib/Analysis/ModuleAnalyzer.cpp
@@ -12,7 +12,7 @@
#include "llvm/BasicBlock.h"
#include "llvm/DerivedTypes.h"
#include "llvm/ConstPoolVals.h"
-#include "llvm/Support/STLExtras.h"
+#include "Support/STLExtras.h"
#include <map>
// processModule - Driver function to call all of my subclasses virtual methods.
diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp
index 2bc3edb..2ed02db 100644
--- a/lib/Analysis/PostDominators.cpp
+++ b/lib/Analysis/PostDominators.cpp
@@ -6,9 +6,9 @@
#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/SimplifyCFG.h" // To get cfg::UnifyAllExitNodes
-#include "llvm/Support/DepthFirstIterator.h"
-#include "llvm/Support/STLExtras.h"
#include "llvm/Method.h"
+#include "Support/DepthFirstIterator.h"
+#include "Support/STLExtras.h"
#include <algorithm>
//===----------------------------------------------------------------------===//
diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h
index 0f25f54..76052fa 100644
--- a/lib/AsmParser/ParserInternals.h
+++ b/lib/AsmParser/ParserInternals.h
@@ -18,7 +18,7 @@
#include "llvm/Method.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Assembly/Parser.h"
-#include "llvm/Support/StringExtras.h"
+#include "Support/StringExtras.h"
class Module;
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index aca9878..0f5c11e 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -21,8 +21,8 @@
#include "llvm/DerivedTypes.h"
#include "llvm/iTerminators.h"
#include "llvm/iMemory.h"
-#include "llvm/Support/STLExtras.h"
-#include "llvm/Support/DepthFirstIterator.h"
+#include "Support/STLExtras.h"
+#include "Support/DepthFirstIterator.h"
#include <list>
#include <utility> // Get definition of pair class
#include <algorithm>
diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp
index 3211e72..6fed526 100644
--- a/lib/Bytecode/Writer/SlotCalculator.cpp
+++ b/lib/Bytecode/Writer/SlotCalculator.cpp
@@ -19,8 +19,8 @@
#include "llvm/iOther.h"
#include "llvm/DerivedTypes.h"
#include "llvm/SymbolTable.h"
-#include "llvm/Support/STLExtras.h"
-#include "llvm/Support/DepthFirstIterator.h"
+#include "Support/DepthFirstIterator.h"
+#include "Support/STLExtras.h"
#include <algorithm>
#if 0
diff --git a/lib/CodeGen/InstrSched/InstrScheduling.cpp b/lib/CodeGen/InstrSched/InstrScheduling.cpp
index 0ba218d..528e5ab 100644
--- a/lib/CodeGen/InstrSched/InstrScheduling.cpp
+++ b/lib/CodeGen/InstrSched/InstrScheduling.cpp
@@ -13,15 +13,11 @@
//************************* User Include Files *****************************/
#include "llvm/CodeGen/InstrScheduling.h"
-#include "SchedPriorities.h"
#include "llvm/Analysis/LiveVar/BBLiveVar.h"
#include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Instruction.h"
-
-
-//************************ System Include Files *****************************/
-
+#include "Support/CommandLine.h"
+#include "SchedPriorities.h"
#include <hash_set>
#include <algorithm>
#include <iterator>
diff --git a/lib/CodeGen/InstrSched/SchedGraph.cpp b/lib/CodeGen/InstrSched/SchedGraph.cpp
index 9d3651a..9e9af5b 100644
--- a/lib/CodeGen/InstrSched/SchedGraph.cpp
+++ b/lib/CodeGen/InstrSched/SchedGraph.cpp
@@ -21,8 +21,8 @@
#include "llvm/CodeGen/InstrSelection.h"
#include "llvm/Target/MachineInstrInfo.h"
#include "llvm/Target/MachineRegInfo.h"
-#include "llvm/Support/StringExtras.h"
#include "llvm/iOther.h"
+#include "Support/StringExtras.h"
#include <algorithm>
#include <hash_map>
#include <vector>
@@ -132,7 +132,7 @@
}
void SchedGraphEdge::dump(int indent=0) const {
- printIndent(indent); cout << *this;
+ cout << string(indent*2, ' ') << *this;
}
@@ -168,7 +168,7 @@
}
void SchedGraphNode::dump(int indent=0) const {
- printIndent(indent); cout << *this;
+ cout << string(indent*2, ' ') << *this;
}
@@ -1023,32 +1023,24 @@
ostream&
operator<<(ostream& os, const SchedGraphNode& node)
{
- printIndent(4, os);
- os << "Node " << node.nodeId << " : "
- << "latency = " << node.latency << endl;
-
- printIndent(6, os);
+ os << string(8, ' ')
+ << "Node " << node.nodeId << " : "
+ << "latency = " << node.latency << endl << string(12, ' ');
if (node.getMachineInstr() == NULL)
os << "(Dummy node)" << endl;
else
{
- os << *node.getMachineInstr() << endl;
-
- printIndent(6, os);
+ os << *node.getMachineInstr() << endl << string(12, ' ');
os << node.inEdges.size() << " Incoming Edges:" << endl;
for (unsigned i=0, N=node.inEdges.size(); i < N; i++)
- {
- printIndent(8, os);
- os << * node.inEdges[i];
- }
+ os << string(16, ' ') << *node.inEdges[i];
- printIndent(6, os);
- os << node.outEdges.size() << " Outgoing Edges:" << endl;
+ os << string(12, ' ') << node.outEdges.size()
+ << " Outgoing Edges:" << endl;
for (unsigned i=0, N=node.outEdges.size(); i < N; i++)
{
- printIndent(8, os);
- os << * node.outEdges[i];
+ os << string(16, ' ') << * node.outEdges[i];
}
}
diff --git a/lib/CodeGen/InstrSched/SchedGraph.h b/lib/CodeGen/InstrSched/SchedGraph.h
index 44d59a1..a4567a5 100644
--- a/lib/CodeGen/InstrSched/SchedGraph.h
+++ b/lib/CodeGen/InstrSched/SchedGraph.h
@@ -19,11 +19,11 @@
#ifndef LLVM_CODEGEN_SCHEDGRAPH_H
#define LLVM_CODEGEN_SCHEDGRAPH_H
-#include "llvm/Support/NonCopyable.h"
-#include "llvm/Support/HashExtras.h"
-#include "llvm/Support/GraphTraits.h"
#include "llvm/Target/MachineInstrInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "Support/NonCopyable.h"
+#include "Support/HashExtras.h"
+#include "Support/GraphTraits.h"
#include <hash_map>
class Value;
diff --git a/lib/CodeGen/InstrSched/SchedPriorities.cpp b/lib/CodeGen/InstrSched/SchedPriorities.cpp
index 31d9f6c..acbe552 100644
--- a/lib/CodeGen/InstrSched/SchedPriorities.cpp
+++ b/lib/CodeGen/InstrSched/SchedPriorities.cpp
@@ -19,7 +19,7 @@
//**************************************************************************/
#include "SchedPriorities.h"
-#include "llvm/Support/PostOrderIterator.h"
+#include "Support/PostOrderIterator.h"
SchedPriorities::SchedPriorities(const Method* method,
diff --git a/lib/CodeGen/InstrSelection/InstrForest.cpp b/lib/CodeGen/InstrSelection/InstrForest.cpp
index f928683..c6d5367 100644
--- a/lib/CodeGen/InstrSelection/InstrForest.cpp
+++ b/lib/CodeGen/InstrSelection/InstrForest.cpp
@@ -30,7 +30,7 @@
#include "llvm/ConstPoolVals.h"
#include "llvm/BasicBlock.h"
#include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/Support/STLExtras.h"
+#include "Support/STLExtras.h"
//------------------------------------------------------------------------
// class InstrTreeNode
diff --git a/lib/CodeGen/InstrSelection/InstrSelection.cpp b/lib/CodeGen/InstrSelection/InstrSelection.cpp
index f27ad71..ce26a1d 100644
--- a/lib/CodeGen/InstrSelection/InstrSelection.cpp
+++ b/lib/CodeGen/InstrSelection/InstrSelection.cpp
@@ -17,12 +17,12 @@
#include "llvm/CodeGen/InstrSelection.h"
#include "llvm/CodeGen/InstrSelectionSupport.h"
#include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Instruction.h"
#include "llvm/BasicBlock.h"
#include "llvm/Method.h"
#include "llvm/iOther.h"
#include "llvm/Target/MachineRegInfo.h"
+#include "Support/CommandLine.h"
#include <string.h>
diff --git a/lib/CodeGen/RegAlloc/RegAllocCommon.h b/lib/CodeGen/RegAlloc/RegAllocCommon.h
index 5fa51c0..02b3331 100644
--- a/lib/CodeGen/RegAlloc/RegAllocCommon.h
+++ b/lib/CodeGen/RegAlloc/RegAllocCommon.h
@@ -1,5 +1,5 @@
-#include "llvm/Support/CommandLine.h"
+#include "Support/CommandLine.h"
#ifndef REG_ALLOC_COMMON_H
#define REG_ALLOC_COMMON_H
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp
index 538e39a..2f0ee41 100644
--- a/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -26,7 +26,7 @@
#ifdef PROFILE_STRUCTURE_FIELDS
-#include "llvm/Support/CommandLine.h"
+#include "Support/CommandLine.h"
static cl::Flag ProfileStructureFields("profilestructfields",
"Profile Structure Field Accesses");
#include <map>
diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
index bc337ee..f693816 100644
--- a/lib/Support/CommandLine.cpp
+++ b/lib/Support/CommandLine.cpp
@@ -9,8 +9,8 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/STLExtras.h"
+#include "Support/CommandLine.h"
+#include "Support/STLExtras.h"
#include <vector>
#include <algorithm>
#include <map>
diff --git a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp
index 0ba218d..528e5ab 100644
--- a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp
+++ b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp
@@ -13,15 +13,11 @@
//************************* User Include Files *****************************/
#include "llvm/CodeGen/InstrScheduling.h"
-#include "SchedPriorities.h"
#include "llvm/Analysis/LiveVar/BBLiveVar.h"
#include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Instruction.h"
-
-
-//************************ System Include Files *****************************/
-
+#include "Support/CommandLine.h"
+#include "SchedPriorities.h"
#include <hash_set>
#include <algorithm>
#include <iterator>
diff --git a/lib/Target/SparcV9/InstrSched/SchedGraph.cpp b/lib/Target/SparcV9/InstrSched/SchedGraph.cpp
index 9d3651a..9e9af5b 100644
--- a/lib/Target/SparcV9/InstrSched/SchedGraph.cpp
+++ b/lib/Target/SparcV9/InstrSched/SchedGraph.cpp
@@ -21,8 +21,8 @@
#include "llvm/CodeGen/InstrSelection.h"
#include "llvm/Target/MachineInstrInfo.h"
#include "llvm/Target/MachineRegInfo.h"
-#include "llvm/Support/StringExtras.h"
#include "llvm/iOther.h"
+#include "Support/StringExtras.h"
#include <algorithm>
#include <hash_map>
#include <vector>
@@ -132,7 +132,7 @@
}
void SchedGraphEdge::dump(int indent=0) const {
- printIndent(indent); cout << *this;
+ cout << string(indent*2, ' ') << *this;
}
@@ -168,7 +168,7 @@
}
void SchedGraphNode::dump(int indent=0) const {
- printIndent(indent); cout << *this;
+ cout << string(indent*2, ' ') << *this;
}
@@ -1023,32 +1023,24 @@
ostream&
operator<<(ostream& os, const SchedGraphNode& node)
{
- printIndent(4, os);
- os << "Node " << node.nodeId << " : "
- << "latency = " << node.latency << endl;
-
- printIndent(6, os);
+ os << string(8, ' ')
+ << "Node " << node.nodeId << " : "
+ << "latency = " << node.latency << endl << string(12, ' ');
if (node.getMachineInstr() == NULL)
os << "(Dummy node)" << endl;
else
{
- os << *node.getMachineInstr() << endl;
-
- printIndent(6, os);
+ os << *node.getMachineInstr() << endl << string(12, ' ');
os << node.inEdges.size() << " Incoming Edges:" << endl;
for (unsigned i=0, N=node.inEdges.size(); i < N; i++)
- {
- printIndent(8, os);
- os << * node.inEdges[i];
- }
+ os << string(16, ' ') << *node.inEdges[i];
- printIndent(6, os);
- os << node.outEdges.size() << " Outgoing Edges:" << endl;
+ os << string(12, ' ') << node.outEdges.size()
+ << " Outgoing Edges:" << endl;
for (unsigned i=0, N=node.outEdges.size(); i < N; i++)
{
- printIndent(8, os);
- os << * node.outEdges[i];
+ os << string(16, ' ') << * node.outEdges[i];
}
}
diff --git a/lib/Target/SparcV9/InstrSched/SchedGraph.h b/lib/Target/SparcV9/InstrSched/SchedGraph.h
index 44d59a1..a4567a5 100644
--- a/lib/Target/SparcV9/InstrSched/SchedGraph.h
+++ b/lib/Target/SparcV9/InstrSched/SchedGraph.h
@@ -19,11 +19,11 @@
#ifndef LLVM_CODEGEN_SCHEDGRAPH_H
#define LLVM_CODEGEN_SCHEDGRAPH_H
-#include "llvm/Support/NonCopyable.h"
-#include "llvm/Support/HashExtras.h"
-#include "llvm/Support/GraphTraits.h"
#include "llvm/Target/MachineInstrInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "Support/NonCopyable.h"
+#include "Support/HashExtras.h"
+#include "Support/GraphTraits.h"
#include <hash_map>
class Value;
diff --git a/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp b/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp
index 31d9f6c..acbe552 100644
--- a/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp
+++ b/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp
@@ -19,7 +19,7 @@
//**************************************************************************/
#include "SchedPriorities.h"
-#include "llvm/Support/PostOrderIterator.h"
+#include "Support/PostOrderIterator.h"
SchedPriorities::SchedPriorities(const Method* method,
diff --git a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp
index f928683..c6d5367 100644
--- a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp
+++ b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp
@@ -30,7 +30,7 @@
#include "llvm/ConstPoolVals.h"
#include "llvm/BasicBlock.h"
#include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/Support/STLExtras.h"
+#include "Support/STLExtras.h"
//------------------------------------------------------------------------
// class InstrTreeNode
diff --git a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
index f27ad71..ce26a1d 100644
--- a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
+++ b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
@@ -17,12 +17,12 @@
#include "llvm/CodeGen/InstrSelection.h"
#include "llvm/CodeGen/InstrSelectionSupport.h"
#include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Instruction.h"
#include "llvm/BasicBlock.h"
#include "llvm/Method.h"
#include "llvm/iOther.h"
#include "llvm/Target/MachineRegInfo.h"
+#include "Support/CommandLine.h"
#include <string.h>
diff --git a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
index 32201be..e981a86 100644
--- a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
+++ b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
@@ -11,7 +11,7 @@
#include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/Support/PostOrderIterator.h"
+#include "Support/PostOrderIterator.h"
/************************** Constructor/Destructor ***************************/
diff --git a/lib/Target/SparcV9/RegAlloc/RegAllocCommon.h b/lib/Target/SparcV9/RegAlloc/RegAllocCommon.h
index 5fa51c0..02b3331 100644
--- a/lib/Target/SparcV9/RegAlloc/RegAllocCommon.h
+++ b/lib/Target/SparcV9/RegAlloc/RegAllocCommon.h
@@ -1,5 +1,5 @@
-#include "llvm/Support/CommandLine.h"
+#include "Support/CommandLine.h"
#ifndef REG_ALLOC_COMMON_H
#define REG_ALLOC_COMMON_H
diff --git a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
index 618fb6d..3edeb96 100644
--- a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
+++ b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
@@ -19,8 +19,8 @@
#include "llvm/BasicBlock.h"
#include "llvm/Method.h"
#include "llvm/Module.h"
-#include "llvm/Support/HashExtras.h"
-#include "llvm/Support/StringExtras.h"
+#include "Support/StringExtras.h"
+#include "Support/HashExtras.h"
#include <locale.h>
namespace {
@@ -161,6 +161,69 @@
}
};
+
+// Can we treat the specified array as a string? Only if it is an array of
+// ubytes or non-negative sbytes.
+//
+static bool isStringCompatible(ConstPoolArray *CPA) {
+ const Type *ETy = cast<ArrayType>(CPA->getType())->getElementType();
+ if (ETy == Type::UByteTy) return true;
+ if (ETy != Type::SByteTy) return false;
+
+ for (unsigned i = 0; i < CPA->getNumOperands(); ++i)
+ if (cast<ConstPoolSInt>(CPA->getOperand(i))->getValue() < 0)
+ return false;
+
+ return true;
+}
+
+// toOctal - Convert the low order bits of X into an octal letter
+static inline char toOctal(int X) {
+ return (X&7)+'0';
+}
+
+// getAsCString - Return the specified array as a C compatible string, only if
+// the predicate isStringCompatible is true.
+//
+static string getAsCString(ConstPoolArray *CPA) {
+ if (isStringCompatible(CPA)) {
+ string Result;
+ const Type *ETy = cast<ArrayType>(CPA->getType())->getElementType();
+ Result = "\"";
+ for (unsigned i = 0; i < CPA->getNumOperands(); ++i) {
+ unsigned char C = (ETy == Type::SByteTy) ?
+ (unsigned char)cast<ConstPoolSInt>(CPA->getOperand(i))->getValue() :
+ (unsigned char)cast<ConstPoolUInt>(CPA->getOperand(i))->getValue();
+
+ if (isprint(C)) {
+ Result += C;
+ } else {
+ switch(C) {
+ case '\a': Result += "\\a"; break;
+ case '\b': Result += "\\b"; break;
+ case '\f': Result += "\\f"; break;
+ case '\n': Result += "\\n"; break;
+ case '\r': Result += "\\r"; break;
+ case '\t': Result += "\\t"; break;
+ case '\v': Result += "\\v"; break;
+ default:
+ Result += '\\';
+ Result += toOctal(C >> 6);
+ Result += toOctal(C >> 3);
+ Result += toOctal(C >> 0);
+ break;
+ }
+ }
+ }
+ Result += "\"";
+
+ return Result;
+ } else {
+ return CPA->getStrValue();
+ }
+}
+
+
inline bool
SparcAsmPrinter::OpIsBranchTargetLabel(const MachineInstr *MI,
unsigned int opNum) {
diff --git a/lib/Target/SparcV9/SparcV9InstrSelection.cpp b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
index c1b8aa3..631d609 100644
--- a/lib/Target/SparcV9/SparcV9InstrSelection.cpp
+++ b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
@@ -16,7 +16,6 @@
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/InstrForest.h"
#include "llvm/CodeGen/InstrSelection.h"
-#include "llvm/Support/MathExtras.h"
#include "llvm/DerivedTypes.h"
#include "llvm/iTerminators.h"
#include "llvm/iMemory.h"
@@ -24,10 +23,9 @@
#include "llvm/BasicBlock.h"
#include "llvm/Method.h"
#include "llvm/ConstPoolVals.h"
+#include "Support/MathExtras.h"
#include <math.h>
-//******************** Internal Data Declarations ************************/
-
//************************* Forward Declarations ***************************/
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index 327cb63..a1d92f1 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -8,13 +8,13 @@
#include "TransformInternals.h"
#include "llvm/Method.h"
-#include "llvm/Support/STLExtras.h"
#include "llvm/iOther.h"
#include "llvm/iMemory.h"
#include "llvm/ConstPoolVals.h"
#include "llvm/Optimizations/ConstantHandling.h"
#include "llvm/Optimizations/DCE.h"
#include "llvm/Analysis/Expressions.h"
+#include "Support/STLExtras.h"
#include <map>
#include <algorithm>
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp
index 24945c0..7395bab 100644
--- a/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/lib/Transforms/IPO/GlobalDCE.cpp
@@ -6,9 +6,9 @@
#include "llvm/Transforms/IPO/GlobalDCE.h"
#include "llvm/Analysis/CallGraph.h"
-#include "llvm/Support/DepthFirstIterator.h"
#include "llvm/Module.h"
#include "llvm/Method.h"
+#include "Support/DepthFirstIterator.h"
#include <set>
static bool RemoveUnreachableMethods(Module *M, cfg::CallGraph *CG) {
diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp
index f59b0ae..07db028 100644
--- a/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -27,8 +27,8 @@
#include "llvm/Module.h"
#include "llvm/SymbolTable.h"
#include "llvm/Assembly/Writer.h"
-#include "llvm/Support/HashExtras.h"
-#include "llvm/Support/StringExtras.h"
+#include "Support/StringExtras.h"
+#include "Support/HashExtras.h"
#include <hash_set>
#include <sstream>
diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp
index d4bf823..f802705 100644
--- a/lib/Transforms/LevelRaise.cpp
+++ b/lib/Transforms/LevelRaise.cpp
@@ -9,7 +9,6 @@
#include "llvm/Transforms/LevelChange.h"
#include "TransformInternals.h"
#include "llvm/Method.h"
-#include "llvm/Support/STLExtras.h"
#include "llvm/iOther.h"
#include "llvm/iMemory.h"
#include "llvm/ConstPoolVals.h"
@@ -17,6 +16,7 @@
#include "llvm/Optimizations/DCE.h"
#include "llvm/Optimizations/ConstantProp.h"
#include "llvm/Analysis/Expressions.h"
+#include "Support/STLExtras.h"
#include <algorithm>
#include "llvm/Assembly/Writer.h"
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index 14a1811..a5d1d12 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -10,11 +10,11 @@
#include "llvm/Instruction.h"
#include "llvm/Type.h"
#include "llvm/Analysis/Dominators.h"
-#include "llvm/Support/STLExtras.h"
-#include "llvm/Support/DepthFirstIterator.h"
#include "llvm/Analysis/Writer.h"
#include "llvm/iTerminators.h"
#include "llvm/iOther.h"
+#include "Support/STLExtras.h"
+#include "Support/DepthFirstIterator.h"
#include <set>
#include <algorithm>
diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp
index 16d9534..caacf32 100644
--- a/lib/Transforms/Scalar/DCE.cpp
+++ b/lib/Transforms/Scalar/DCE.cpp
@@ -24,7 +24,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/Optimizations/DCE.h"
-#include "llvm/Support/STLExtras.h"
#include "llvm/Module.h"
#include "llvm/GlobalVariable.h"
#include "llvm/Method.h"
@@ -32,6 +31,7 @@
#include "llvm/iTerminators.h"
#include "llvm/iOther.h"
#include "llvm/Assembly/Writer.h"
+#include "Support/STLExtras.h"
#include <algorithm>
// dceInstruction - Inspect the instruction at *BBI and figure out if it's
diff --git a/lib/Transforms/Scalar/InductionVars.cpp b/lib/Transforms/Scalar/InductionVars.cpp
index 1cec66d..9f0513f 100644
--- a/lib/Transforms/Scalar/InductionVars.cpp
+++ b/lib/Transforms/Scalar/InductionVars.cpp
@@ -23,9 +23,9 @@
#include "llvm/ConstPoolVals.h"
#include "llvm/Analysis/IntervalPartition.h"
#include "llvm/Assembly/Writer.h"
-#include "llvm/Support/STLExtras.h"
#include "llvm/SymbolTable.h"
#include "llvm/iOther.h"
+#include "Support/STLExtras.h"
#include <algorithm>
#include "llvm/Analysis/LoopDepth.h"
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index bca3f9b..256fadf 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -24,8 +24,8 @@
#include "llvm/iOther.h"
#include "llvm/iMemory.h"
#include "llvm/iTerminators.h"
-#include "llvm/Support/STLExtras.h"
#include "llvm/Assembly/Writer.h"
+#include "Support/STLExtras.h"
#include <algorithm>
#include <map>
#include <set>
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 1bfdff9..2be1723 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -21,8 +21,8 @@
#include "llvm/iMemory.h"
#include "llvm/iTerminators.h"
#include "llvm/SymbolTable.h"
-#include "llvm/Support/STLExtras.h"
-#include "llvm/Support/StringExtras.h"
+#include "Support/StringExtras.h"
+#include "Support/STLExtras.h"
#include <algorithm>
#include <map>
diff --git a/lib/VMCore/ConstPoolVals.cpp b/lib/VMCore/ConstPoolVals.cpp
index 3b8fe10..dd30171 100644
--- a/lib/VMCore/ConstPoolVals.cpp
+++ b/lib/VMCore/ConstPoolVals.cpp
@@ -6,12 +6,12 @@
#define __STDC_LIMIT_MACROS // Get defs for INT64_MAX and friends...
#include "llvm/ConstPoolVals.h"
-#include "llvm/Support/StringExtras.h" // itostr
#include "llvm/DerivedTypes.h"
#include "llvm/SymbolTable.h"
#include "llvm/GlobalValue.h"
#include "llvm/Module.h"
#include "llvm/Analysis/SlotCalculator.h"
+#include "Support/StringExtras.h"
#include <algorithm>
#include <assert.h>
diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp
index 2bc3edb..2ed02db 100644
--- a/lib/VMCore/Dominators.cpp
+++ b/lib/VMCore/Dominators.cpp
@@ -6,9 +6,9 @@
#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/SimplifyCFG.h" // To get cfg::UnifyAllExitNodes
-#include "llvm/Support/DepthFirstIterator.h"
-#include "llvm/Support/STLExtras.h"
#include "llvm/Method.h"
+#include "Support/DepthFirstIterator.h"
+#include "Support/STLExtras.h"
#include <algorithm>
//===----------------------------------------------------------------------===//
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index bb5e5b5..86b944d 100644
--- a/lib/VMCore/Module.cpp
+++ b/lib/VMCore/Module.cpp
@@ -10,9 +10,9 @@
#include "llvm/BasicBlock.h"
#include "llvm/InstrTypes.h"
#include "llvm/ValueHolderImpl.h"
-#include "llvm/Support/STLExtras.h"
#include "llvm/Type.h"
#include "llvm/ConstPoolVals.h"
+#include "Support/STLExtras.h"
#include <map>
// Instantiate Templates - This ugliness is the price we have to pay
diff --git a/lib/VMCore/SlotCalculator.cpp b/lib/VMCore/SlotCalculator.cpp
index 3211e72..6fed526 100644
--- a/lib/VMCore/SlotCalculator.cpp
+++ b/lib/VMCore/SlotCalculator.cpp
@@ -19,8 +19,8 @@
#include "llvm/iOther.h"
#include "llvm/DerivedTypes.h"
#include "llvm/SymbolTable.h"
-#include "llvm/Support/STLExtras.h"
-#include "llvm/Support/DepthFirstIterator.h"
+#include "Support/DepthFirstIterator.h"
+#include "Support/STLExtras.h"
#include <algorithm>
#if 0
diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp
index b8da428..c32cec9 100644
--- a/lib/VMCore/SymbolTable.cpp
+++ b/lib/VMCore/SymbolTable.cpp
@@ -6,10 +6,10 @@
#include "llvm/SymbolTable.h"
#include "llvm/InstrTypes.h"
-#include "llvm/Support/StringExtras.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/Method.h"
+#include "Support/StringExtras.h"
#define DEBUG_SYMBOL_TABLE 0
#define DEBUG_ABSTYPE 0
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 53844d6..5f39682 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -5,9 +5,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/DerivedTypes.h"
-#include "llvm/Support/StringExtras.h"
#include "llvm/SymbolTable.h"
-#include "llvm/Support/STLExtras.h"
+#include "Support/StringExtras.h"
+#include "Support/STLExtras.h"
// 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
diff --git a/support/lib/Support/CommandLine.cpp b/support/lib/Support/CommandLine.cpp
index bc337ee..f693816 100644
--- a/support/lib/Support/CommandLine.cpp
+++ b/support/lib/Support/CommandLine.cpp
@@ -9,8 +9,8 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/STLExtras.h"
+#include "Support/CommandLine.h"
+#include "Support/STLExtras.h"
#include <vector>
#include <algorithm>
#include <map>
diff --git a/support/lib/Support/StringExtras.cpp b/support/lib/Support/StringExtras.cpp
deleted file mode 100644
index 2229df0..0000000
--- a/support/lib/Support/StringExtras.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-#include "llvm/Support/StringExtras.h"
-#include "llvm/ConstPoolVals.h"
-#include "llvm/DerivedTypes.h"
-
-// Can we treat the specified array as a string? Only if it is an array of
-// ubytes or non-negative sbytes.
-//
-bool isStringCompatible(ConstPoolArray *CPA) {
- const Type *ETy = cast<ArrayType>(CPA->getType())->getElementType();
- if (ETy == Type::UByteTy) return true;
- if (ETy != Type::SByteTy) return false;
-
- for (unsigned i = 0; i < CPA->getNumOperands(); ++i)
- if (cast<ConstPoolSInt>(CPA->getOperand(i))->getValue() < 0)
- return false;
-
- return true;
-}
-
-// toOctal - Convert the low order bits of X into an octal letter
-static inline char toOctal(int X) {
- return (X&7)+'0';
-}
-
-// getAsCString - Return the specified array as a C compatible string, only if
-// the predicate isStringCompatible is true.
-//
-string getAsCString(ConstPoolArray *CPA) {
- if (isStringCompatible(CPA)) {
- string Result;
- const Type *ETy = cast<ArrayType>(CPA->getType())->getElementType();
- Result = "\"";
- for (unsigned i = 0; i < CPA->getNumOperands(); ++i) {
- unsigned char C = (ETy == Type::SByteTy) ?
- (unsigned char)cast<ConstPoolSInt>(CPA->getOperand(i))->getValue() :
- (unsigned char)cast<ConstPoolUInt>(CPA->getOperand(i))->getValue();
-
- if (isprint(C)) {
- Result += C;
- } else {
- switch(C) {
- case '\a': Result += "\\a"; break;
- case '\b': Result += "\\b"; break;
- case '\f': Result += "\\f"; break;
- case '\n': Result += "\\n"; break;
- case '\r': Result += "\\r"; break;
- case '\t': Result += "\\t"; break;
- case '\v': Result += "\\v"; break;
- default:
- Result += '\\';
- Result += toOctal(C >> 6);
- Result += toOctal(C >> 3);
- Result += toOctal(C >> 0);
- break;
- }
- }
- }
- Result += "\"";
-
- return Result;
- } else {
- return CPA->getStrValue();
- }
-}
diff --git a/tools/analyze/analyze.cpp b/tools/analyze/analyze.cpp
index ec5d2c0..da7de6e 100644
--- a/tools/analyze/analyze.cpp
+++ b/tools/analyze/analyze.cpp
@@ -15,9 +15,7 @@
#include "llvm/Method.h"
#include "llvm/Bytecode/Reader.h"
#include "llvm/Assembly/Parser.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Analysis/Writer.h"
-
#include "llvm/Analysis/InstForest.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/IntervalPartition.h"
@@ -27,6 +25,7 @@
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/FindUnsafePointerTypes.h"
#include "llvm/Analysis/FindUsedTypes.h"
+#include "Support/CommandLine.h"
#include <algorithm>
static void PrintMethod(Method *M) {
diff --git a/tools/as/as.cpp b/tools/as/as.cpp
index 72b63ec..ee664f1 100644
--- a/tools/as/as.cpp
+++ b/tools/as/as.cpp
@@ -9,14 +9,13 @@
//
//===------------------------------------------------------------------------===
-#include <iostream.h>
-#include <fstream.h>
-#include <string>
#include "llvm/Module.h"
#include "llvm/Assembly/Parser.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Bytecode/Writer.h"
-#include "llvm/Support/CommandLine.h"
+#include "Support/CommandLine.h"
+#include <fstream>
+#include <string>
cl::String InputFilename ("", "Parse <arg> file, compile to bytecode", 0, "-");
cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
diff --git a/tools/dis/dis.cpp b/tools/dis/dis.cpp
index 712cf85..2a7eb4e 100644
--- a/tools/dis/dis.cpp
+++ b/tools/dis/dis.cpp
@@ -16,15 +16,14 @@
//
//===----------------------------------------------------------------------===//
-#include <iostream.h>
-#include <fstream.h>
#include "llvm/Module.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Bytecode/Reader.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Method.h"
-#include "llvm/Support/DepthFirstIterator.h"
-#include "llvm/Support/PostOrderIterator.h"
+#include "Support/DepthFirstIterator.h"
+#include "Support/PostOrderIterator.h"
+#include "Support/CommandLine.h"
+#include <fstream>
// OutputMode - The different orderings to print basic blocks in...
enum OutputMode {
diff --git a/tools/gccas/gccas.cpp b/tools/gccas/gccas.cpp
index e19508f..c5ab2df 100644
--- a/tools/gccas/gccas.cpp
+++ b/tools/gccas/gccas.cpp
@@ -15,7 +15,7 @@
#include "llvm/Optimizations/DCE.h"
#include "llvm/Transforms/ConstantMerge.h"
#include "llvm/Bytecode/Writer.h"
-#include "llvm/Support/CommandLine.h"
+#include "Support/CommandLine.h"
#include <memory>
#include <fstream>
#include <string>
diff --git a/tools/link/link.cpp b/tools/link/link.cpp
index 80a39b2..9bf766f 100644
--- a/tools/link/link.cpp
+++ b/tools/link/link.cpp
@@ -13,10 +13,10 @@
#include "llvm/Bytecode/Reader.h"
#include "llvm/Bytecode/Writer.h"
#include "llvm/Assembly/Writer.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Module.h"
#include "llvm/Method.h"
-#include <fstream.h>
+#include "Support/CommandLine.h"
+#include <fstream>
#include <memory>
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index 1490cf4..7c8c3a6 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -13,9 +13,9 @@
#include "llvm/Assembly/PrintModulePass.h"
#include "llvm/Bytecode/WriteBytecodePass.h"
#include "llvm/Transforms/ConstantMerge.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Module.h"
#include "llvm/Method.h"
+#include "Support/CommandLine.h"
#include <memory>
#include <string>
#include <fstream>
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp
index ef9dddf..f4145c1 100644
--- a/tools/lli/lli.cpp
+++ b/tools/lli/lli.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#include "Interpreter.h"
-#include "llvm/Support/CommandLine.h"
+#include "Support/CommandLine.h"
cl::StringList InputArgv("" , "Input command line", cl::ConsumeAfter);
cl::String MainFunction ("f" , "Function to execute", cl::NoFlags, "main");
diff --git a/tools/llvm-as/as.cpp b/tools/llvm-as/as.cpp
index 72b63ec..ee664f1 100644
--- a/tools/llvm-as/as.cpp
+++ b/tools/llvm-as/as.cpp
@@ -9,14 +9,13 @@
//
//===------------------------------------------------------------------------===
-#include <iostream.h>
-#include <fstream.h>
-#include <string>
#include "llvm/Module.h"
#include "llvm/Assembly/Parser.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Bytecode/Writer.h"
-#include "llvm/Support/CommandLine.h"
+#include "Support/CommandLine.h"
+#include <fstream>
+#include <string>
cl::String InputFilename ("", "Parse <arg> file, compile to bytecode", 0, "-");
cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp
index 72b63ec..ee664f1 100644
--- a/tools/llvm-as/llvm-as.cpp
+++ b/tools/llvm-as/llvm-as.cpp
@@ -9,14 +9,13 @@
//
//===------------------------------------------------------------------------===
-#include <iostream.h>
-#include <fstream.h>
-#include <string>
#include "llvm/Module.h"
#include "llvm/Assembly/Parser.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Bytecode/Writer.h"
-#include "llvm/Support/CommandLine.h"
+#include "Support/CommandLine.h"
+#include <fstream>
+#include <string>
cl::String InputFilename ("", "Parse <arg> file, compile to bytecode", 0, "-");
cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
diff --git a/tools/llvm-dis/dis.cpp b/tools/llvm-dis/dis.cpp
index 712cf85..2a7eb4e 100644
--- a/tools/llvm-dis/dis.cpp
+++ b/tools/llvm-dis/dis.cpp
@@ -16,15 +16,14 @@
//
//===----------------------------------------------------------------------===//
-#include <iostream.h>
-#include <fstream.h>
#include "llvm/Module.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Bytecode/Reader.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Method.h"
-#include "llvm/Support/DepthFirstIterator.h"
-#include "llvm/Support/PostOrderIterator.h"
+#include "Support/DepthFirstIterator.h"
+#include "Support/PostOrderIterator.h"
+#include "Support/CommandLine.h"
+#include <fstream>
// OutputMode - The different orderings to print basic blocks in...
enum OutputMode {
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp
index 712cf85..2a7eb4e 100644
--- a/tools/llvm-dis/llvm-dis.cpp
+++ b/tools/llvm-dis/llvm-dis.cpp
@@ -16,15 +16,14 @@
//
//===----------------------------------------------------------------------===//
-#include <iostream.h>
-#include <fstream.h>
#include "llvm/Module.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Bytecode/Reader.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Method.h"
-#include "llvm/Support/DepthFirstIterator.h"
-#include "llvm/Support/PostOrderIterator.h"
+#include "Support/DepthFirstIterator.h"
+#include "Support/PostOrderIterator.h"
+#include "Support/CommandLine.h"
+#include <fstream>
// OutputMode - The different orderings to print basic blocks in...
enum OutputMode {
diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp
index 80a39b2..9bf766f 100644
--- a/tools/llvm-link/llvm-link.cpp
+++ b/tools/llvm-link/llvm-link.cpp
@@ -13,10 +13,10 @@
#include "llvm/Bytecode/Reader.h"
#include "llvm/Bytecode/Writer.h"
#include "llvm/Assembly/Writer.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Module.h"
#include "llvm/Method.h"
-#include <fstream.h>
+#include "Support/CommandLine.h"
+#include <fstream>
#include <memory>
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 0386a49..927a69a 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -9,7 +9,6 @@
#include "llvm/Module.h"
#include "llvm/Bytecode/Reader.h"
#include "llvm/Bytecode/Writer.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Optimizations/AllOpts.h"
#include "llvm/Transforms/Instrumentation/TraceValues.h"
#include "llvm/Assembly/PrintModulePass.h"
@@ -18,6 +17,7 @@
#include "llvm/Transforms/LevelChange.h"
#include "llvm/Transforms/SwapStructContents.h"
#include "llvm/Transforms/IPO/GlobalDCE.h"
+#include "Support/CommandLine.h"
#include <fstream>
#include <memory>