Switching TargetMachineRegistry to use the new generic Registry.
authorGordon Henriksen <gordonhenriksen@mac.com>
Wed, 17 Oct 2007 21:28:48 +0000 (21:28 +0000)
committerGordon Henriksen <gordonhenriksen@mac.com>
Wed, 17 Oct 2007 21:28:48 +0000 (21:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43094 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetMachineRegistry.h
lib/ExecutionEngine/JIT/TargetSelect.cpp
lib/Target/CBackend/CBackend.cpp
lib/Target/TargetMachineRegistry.cpp
tools/llc/llc.cpp
tools/lto/lto.cpp
utils/TableGen/FileLexer.cpp.cvs
utils/TableGen/FileLexer.l.cvs

index 4c009e1a9a03bbd8e02fc763df06d0e4394b1a00..a8df7b3f8263156079a4e0e1fd800edd530ded15 100644 (file)
 #ifndef LLVM_TARGET_TARGETMACHINEREGISTRY_H
 #define LLVM_TARGET_TARGETMACHINEREGISTRY_H
 
 #ifndef LLVM_TARGET_TARGETMACHINEREGISTRY_H
 #define LLVM_TARGET_TARGETMACHINEREGISTRY_H
 
-#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Registry.h"
 
 namespace llvm {
   class Module;
   class TargetMachine;
 
 namespace llvm {
   class Module;
   class TargetMachine;
+  
+  struct TargetMachineRegistryEntry {
+    const char *Name;
+    const char *ShortDesc;
+    TargetMachine *(*CtorFn)(const Module &, const std::string &);
+    unsigned (*ModuleMatchQualityFn)(const Module &M);
+    unsigned (*JITMatchQualityFn)();
+    
+  public:
+    TargetMachineRegistryEntry(const char *N, const char *SD,
+                      TargetMachine *(*CF)(const Module &, const std::string &),
+                               unsigned (*MMF)(const Module &M),
+                               unsigned (*JMF)())
+      : Name(N), ShortDesc(SD), CtorFn(CF), ModuleMatchQualityFn(MMF),
+        JITMatchQualityFn(JMF) {}
+  };
+  
+  template<>
+  class RegistryTraits<TargetMachine> {
+  public:
+    typedef TargetMachineRegistryEntry entry;
+    
+    static const char *nameof(const entry &Entry) { return Entry.Name; }
+    static const char *descof(const entry &Entry) { return Entry.ShortDesc; }
+  };
 
 
-  struct TargetMachineRegistry {
-    struct Entry;
-
-    /// TargetMachineRegistry::getList - This static method returns the list of
-    /// target machines that are registered with the system.
-    static const Entry *getList() { return List; }
-
+  struct TargetMachineRegistry : Registry<TargetMachine> {
     /// getClosestStaticTargetForModule - Given an LLVM module, pick the best
     /// target that is compatible with the module.  If no close target can be
     /// found, this returns null and sets the Error string to a reason.
     /// getClosestStaticTargetForModule - Given an LLVM module, pick the best
     /// target that is compatible with the module.  If no close target can be
     /// found, this returns null and sets the Error string to a reason.
-    static const Entry *getClosestStaticTargetForModule(const Module &M,
+    static const entry *getClosestStaticTargetForModule(const Module &M,
                                                         std::string &Error);
 
     /// getClosestTargetForJIT - Pick the best target that is compatible with
     /// the current host.  If no close target can be found, this returns null
     /// and sets the Error string to a reason.
                                                         std::string &Error);
 
     /// getClosestTargetForJIT - Pick the best target that is compatible with
     /// the current host.  If no close target can be found, this returns null
     /// and sets the Error string to a reason.
-    static const Entry *getClosestTargetForJIT(std::string &Error);
-
-
-    /// Entry - One instance of this struct is created for each target that is
-    /// registered.
-    struct Entry {
-      const char *Name;
-      const char *ShortDesc;
-      TargetMachine *(*CtorFn)(const Module &, const std::string &);
-      unsigned (*ModuleMatchQualityFn)(const Module &M);
-      unsigned (*JITMatchQualityFn)();
-
-      const Entry *getNext() const { return Next; }
+    static const entry *getClosestTargetForJIT(std::string &Error);
 
 
-    protected:
-      Entry(const char *N, const char *SD,
-            TargetMachine *(*CF)(const Module &, const std::string &),
-            unsigned (*MMF)(const Module &M), unsigned (*JMF)());
-    private:
-      const Entry *Next;  // Next entry in the linked list.
-    };
-
-  private:
-    static const Entry *List;
   };
 
   //===--------------------------------------------------------------------===//
   };
 
   //===--------------------------------------------------------------------===//
@@ -77,51 +74,23 @@ namespace llvm {
   ///   flavour.
   
   template<class TargetMachineImpl>
   ///   flavour.
   
   template<class TargetMachineImpl>
-  struct RegisterTarget : public TargetMachineRegistry::Entry {
-    RegisterTarget(const char *Name, const char *ShortDesc) :
-      TargetMachineRegistry::Entry(Name, ShortDesc, &Allocator,
-                                   &TargetMachineImpl::getModuleMatchQuality,
-                                   &TargetMachineImpl::getJITMatchQuality) {
-    }
+  struct RegisterTarget {
+    RegisterTarget(const char *Name, const char *ShortDesc)
+      : Entry(Name, ShortDesc, &Allocator,
+              &TargetMachineImpl::getModuleMatchQuality,
+              &TargetMachineImpl::getJITMatchQuality),
+        Node(Entry)
+    {}
+
   private:
   private:
+    TargetMachineRegistry::entry Entry;
+    TargetMachineRegistry::node Node;
+    
     static TargetMachine *Allocator(const Module &M, const std::string &FS) {
       return new TargetMachineImpl(M, FS);
     }
   };
 
     static TargetMachine *Allocator(const Module &M, const std::string &FS) {
       return new TargetMachineImpl(M, FS);
     }
   };
 
-  /// TargetRegistrationListener - This class allows code to listen for targets
-  /// that are dynamically registered, and be notified of it when they are.
-  class TargetRegistrationListener {
-    TargetRegistrationListener **Prev, *Next;
-  public:
-    TargetRegistrationListener();
-    virtual ~TargetRegistrationListener();
-
-    TargetRegistrationListener *getNext() const { return Next; }
-
-    virtual void targetRegistered(const TargetMachineRegistry::Entry *E) = 0;
-  };
-
-
-  //===--------------------------------------------------------------------===//
-  /// TargetNameParser - This option can be used to provide a command line
-  /// option to choose among the various registered targets (commonly -march).
-  class TargetNameParser : public TargetRegistrationListener,
-    public cl::parser<const TargetMachineRegistry::Entry*> {
-  public:
-    void initialize(cl::Option &O) {
-      for (const TargetMachineRegistry::Entry *E =
-             TargetMachineRegistry::getList(); E; E = E->getNext())
-        Values.push_back(std::make_pair(E->Name,
-                                        std::make_pair(E, E->ShortDesc)));
-      cl::parser<const TargetMachineRegistry::Entry*>::initialize(O);
-    }
-
-    virtual void targetRegistered(const TargetMachineRegistry::Entry *E) {
-      Values.push_back(std::make_pair(E->Name,
-                                      std::make_pair(E, E->ShortDesc)));
-    }
-  };
 }
 
 #endif
 }
 
 #endif
index bf968af4796b100e2cfdb57b55e76c8a9de747b7..14e0a5f10e72dd4ee29752e4503b55c35b818a62 100644 (file)
@@ -20,7 +20,8 @@
 #include "llvm/Target/TargetMachineRegistry.h"
 using namespace llvm;
 
 #include "llvm/Target/TargetMachineRegistry.h"
 using namespace llvm;
 
-static cl::opt<const TargetMachineRegistry::Entry*, false, TargetNameParser>
+static cl::opt<const TargetMachineRegistry::entry*, false,
+               TargetMachineRegistry::Parser>
 MArch("march", cl::desc("Architecture to generate assembly for:"));
 
 static cl::opt<std::string>
 MArch("march", cl::desc("Architecture to generate assembly for:"));
 
 static cl::opt<std::string>
@@ -39,7 +40,7 @@ MAttrs("mattr",
 /// for the current target.  Otherwise, return null.
 ///
 ExecutionEngine *JIT::create(ModuleProvider *MP, std::string *ErrorStr) {
 /// for the current target.  Otherwise, return null.
 ///
 ExecutionEngine *JIT::create(ModuleProvider *MP, std::string *ErrorStr) {
-  const TargetMachineRegistry::Entry *TheArch = MArch;
+  const TargetMachineRegistry::entry *TheArch = MArch;
   if (TheArch == 0) {
     std::string Error;
     TheArch = TargetMachineRegistry::getClosestTargetForJIT(Error);
   if (TheArch == 0) {
     std::string Error;
     TheArch = TargetMachineRegistry::getClosestTargetForJIT(Error);
index 35205c6edb38e02e4ce8861c62e0062b12707aeb..f874a182f08ac40bae4caca6d4196aa6264d9892 100644 (file)
@@ -2684,7 +2684,7 @@ std::string CWriter::InterpretASMConstraint(InlineAsm::ConstraintInfo& c) {
   //Grab the translation table from TargetAsmInfo if it exists
   if (!TAsm) {
     std::string E;
   //Grab the translation table from TargetAsmInfo if it exists
   if (!TAsm) {
     std::string E;
-    const TargetMachineRegistry::Entry* Match = 
+    const TargetMachineRegistry::entry* Match = 
       TargetMachineRegistry::getClosestStaticTargetForModule(*TheModule, E);
     if (Match) {
       //Per platform Target Machines don't exist, so create it
       TargetMachineRegistry::getClosestStaticTargetForModule(*TheModule, E);
     if (Match) {
       //Per platform Target Machines don't exist, so create it
index 5be9eb1bb3f1bc63e600086fc86e977ad6b1b9a6..077b7e8d67b721dcd8f4af6f886b809c267f16a5 100644 (file)
 #include <algorithm>
 using namespace llvm;
 
 #include <algorithm>
 using namespace llvm;
 
-/// List - This is the main list of all of the registered target machines.
-const TargetMachineRegistry::Entry *TargetMachineRegistry::List = 0;
-
-/// Listeners - All of the listeners registered to get notified when new targets
-/// are loaded.
-static TargetRegistrationListener *Listeners = 0;
-
-TargetMachineRegistry::Entry::Entry(const char *N, const char *SD,
-                       TargetMachine *(*CF)(const Module &,const std::string &),
-                           unsigned (*MMF)(const Module &M), unsigned (*JMF)())
-  : Name(N), ShortDesc(SD), CtorFn(CF), ModuleMatchQualityFn(MMF),
-    JITMatchQualityFn(JMF), Next(List) {
-  List = this;
-  for (TargetRegistrationListener *L = Listeners; L; L = L->getNext())
-    L->targetRegistered(this);
-}
-
-TargetRegistrationListener::TargetRegistrationListener() {
-  Next = Listeners;
-  if (Next) Next->Prev = &Next;
-  Prev = &Listeners;
-  Listeners = this;
-}
-
-TargetRegistrationListener::~TargetRegistrationListener() {
-  *Prev = Next;
-}
+template<> Registry<TargetMachine>::node *Registry<TargetMachine>::Head = 0;
+template<> Registry<TargetMachine>::node *Registry<TargetMachine>::Tail = 0;
+template<> Registry<TargetMachine>::listener *Registry<TargetMachine>::
+ListenerHead = 0;
+template<> Registry<TargetMachine>::listener *Registry<TargetMachine>::
+ListenerTail = 0;
 
 /// getClosestStaticTargetForModule - Given an LLVM module, pick the best target
 /// that is compatible with the module.  If no close target can be found, this
 /// returns null and sets the Error string to a reason.
 
 /// getClosestStaticTargetForModule - Given an LLVM module, pick the best target
 /// that is compatible with the module.  If no close target can be found, this
 /// returns null and sets the Error string to a reason.
-const TargetMachineRegistry::Entry *
+const TargetMachineRegistry::entry *
 TargetMachineRegistry::getClosestStaticTargetForModule(const Module &M,
                                                        std::string &Error) {
 TargetMachineRegistry::getClosestStaticTargetForModule(const Module &M,
                                                        std::string &Error) {
-  std::vector<std::pair<unsigned, const Entry *> > UsableTargets;
-  for (const Entry *E = getList(); E; E = E->getNext())
-    if (unsigned Qual = E->ModuleMatchQualityFn(M))
-      UsableTargets.push_back(std::make_pair(Qual, E));
+  std::vector<std::pair<unsigned, const entry *> > UsableTargets;
+  for (iterator I = begin(), E = end(); I != E; ++I)
+    if (unsigned Qual = I->ModuleMatchQualityFn(M))
+      UsableTargets.push_back(std::make_pair(Qual, &*I));
 
   if (UsableTargets.empty()) {
     Error = "No available targets are compatible with this module";
 
   if (UsableTargets.empty()) {
     Error = "No available targets are compatible with this module";
@@ -78,12 +57,12 @@ TargetMachineRegistry::getClosestStaticTargetForModule(const Module &M,
 /// getClosestTargetForJIT - Pick the best target that is compatible with
 /// the current host.  If no close target can be found, this returns null
 /// and sets the Error string to a reason.
 /// getClosestTargetForJIT - Pick the best target that is compatible with
 /// the current host.  If no close target can be found, this returns null
 /// and sets the Error string to a reason.
-const TargetMachineRegistry::Entry *
+const TargetMachineRegistry::entry *
 TargetMachineRegistry::getClosestTargetForJIT(std::string &Error) {
 TargetMachineRegistry::getClosestTargetForJIT(std::string &Error) {
-  std::vector<std::pair<unsigned, const Entry *> > UsableTargets;
-  for (const Entry *E = getList(); E; E = E->getNext())
-    if (unsigned Qual = E->JITMatchQualityFn())
-      UsableTargets.push_back(std::make_pair(Qual, E));
+  std::vector<std::pair<unsigned, const entry *> > UsableTargets;
+  for (iterator I = begin(), E = end(); I != E; ++I)
+    if (unsigned Qual = I->JITMatchQualityFn())
+      UsableTargets.push_back(std::make_pair(Qual, &*I));
 
   if (UsableTargets.empty()) {
     Error = "No JIT is available for this host";
 
   if (UsableTargets.empty()) {
     Error = "No JIT is available for this host";
@@ -93,7 +72,7 @@ TargetMachineRegistry::getClosestTargetForJIT(std::string &Error) {
 
   // Otherwise, take the best target.  If there is a tie, just pick one.
   unsigned MaxQual = UsableTargets.front().first;
 
   // Otherwise, take the best target.  If there is a tie, just pick one.
   unsigned MaxQual = UsableTargets.front().first;
-  const Entry *MaxQualTarget = UsableTargets.front().second;
+  const entry *MaxQualTarget = UsableTargets.front().second;
 
   for (unsigned i = 1, e = UsableTargets.size(); i != e; ++i)
     if (UsableTargets[i].first > MaxQual) {
 
   for (unsigned i = 1, e = UsableTargets.size(); i != e; ++i)
     if (UsableTargets[i].first > MaxQual) {
index 7b55c8092cf125f20808827d1c9eb558de8b9bf0..c976ee261ecd89202d7a9b31f092b454f6010656 100644 (file)
@@ -57,7 +57,8 @@ static cl::opt<bool> Fast("fast",
 static cl::opt<std::string>
 TargetTriple("mtriple", cl::desc("Override target triple for module"));
 
 static cl::opt<std::string>
 TargetTriple("mtriple", cl::desc("Override target triple for module"));
 
-static cl::opt<const TargetMachineRegistry::Entry*, false, TargetNameParser>
+static cl::opt<const TargetMachineRegistry::entry*, false,
+               TargetMachineRegistry::Parser>
 MArch("march", cl::desc("Architecture to generate code for:"));
 
 static cl::opt<std::string>
 MArch("march", cl::desc("Architecture to generate code for:"));
 
 static cl::opt<std::string>
index cef26f1f065f988ea8b0c91d436ce7b0b05ff831..e7e00e7f62c774727b74ab4192d47599d2810b99 100644 (file)
@@ -217,7 +217,7 @@ LTO::getTarget (Module *M) {
     return;
 
   std::string Err;
     return;
 
   std::string Err;
-  const TargetMachineRegistry::Entry* March = 
+  const TargetMachineRegistry::entry* March = 
     TargetMachineRegistry::getClosestStaticTargetForModule(*M, Err);
   
   if (March == 0)
     TargetMachineRegistry::getClosestStaticTargetForModule(*M, Err);
   
   if (March == 0)
index a4361405a50b8b3e04d04d5076dc30b60ed9cfb5..74e04a740b3111e29c137f8db9d51b5273d25cf9 100644 (file)
@@ -502,7 +502,7 @@ goto find_rule; \
 #define YY_MORE_ADJ 0
 #define YY_RESTORE_YY_MORE_OFFSET
 char *yytext;
 #define YY_MORE_ADJ 0
 #define YY_RESTORE_YY_MORE_OFFSET
 char *yytext;
-#line 1 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 1 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 #define INITIAL 0
 /*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===//
 // 
 #define INITIAL 0
 /*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===//
 // 
@@ -518,9 +518,9 @@ char *yytext;
 //
 //===----------------------------------------------------------------------===*/
 #define YY_NEVER_INTERACTIVE 1
 //
 //===----------------------------------------------------------------------===*/
 #define YY_NEVER_INTERACTIVE 1
-#define comment 1
+#define in_comment 1
 
 
-#line 30 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 30 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Streams.h"
 #include "Record.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Streams.h"
 #include "Record.h"
@@ -817,7 +817,7 @@ YY_DECL
        register char *yy_cp, *yy_bp;
        register int yy_act;
 
        register char *yy_cp, *yy_bp;
        register int yy_act;
 
-#line 185 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 185 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 
 
 #line 824 "Lexer.cpp"
 
 
 #line 824 "Lexer.cpp"
@@ -913,185 +913,185 @@ do_action:      /* This label is used only to access EOF actions. */
        { /* beginning of action switch */
 case 1:
 YY_RULE_SETUP
        { /* beginning of action switch */
 case 1:
 YY_RULE_SETUP
-#line 187 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 187 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { /* Ignore comments */ }
        YY_BREAK
 case 2:
 YY_RULE_SETUP
 { /* Ignore comments */ }
        YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 189 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 189 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { HandleInclude(yytext); }
        YY_BREAK
 case 3:
 YY_RULE_SETUP
 { HandleInclude(yytext); }
        YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 190 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 190 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2);
                  return CODEFRAGMENT; }
        YY_BREAK
 case 4:
 YY_RULE_SETUP
 { Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2);
                  return CODEFRAGMENT; }
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 193 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 193 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return INT; }
        YY_BREAK
 case 5:
 YY_RULE_SETUP
 { return INT; }
        YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 194 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 194 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return BIT; }
        YY_BREAK
 case 6:
 YY_RULE_SETUP
 { return BIT; }
        YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 195 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 195 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return BITS; }
        YY_BREAK
 case 7:
 YY_RULE_SETUP
 { return BITS; }
        YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 196 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 196 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return STRING; }
        YY_BREAK
 case 8:
 YY_RULE_SETUP
 { return STRING; }
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 197 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 197 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return LIST; }
        YY_BREAK
 case 9:
 YY_RULE_SETUP
 { return LIST; }
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 198 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 198 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return CODE; }
        YY_BREAK
 case 10:
 YY_RULE_SETUP
 { return CODE; }
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 199 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 199 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return DAG; }
        YY_BREAK
 case 11:
 YY_RULE_SETUP
 { return DAG; }
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 201 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 201 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return CLASS; }
        YY_BREAK
 case 12:
 YY_RULE_SETUP
 { return CLASS; }
        YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 202 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 202 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return DEF; }
        YY_BREAK
 case 13:
 YY_RULE_SETUP
 { return DEF; }
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 203 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 203 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return DEFM; }
        YY_BREAK
 case 14:
 YY_RULE_SETUP
 { return DEFM; }
        YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 204 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 204 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return MULTICLASS; }
        YY_BREAK
 case 15:
 YY_RULE_SETUP
 { return MULTICLASS; }
        YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 205 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 205 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return FIELD; }
        YY_BREAK
 case 16:
 YY_RULE_SETUP
 { return FIELD; }
        YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 206 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 206 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return LET; }
        YY_BREAK
 case 17:
 YY_RULE_SETUP
 { return LET; }
        YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 207 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 207 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return IN; }
        YY_BREAK
 case 18:
 YY_RULE_SETUP
 { return IN; }
        YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 209 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 209 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return CONCATTOK; }
        YY_BREAK
 case 19:
 YY_RULE_SETUP
 { return CONCATTOK; }
        YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 210 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 210 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return SRATOK; }
        YY_BREAK
 case 20:
 YY_RULE_SETUP
 { return SRATOK; }
        YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 211 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 211 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return SRLTOK; }
        YY_BREAK
 case 21:
 YY_RULE_SETUP
 { return SRLTOK; }
        YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 212 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 212 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return SHLTOK; }
        YY_BREAK
 case 22:
 YY_RULE_SETUP
 { return SHLTOK; }
        YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 213 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 213 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return STRCONCATTOK; }
        YY_BREAK
 case 23:
 YY_RULE_SETUP
 { return STRCONCATTOK; }
        YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 216 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 216 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { Filelval.StrVal = new std::string(yytext, yytext+yyleng);
                  return ID; }
        YY_BREAK
 case 24:
 YY_RULE_SETUP
 { Filelval.StrVal = new std::string(yytext, yytext+yyleng);
                  return ID; }
        YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 218 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 218 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng);
                  return VARNAME; } 
        YY_BREAK
 case 25:
 YY_RULE_SETUP
 { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng);
                  return VARNAME; } 
        YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 221 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 221 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1);
                  return STRVAL; }
        YY_BREAK
 case 26:
 YY_RULE_SETUP
 { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1);
                  return STRVAL; }
        YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 224 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 224 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { Filelval.IntVal = ParseInt(Filetext); return INTVAL; }
        YY_BREAK
 case 27:
 YY_RULE_SETUP
 { Filelval.IntVal = ParseInt(Filetext); return INTVAL; }
        YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 226 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 226 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { /* Ignore whitespace */ }
        YY_BREAK
 case 28:
 YY_RULE_SETUP
 { /* Ignore whitespace */ }
        YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 229 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
-{ BEGIN(comment); CommentDepth++; }
+#line 229 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
+{ BEGIN(in_comment); CommentDepth++; }
        YY_BREAK
 case 29:
 YY_RULE_SETUP
        YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 230 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 230 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 {} /* eat anything that's not a '*' or '/' */
        YY_BREAK
 case 30:
 YY_RULE_SETUP
 {} /* eat anything that's not a '*' or '/' */
        YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 231 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 231 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 {} /* eat up '*'s not followed by '/'s */
        YY_BREAK
 case 31:
 YY_RULE_SETUP
 {} /* eat up '*'s not followed by '/'s */
        YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 232 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 232 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { ++CommentDepth; }
        YY_BREAK
 case 32:
 YY_RULE_SETUP
 { ++CommentDepth; }
        YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 233 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 233 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 {} /* eat up /'s not followed by *'s */
        YY_BREAK
 case 33:
 YY_RULE_SETUP
 {} /* eat up /'s not followed by *'s */
        YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 234 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 234 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { if (!--CommentDepth) { BEGIN(INITIAL); } }
        YY_BREAK
 { if (!--CommentDepth) { BEGIN(INITIAL); } }
        YY_BREAK
-case YY_STATE_EOF(comment):
-#line 235 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+case YY_STATE_EOF(in_comment):
+#line 235 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { err() << "Unterminated comment!\n"; exit(1); }
        YY_BREAK
 case 34:
 YY_RULE_SETUP
 { err() << "Unterminated comment!\n"; exit(1); }
        YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 237 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 237 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 { return Filetext[0]; }
        YY_BREAK
 case 35:
 YY_RULE_SETUP
 { return Filetext[0]; }
        YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 239 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
        YY_BREAK
 #line 1098 "Lexer.cpp"
 YY_FATAL_ERROR( "flex scanner jammed" );
        YY_BREAK
 #line 1098 "Lexer.cpp"
@@ -1978,6 +1978,6 @@ int main()
        return 0;
        }
 #endif
        return 0;
        }
 #endif
-#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 239 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
 
 
 
 
index 59bbdad7bf4460855b37697812946e853b7cf0b0..561e8a131791c8d7daf8cb475c3a1ef5d45a35f0 100644 (file)
@@ -24,7 +24,7 @@
 %option noreject
 %option noyymore
 
 %option noreject
 %option noyymore
 
-%x comment
+%x in_comment
 
 %{
 #include "llvm/Config/config.h"
 
 %{
 #include "llvm/Config/config.h"
@@ -226,13 +226,13 @@ ${Identifier}  { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng);
 [ \t\n\r]+     { /* Ignore whitespace */ }
 
 
 [ \t\n\r]+     { /* Ignore whitespace */ }
 
 
-"/*"                    { BEGIN(comment); CommentDepth++; }
-<comment>[^*/]*         {} /* eat anything that's not a '*' or '/' */
-<comment>"*"+[^*/]*     {} /* eat up '*'s not followed by '/'s */
-<comment>"/*"           { ++CommentDepth; }
-<comment>"/"+[^*/]*     {} /* eat up /'s not followed by *'s */
-<comment>"*"+"/"        { if (!--CommentDepth) { BEGIN(INITIAL); } }
-<comment><<EOF>>        { err() << "Unterminated comment!\n"; exit(1); }
+"/*"                       { BEGIN(in_comment); CommentDepth++; }
+<in_comment>[^*/]*         {} /* eat anything that's not a '*' or '/' */
+<in_comment>"*"+[^*/]*     {} /* eat up '*'s not followed by '/'s */
+<in_comment>"/*"           { ++CommentDepth; }
+<in_comment>"/"+[^*/]*     {} /* eat up /'s not followed by *'s */
+<in_comment>"*"+"/"        { if (!--CommentDepth) { BEGIN(INITIAL); } }
+<in_comment><<EOF>>        { err() << "Unterminated comment!\n"; exit(1); }
 
 .              { return Filetext[0]; }
 
 
 .              { return Filetext[0]; }