aboutsummaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
Diffstat (limited to 'support')
-rw-r--r--support/Makefile6
-rw-r--r--support/lib/Makefile6
-rw-r--r--support/lib/Support/Annotation.cpp89
-rw-r--r--support/lib/Support/CommandLine.cpp877
-rw-r--r--support/lib/Support/ConstantRange.cpp243
-rw-r--r--support/lib/Support/Debug.cpp57
-rw-r--r--support/lib/Support/FileUtilities.cpp203
-rw-r--r--support/lib/Support/LeakDetector.cpp82
-rw-r--r--support/lib/Support/Makefile5
-rw-r--r--support/lib/Support/Mangler.cpp94
-rw-r--r--support/lib/Support/PluginLoader.cpp31
-rw-r--r--support/lib/Support/Signals.cpp57
-rw-r--r--support/lib/Support/Statistic.cpp99
-rw-r--r--support/lib/Support/SystemUtils.cpp266
-rw-r--r--support/lib/Support/Timer.cpp328
-rw-r--r--support/lib/Support/ToolRunner.cpp374
-rw-r--r--support/lib/Support/ValueHolder.cpp16
-rw-r--r--support/tools/Burg/COPYRIGHT13
-rw-r--r--support/tools/Burg/Doc/Makefile84
-rw-r--r--support/tools/Burg/Doc/doc.aux50
-rw-r--r--support/tools/Burg/Doc/doc.dvibin29856 -> 0 bytes
-rw-r--r--support/tools/Burg/Doc/doc.log157
-rw-r--r--support/tools/Burg/Doc/doc.tex596
-rw-r--r--support/tools/Burg/LOG_CHANGES10
-rw-r--r--support/tools/Burg/Makefile28
-rw-r--r--support/tools/Burg/README14
-rw-r--r--support/tools/Burg/b.h311
-rw-r--r--support/tools/Burg/be.c1052
-rw-r--r--support/tools/Burg/burg.shar.gzbin38843 -> 0 bytes
-rw-r--r--support/tools/Burg/burs.c71
-rw-r--r--support/tools/Burg/closure.c95
-rw-r--r--support/tools/Burg/delta.c143
-rw-r--r--support/tools/Burg/fe.c403
-rw-r--r--support/tools/Burg/fe.h132
-rw-r--r--support/tools/Burg/gram.yc91
-rw-r--r--support/tools/Burg/item.c133
-rw-r--r--support/tools/Burg/lex.c259
-rw-r--r--support/tools/Burg/list.c75
-rw-r--r--support/tools/Burg/main.c182
-rw-r--r--support/tools/Burg/map.c135
-rw-r--r--support/tools/Burg/nonterminal.c49
-rw-r--r--support/tools/Burg/operator.c48
-rw-r--r--support/tools/Burg/pattern.c38
-rw-r--r--support/tools/Burg/plank.c921
-rw-r--r--support/tools/Burg/queue.c64
-rw-r--r--support/tools/Burg/rule.c49
-rw-r--r--support/tools/Burg/sample.gr150
-rw-r--r--support/tools/Burg/string.c65
-rw-r--r--support/tools/Burg/symtab.c38
-rw-r--r--support/tools/Burg/table.c552
-rw-r--r--support/tools/Burg/trim.c412
-rw-r--r--support/tools/Burg/zalloc.c35
-rw-r--r--support/tools/Makefile6
-rw-r--r--support/tools/TableGen/CodeEmitterGen.cpp217
-rw-r--r--support/tools/TableGen/CodeEmitterGen.h24
-rw-r--r--support/tools/TableGen/CodeGenWrappers.cpp89
-rw-r--r--support/tools/TableGen/CodeGenWrappers.h56
-rw-r--r--support/tools/TableGen/FileLexer.l222
-rw-r--r--support/tools/TableGen/FileParser.y510
-rw-r--r--support/tools/TableGen/InstrInfoEmitter.cpp160
-rw-r--r--support/tools/TableGen/InstrInfoEmitter.h34
-rw-r--r--support/tools/TableGen/InstrSelectorEmitter.cpp1287
-rw-r--r--support/tools/TableGen/InstrSelectorEmitter.h387
-rw-r--r--support/tools/TableGen/Makefile18
-rw-r--r--support/tools/TableGen/Record.cpp676
-rw-r--r--support/tools/TableGen/Record.h849
-rw-r--r--support/tools/TableGen/RegisterInfoEmitter.cpp234
-rw-r--r--support/tools/TableGen/RegisterInfoEmitter.h29
-rw-r--r--support/tools/TableGen/TableGen.cpp482
-rw-r--r--support/tools/TableGen/TableGenBackend.cpp27
-rw-r--r--support/tools/TableGen/TableGenBackend.h34
71 files changed, 0 insertions, 14629 deletions
diff --git a/support/Makefile b/support/Makefile
deleted file mode 100644
index ba074f506c..0000000000
--- a/support/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-LEVEL = ..
-
-DIRS = lib tools
-
-include $(LEVEL)/Makefile.common
-
diff --git a/support/lib/Makefile b/support/lib/Makefile
deleted file mode 100644
index f5446d31f6..0000000000
--- a/support/lib/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-LEVEL = ../..
-
-DIRS = Support
-
-include $(LEVEL)/Makefile.common
-
diff --git a/support/lib/Support/Annotation.cpp b/support/lib/Support/Annotation.cpp
deleted file mode 100644
index 9166240b82..0000000000
--- a/support/lib/Support/Annotation.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-//===-- Annotation.cpp - Implement the Annotation Classes --------*- C++ -*--=//
-//
-// This file implements the AnnotationManager class.
-//
-//===----------------------------------------------------------------------===//
-
-#include <map>
-#include "Support/Annotation.h"
-
-typedef std::map<const std::string, unsigned> IDMapType;
-static unsigned IDCounter = 0; // Unique ID counter
-
-// Static member to ensure initialiation on demand.
-static IDMapType &getIDMap() { static IDMapType TheMap; return TheMap; }
-
-// On demand annotation creation support...
-typedef Annotation *(*AnnFactory)(AnnotationID, const Annotable *, void *);
-typedef std::map<unsigned, std::pair<AnnFactory,void*> > FactMapType;
-
-static FactMapType *TheFactMap = 0;
-static FactMapType &getFactMap() {
- if (TheFactMap == 0)
- TheFactMap = new FactMapType();
- return *TheFactMap;
-}
-
-static void eraseFromFactMap(unsigned ID) {
- assert(TheFactMap && "No entries found!");
- TheFactMap->erase(ID);
- if (TheFactMap->empty()) { // Delete when empty
- delete TheFactMap;
- TheFactMap = 0;
- }
-}
-
-
-AnnotationID AnnotationManager::getID(const std::string &Name) { // Name -> ID
- IDMapType::iterator I = getIDMap().find(Name);
- if (I == getIDMap().end()) {
- getIDMap()[Name] = IDCounter++; // Add a new element
- return IDCounter-1;
- }
- return I->second;
-}
-
-// getID - Name -> ID + registration of a factory function for demand driven
-// annotation support.
-AnnotationID AnnotationManager::getID(const std::string &Name, Factory Fact,
- void *Data) {
- AnnotationID Result(getID(Name));
- registerAnnotationFactory(Result, Fact, Data);
- return Result;
-}
-
-
-// getName - This function is especially slow, but that's okay because it should
-// only be used for debugging.
-//
-const std::string &AnnotationManager::getName(AnnotationID ID) { // ID -> Name
- IDMapType &TheMap = getIDMap();
- for (IDMapType::iterator I = TheMap.begin(); ; ++I) {
- assert(I != TheMap.end() && "Annotation ID is unknown!");
- if (I->second == ID.ID) return I->first;
- }
-}
-
-
-// registerAnnotationFactory - This method is used to register a callback
-// function used to create an annotation on demand if it is needed by the
-// Annotable::findOrCreateAnnotation method.
-//
-void AnnotationManager::registerAnnotationFactory(AnnotationID ID,
- AnnFactory F,
- void *ExtraData) {
- if (F)
- getFactMap()[ID.ID] = std::make_pair(F, ExtraData);
- else
- eraseFromFactMap(ID.ID);
-}
-
-// createAnnotation - Create an annotation of the specified ID for the
-// specified object, using a register annotation creation function.
-//
-Annotation *AnnotationManager::createAnnotation(AnnotationID ID,
- const Annotable *Obj) {
- FactMapType::iterator I = getFactMap().find(ID.ID);
- if (I == getFactMap().end()) return 0;
- return I->second.first(ID, Obj, I->second.second);
-}
diff --git a/support/lib/Support/CommandLine.cpp b/support/lib/Support/CommandLine.cpp
deleted file mode 100644
index c0be0ecb34..0000000000
--- a/support/lib/Support/CommandLine.cpp
+++ /dev/null
@@ -1,877 +0,0 @@
-//===-- CommandLine.cpp - Command line parser implementation --------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "Support/CommandLine.h"
-#include <algorithm>
-#include <map>
-#include <set>
-#include <iostream>
-
-using namespace cl;
-
-//===----------------------------------------------------------------------===//
-// Basic, shared command line option processing machinery...
-//
-
-// Return the global command line option vector. Making it a function scoped
-// static ensures that it will be initialized correctly before its first use.
-//
-static std::map<std::string, Option*> *CommandLineOptions = 0;
-static std::map<std::string, Option*> &getOpts() {
- if (CommandLineOptions == 0)
- CommandLineOptions = new std::map<std::string,Option*>();
- return *CommandLineOptions;
-}
-
-static Option *getOption(const std::string &Str) {
- if (CommandLineOptions == 0) return 0;
- std::map<std::string,Option*>::iterator I = CommandLineOptions->find(Str);
- return I != CommandLineOptions->end() ? I->second : 0;
-}
-
-static std::vector<Option*> &getPositionalOpts() {
- static std::vector<Option*> Positional;
- return Positional;
-}
-
-static void AddArgument(const char *ArgName, Option *Opt) {
- if (getOption(ArgName)) {
- std::cerr << "CommandLine Error: Argument '" << ArgName
- << "' defined more than once!\n";
- } else {
- // Add argument to the argument map!
- getOpts()[ArgName] = Opt;
- }
-}
-
-// RemoveArgument - It's possible that the argument is no longer in the map if
-// options have already been processed and the map has been deleted!
-//
-static void RemoveArgument(const char *ArgName, Option *Opt) {
- if (CommandLineOptions == 0) return;
- assert(getOption(ArgName) == Opt && "Arg not in map!");
- CommandLineOptions->erase(ArgName);
- if (CommandLineOptions->empty()) {
- delete CommandLineOptions;
- CommandLineOptions = 0;
- }
-}
-
-static const char *ProgramName = 0;
-static const char *ProgramOverview = 0;
-
-static inline bool ProvideOption(Option *Handler, const char *ArgName,
- const char *Value, int argc, char **argv,
- int &i) {
- // Enforce value requirements
- switch (Handler->getValueExpectedFlag()) {
- case ValueRequired:
- if (Value == 0 || *Value == 0) { // No value specified?
- if (i+1 < argc) { // Steal the next argument, like for '-o filename'
- Value = argv[++i];
- } else {
- return Handler->error(" requires a value!");
- }
- }
- break;
- case ValueDisallowed:
- if (*Value != 0)
- return Handler->error(" does not allow a value! '" +
- std::string(Value) + "' specified.");
- break;
- case ValueOptional: break;
- default: std::cerr << "Bad ValueMask flag! CommandLine usage error:"
- << Handler->getValueExpectedFlag() << "\n"; abort();
- }
-
- // Run the handler now!
- return Handler->addOccurrence(ArgName, Value);
-}
-
-static bool ProvidePositionalOption(Option *Handler, const std::string &Arg) {
- int Dummy;
- return ProvideOption(Handler, Handler->ArgStr, Arg.c_str(), 0, 0, Dummy);
-}
-
-
-// Option predicates...
-static inline bool isGrouping(const Option *O) {
- return O->getFormattingFlag() == cl::Grouping;
-}
-static inline bool isPrefixedOrGrouping(const Option *O) {
- return isGrouping(O) || O->getFormattingFlag() == cl::Prefix;
-}
-
-// getOptionPred - Check to see if there are any options that satisfy the
-// specified predicate with names that are the prefixes in Name. This is
-// checked by progressively stripping characters off of the name, checking to
-// see if there options that satisfy the predicate. If we find one, return it,
-// otherwise return null.
-//
-static Option *getOptionPred(std::string Name, unsigned &Length,
- bool (*Pred)(const Option*)) {
-
- Option *Op = getOption(Name);
- if (Op && Pred(Op)) {
- Length = Name.length();
- return Op;
- }
-
- if (Name.size() == 1) return 0;
- do {
- Name.erase(Name.end()-1, Name.end()); // Chop off the last character...
- Op = getOption(Name);
-
- // Loop while we haven't found an option and Name still has at least two
- // characters in it (so that the next iteration will not be the empty
- // string...
- } while ((Op == 0 || !Pred(Op)) && Name.size() > 1);
-
- if (Op && Pred(Op)) {
- Length = Name.length();
- return Op; // Found one!
- }
- return 0; // No option found!
-}
-
-static bool RequiresValue(const Option *O) {
- return O->getNumOccurrencesFlag() == cl::Required ||
- O->getNumOccurrencesFlag() == cl::OneOrMore;
-}
-
-static bool EatsUnboundedNumberOfValues(const Option *O) {
- return O->getNumOccurrencesFlag() == cl::ZeroOrMore ||
- O->getNumOccurrencesFlag() == cl::OneOrMore;
-}
-
-/// ParseCStringVector - Break INPUT up wherever one or more
-/// whitespace characters are found, and store the resulting tokens in
-/// OUTPUT. The tokens stored in OUTPUT are dynamically allocated
-/// using strdup (), so it is the caller's responsibility to free ()
-/// them later.
-///
-static void ParseCStringVector (std::vector<char *> &output,
- const char *input) {
- // Characters which will be treated as token separators:
- static const char *delims = " \v\f\t\r\n";
-
- std::string work (input);
- // Skip past any delims at head of input string.
- size_t pos = work.find_first_not_of (delims);
- // If the string consists entirely of delims, then exit early.
- if (pos == std::string::npos) return;
- // Otherwise, jump forward to beginning of first word.
- work = work.substr (pos);
- // Find position of first delimiter.
- pos = work.find_first_of (delims);
-
- while (!work.empty() && pos != std::string::npos) {
- // Everything from 0 to POS is the next word to copy.
- output.push_back (strdup (work.substr (0,pos).c_str ()));
- // Is there another word in the string?
- size_t nextpos = work.find_first_not_of (delims, pos + 1);
- if (nextpos != std::string::npos) {
- // Yes? Then remove delims from beginning ...
- work = work.substr (work.find_first_not_of (delims, pos + 1));
- // and find the end of the word.
- pos = work.find_first_of (delims);
- } else {
- // No? (Remainder of string is delims.) End the loop.
- work = "";
- pos = std::string::npos;
- }
- }
-
- // If `input' ended with non-delim char, then we'll get here with
- // the last word of `input' in `work'; copy it now.
- if (!work.empty ()) {
- output.push_back (strdup (work.c_str ()));
- }
-}
-
-/// ParseEnvironmentOptions - An alternative entry point to the
-/// CommandLine library, which allows you to read the program's name
-/// from the caller (as PROGNAME) and its command-line arguments from
-/// an environment variable (whose name is given in ENVVAR).
-///
-void cl::ParseEnvironmentOptions (const char *progName, const char *envVar,
- const char *Overview) {
- // Check args.
- assert (progName && "Program name not specified");
- assert (envVar && "Environment variable name missing");
-
- // Get the environment variable they want us to parse options out of.
- const char *envValue = getenv (envVar);
- if (!envValue)
- return;
-
- // Get program's "name", which we wouldn't know without the caller
- // telling us.
- std::vector<char *> newArgv;
- newArgv.push_back (strdup (progName));
-
- // Parse the value of the environment variable into a "command line"
- // and hand it off to ParseCommandLineOptions().
- ParseCStringVector (newArgv, envValue);
- int newArgc = newArgv.size ();
- ParseCommandLineOptions (newArgc, &newArgv[0], Overview);
-
- // Free all the strdup()ed strings.
- for (std::vector<char *>::iterator i = newArgv.begin (), e = newArgv.end ();
- i != e; ++i) {
- free (*i);
- }
-}
-
-void cl::ParseCommandLineOptions(int &argc, char **argv,
- const char *Overview) {
- assert((!getOpts().empty() || !getPositionalOpts().empty()) &&
- "No options specified, or ParseCommandLineOptions called more"
- " than once!");
- ProgramName = argv[0]; // Save this away safe and snug
- ProgramOverview = Overview;
- bool ErrorParsing = false;
-
- std::map<std::string, Option*> &Opts = getOpts();
- std::vector<Option*> &PositionalOpts = getPositionalOpts();
-
- // Check out the positional arguments to collect information about them.
- unsigned NumPositionalRequired = 0;
- Option *ConsumeAfterOpt = 0;
- if (!PositionalOpts.empty()) {
- if (PositionalOpts[0]->getNumOccurrencesFlag() == cl::ConsumeAfter) {
- assert(PositionalOpts.size() > 1 &&
- "Cannot specify cl::ConsumeAfter without a positional argument!");
- ConsumeAfterOpt = PositionalOpts[0];
- }
-
- // Calculate how many positional values are _required_.
- bool UnboundedFound = false;
- for (unsigned i = ConsumeAfterOpt != 0, e = PositionalOpts.size();
- i != e; ++i) {
- Option *Opt = PositionalOpts[i];
- if (RequiresValue(Opt))
- ++NumPositionalRequired;
- else if (ConsumeAfterOpt) {
- // ConsumeAfter cannot be combined with "optional" positional options
- // unless there is only one positional argument...
- if (PositionalOpts.size() > 2)
- ErrorParsing |=
- Opt->error(" error - this positional option will never be matched, "
- "because it does not Require a value, and a "
- "cl::ConsumeAfter option is active!");
- } else if (UnboundedFound && !Opt->ArgStr[0]) {
- // This option does not "require" a value... Make sure this option is
- // not specified after an option that eats all extra arguments, or this
- // one will never get any!
- //
- ErrorParsing |= Opt->error(" error - option can never match, because "
- "another positional argument will match an "
- "unbounded number of values, and this option"
- " does not require a value!");
- }
- UnboundedFound |= EatsUnboundedNumberOfValues(Opt);
- }
- }
-
- // PositionalVals - A vector of "positional" arguments we accumulate into to
- // processes at the end...
- //
- std::vector<std::string> PositionalVals;
-
- // If the program has named positional arguments, and the name has been run
- // across, keep track of which positional argument was named. Otherwise put
- // the positional args into the PositionalVals list...
- Option *ActivePositionalArg = 0;
-
- // Loop over all of the arguments... processing them.
- bool DashDashFound = false; // Have we read '--'?
- for (int i = 1; i < argc; ++i) {
- Option *Handler = 0;
- const char *Value = "";
- const char *ArgName = "";
-
- // Check to see if this is a positional argument. This argument is
- // considered to be positional if it doesn't start with '-', if it is "-"
- // itself, or if we have seen "--" already.
- //
- if (argv[i][0] != '-' || argv[i][1] == 0 || DashDashFound) {
- // Positional argument!
- if (ActivePositionalArg) {
- ProvidePositionalOption(ActivePositionalArg, argv[i]);
- continue; // We are done!
- } else if (!PositionalOpts.empty()) {
- PositionalVals.push_back(argv[i]);
-
- // All of the positional arguments have been fulfulled, give the rest to
- // the consume after option... if it's specified...
- //
- if (PositionalVals.size() >= NumPositionalRequired &a