llvm.org GIT mirror llvm / 4b2b940
Switching TargetMachineRegistry to use the new generic Registry. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43094 91177308-0d34-0410-b5e6-96231b3b80d8 Gordon Henriksen 11 years ago
8 changed file(s) with 118 addition(s) and 168 deletion(s). Raw diff Collapse all Expand all
1616 #ifndef LLVM_TARGET_TARGETMACHINEREGISTRY_H
1717 #define LLVM_TARGET_TARGETMACHINEREGISTRY_H
1818
19 #include "llvm/Support/CommandLine.h"
19 #include "llvm/Support/Registry.h"
2020
2121 namespace llvm {
2222 class Module;
2323 class TargetMachine;
24
25 struct TargetMachineRegistryEntry {
26 const char *Name;
27 const char *ShortDesc;
28 TargetMachine *(*CtorFn)(const Module &, const std::string &);
29 unsigned (*ModuleMatchQualityFn)(const Module &M);
30 unsigned (*JITMatchQualityFn)();
31
32 public:
33 TargetMachineRegistryEntry(const char *N, const char *SD,
34 TargetMachine *(*CF)(const Module &, const std::string &),
35 unsigned (*MMF)(const Module &M),
36 unsigned (*JMF)())
37 : Name(N), ShortDesc(SD), CtorFn(CF), ModuleMatchQualityFn(MMF),
38 JITMatchQualityFn(JMF) {}
39 };
40
41 template<>
42 class RegistryTraits {
43 public:
44 typedef TargetMachineRegistryEntry entry;
45
46 static const char *nameof(const entry &Entry) { return Entry.Name; }
47 static const char *descof(const entry &Entry) { return Entry.ShortDesc; }
48 };
2449
25 struct TargetMachineRegistry {
26 struct Entry;
27
28 /// TargetMachineRegistry::getList - This static method returns the list of
29 /// target machines that are registered with the system.
30 static const Entry *getList() { return List; }
31
50 struct TargetMachineRegistry : Registry {
3251 /// getClosestStaticTargetForModule - Given an LLVM module, pick the best
3352 /// target that is compatible with the module. If no close target can be
3453 /// found, this returns null and sets the Error string to a reason.
35 static const Entry *getClosestStaticTargetForModule(const Module &M,
54 static const entry *getClosestStaticTargetForModule(const Module &M,
3655 std::string &Error);
3756
3857 /// getClosestTargetForJIT - Pick the best target that is compatible with
3958 /// the current host. If no close target can be found, this returns null
4059 /// and sets the Error string to a reason.
41 static const Entry *getClosestTargetForJIT(std::string &Error);
60 static const entry *getClosestTargetForJIT(std::string &Error);
4261
43
44 /// Entry - One instance of this struct is created for each target that is
45 /// registered.
46 struct Entry {
47 const char *Name;
48 const char *ShortDesc;
49 TargetMachine *(*CtorFn)(const Module &, const std::string &);
50 unsigned (*ModuleMatchQualityFn)(const Module &M);
51 unsigned (*JITMatchQualityFn)();
52
53 const Entry *getNext() const { return Next; }
54
55 protected:
56 Entry(const char *N, const char *SD,
57 TargetMachine *(*CF)(const Module &, const std::string &),
58 unsigned (*MMF)(const Module &M), unsigned (*JMF)());
59 private:
60 const Entry *Next; // Next entry in the linked list.
61 };
62
63 private:
64 static const Entry *List;
6562 };
6663
6764 //===--------------------------------------------------------------------===//
7673 /// flavour.
7774
7875 template
79 struct RegisterTarget : public TargetMachineRegistry::Entry {
80 RegisterTarget(const char *Name, const char *ShortDesc) :
81 TargetMachineRegistry::Entry(Name, ShortDesc, &Allocator,
82 &TargetMachineImpl::getModuleMatchQuality,
83 &TargetMachineImpl::getJITMatchQuality) {
84 }
76 struct RegisterTarget {
77 RegisterTarget(const char *Name, const char *ShortDesc)
78 : Entry(Name, ShortDesc, &Allocator,
79 &TargetMachineImpl::getModuleMatchQuality,
80 &TargetMachineImpl::getJITMatchQuality),
81 Node(Entry)
82 {}
83
8584 private:
85 TargetMachineRegistry::entry Entry;
86 TargetMachineRegistry::node Node;
87
8688 static TargetMachine *Allocator(const Module &M, const std::string &FS) {
8789 return new TargetMachineImpl(M, FS);
8890 }
8991 };
9092
91 /// TargetRegistrationListener - This class allows code to listen for targets
92 /// that are dynamically registered, and be notified of it when they are.
93 class TargetRegistrationListener {
94 TargetRegistrationListener **Prev, *Next;
95 public:
96 TargetRegistrationListener();
97 virtual ~TargetRegistrationListener();
98
99 TargetRegistrationListener *getNext() const { return Next; }
100
101 virtual void targetRegistered(const TargetMachineRegistry::Entry *E) = 0;
102 };
103
104
105 //===--------------------------------------------------------------------===//
106 /// TargetNameParser - This option can be used to provide a command line
107 /// option to choose among the various registered targets (commonly -march).
108 class TargetNameParser : public TargetRegistrationListener,
109 public cl::parser {
110 public:
111 void initialize(cl::Option &O) {
112 for (const TargetMachineRegistry::Entry *E =
113 TargetMachineRegistry::getList(); E; E = E->getNext())
114 Values.push_back(std::make_pair(E->Name,
115 std::make_pair(E, E->ShortDesc)));
116 cl::parser::initialize(O);
117 }
118
119 virtual void targetRegistered(const TargetMachineRegistry::Entry *E) {
120 Values.push_back(std::make_pair(E->Name,
121 std::make_pair(E, E->ShortDesc)));
122 }
123 };
12493 }
12594
12695 #endif
1919 #include "llvm/Target/TargetMachineRegistry.h"
2020 using namespace llvm;
2121
22 static cl::optEntry*, false, TargetNameParser>
22 static cl::optentry*, false,
23 TargetMachineRegistry::Parser>
2324 MArch("march", cl::desc("Architecture to generate assembly for:"));
2425
2526 static cl::opt
3839 /// for the current target. Otherwise, return null.
3940 ///
4041 ExecutionEngine *JIT::create(ModuleProvider *MP, std::string *ErrorStr) {
41 const TargetMachineRegistry::Entry *TheArch = MArch;
42 const TargetMachineRegistry::entry *TheArch = MArch;
4243 if (TheArch == 0) {
4344 std::string Error;
4445 TheArch = TargetMachineRegistry::getClosestTargetForJIT(Error);
26832683 //Grab the translation table from TargetAsmInfo if it exists
26842684 if (!TAsm) {
26852685 std::string E;
2686 const TargetMachineRegistry::Entry* Match =
2686 const TargetMachineRegistry::entry* Match =
26872687 TargetMachineRegistry::getClosestStaticTargetForModule(*TheModule, E);
26882688 if (Match) {
26892689 //Per platform Target Machines don't exist, so create it
1717 #include
1818 using namespace llvm;
1919
20 /// List - This is the main list of all of the registered target machines.
21 const TargetMachineRegistry::Entry *TargetMachineRegistry::List = 0;
22
23 /// Listeners - All of the listeners registered to get notified when new targets
24 /// are loaded.
25 static TargetRegistrationListener *Listeners = 0;
26
27 TargetMachineRegistry::Entry::Entry(const char *N, const char *SD,
28 TargetMachine *(*CF)(const Module &,const std::string &),
29 unsigned (*MMF)(const Module &M), unsigned (*JMF)())
30 : Name(N), ShortDesc(SD), CtorFn(CF), ModuleMatchQualityFn(MMF),
31 JITMatchQualityFn(JMF), Next(List) {
32 List = this;
33 for (TargetRegistrationListener *L = Listeners; L; L = L->getNext())
34 L->targetRegistered(this);
35 }
36
37 TargetRegistrationListener::TargetRegistrationListener() {
38 Next = Listeners;
39 if (Next) Next->Prev = &Next;
40 Prev = &Listeners;
41 Listeners = this;
42 }
43
44 TargetRegistrationListener::~TargetRegistrationListener() {
45 *Prev = Next;
46 }
20 template<> Registry::node *Registry::Head = 0;
21 template<> Registry::node *Registry::Tail = 0;
22 template<> Registry::listener *Registry::
23 ListenerHead = 0;
24 template<> Registry::listener *Registry::
25 ListenerTail = 0;
4726
4827 /// getClosestStaticTargetForModule - Given an LLVM module, pick the best target
4928 /// that is compatible with the module. If no close target can be found, this
5029 /// returns null and sets the Error string to a reason.
51 const TargetMachineRegistry::Entry *
30 const TargetMachineRegistry::entry *
5231 TargetMachineRegistry::getClosestStaticTargetForModule(const Module &M,
5332 std::string &Error) {
54 std::vector > UsableTargets;
55 for (const Entry *E = getList(); E; E = E->getNext())
56 if (unsigned Qual = E->ModuleMatchQualityFn(M))
57 UsableTargets.push_back(std::make_pair(Qual, E));
33 std::vector > UsableTargets;
34 for (iterator I = begin(), E = end(); I != E; ++I)
35 if (unsigned Qual = I->ModuleMatchQualityFn(M))
36 UsableTargets.push_back(std::make_pair(Qual, &*I));
5837
5938 if (UsableTargets.empty()) {
6039 Error = "No available targets are compatible with this module";
7756 /// getClosestTargetForJIT - Pick the best target that is compatible with
7857 /// the current host. If no close target can be found, this returns null
7958 /// and sets the Error string to a reason.
80 const TargetMachineRegistry::Entry *
59 const TargetMachineRegistry::entry *
8160 TargetMachineRegistry::getClosestTargetForJIT(std::string &Error) {
82 std::vector > UsableTargets;
83 for (const Entry *E = getList(); E; E = E->getNext())
84 if (unsigned Qual = E->JITMatchQualityFn())
85 UsableTargets.push_back(std::make_pair(Qual, E));
61 std::vector > UsableTargets;
62 for (iterator I = begin(), E = end(); I != E; ++I)
63 if (unsigned Qual = I->JITMatchQualityFn())
64 UsableTargets.push_back(std::make_pair(Qual, &*I));
8665
8766 if (UsableTargets.empty()) {
8867 Error = "No JIT is available for this host";
9271
9372 // Otherwise, take the best target. If there is a tie, just pick one.
9473 unsigned MaxQual = UsableTargets.front().first;
95 const Entry *MaxQualTarget = UsableTargets.front().second;
74 const entry *MaxQualTarget = UsableTargets.front().second;
9675
9776 for (unsigned i = 1, e = UsableTargets.size(); i != e; ++i)
9877 if (UsableTargets[i].first > MaxQual) {
5656 static cl::opt
5757 TargetTriple("mtriple", cl::desc("Override target triple for module"));
5858
59 static cl::optEntry*, false, TargetNameParser>
59 static cl::optentry*, false,
60 TargetMachineRegistry::Parser>
6061 MArch("march", cl::desc("Architecture to generate code for:"));
6162
6263 static cl::opt
216216 return;
217217
218218 std::string Err;
219 const TargetMachineRegistry::Entry* March =
219 const TargetMachineRegistry::entry* March =
220220 TargetMachineRegistry::getClosestStaticTargetForModule(*M, Err);
221221
222222 if (March == 0)
501501 #define YY_MORE_ADJ 0
502502 #define YY_RESTORE_YY_MORE_OFFSET
503503 char *yytext;
504 #line 1 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
504 #line 1 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
505505 #define INITIAL 0
506506 /*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===//
507507 //
517517 //
518518 //===----------------------------------------------------------------------===*/
519519 #define YY_NEVER_INTERACTIVE 1
520 #define comment 1
521
522 #line 30 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
520 #define in_comment 1
521
522 #line 30 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
523523 #include "llvm/Config/config.h"
524524 #include "llvm/Support/Streams.h"
525525 #include "Record.h"
816816 register char *yy_cp, *yy_bp;
817817 register int yy_act;
818818
819 #line 185 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
819 #line 185 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
820820
821821
822822 #line 824 "Lexer.cpp"
912912 { /* beginning of action switch */
913913 case 1:
914914 YY_RULE_SETUP
915 #line 187 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
915 #line 187 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
916916 { /* Ignore comments */ }
917917 YY_BREAK
918918 case 2:
919919 YY_RULE_SETUP
920 #line 189 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
920 #line 189 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
921921 { HandleInclude(yytext); }
922922 YY_BREAK
923923 case 3:
924924 YY_RULE_SETUP
925 #line 190 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
925 #line 190 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
926926 { Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2);
927927 return CODEFRAGMENT; }
928928 YY_BREAK
929929 case 4:
930930 YY_RULE_SETUP
931 #line 193 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
931 #line 193 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
932932 { return INT; }
933933 YY_BREAK
934934 case 5:
935935 YY_RULE_SETUP
936 #line 194 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
936 #line 194 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
937937 { return BIT; }
938938 YY_BREAK
939939 case 6:
940940 YY_RULE_SETUP
941 #line 195 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
941 #line 195 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
942942 { return BITS; }
943943 YY_BREAK
944944 case 7:
945945 YY_RULE_SETUP
946 #line 196 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
946 #line 196 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
947947 { return STRING; }
948948 YY_BREAK
949949 case 8:
950950 YY_RULE_SETUP
951 #line 197 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
951 #line 197 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
952952 { return LIST; }
953953 YY_BREAK
954954 case 9:
955955 YY_RULE_SETUP
956 #line 198 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
956 #line 198 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
957957 { return CODE; }
958958 YY_BREAK
959959 case 10:
960960 YY_RULE_SETUP
961 #line 199 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
961 #line 199 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
962962 { return DAG; }
963963 YY_BREAK
964964 case 11:
965965 YY_RULE_SETUP
966 #line 201 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
966 #line 201 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
967967 { return CLASS; }
968968 YY_BREAK
969969 case 12:
970970 YY_RULE_SETUP
971 #line 202 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
971 #line 202 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
972972 { return DEF; }
973973 YY_BREAK
974974 case 13:
975975 YY_RULE_SETUP
976 #line 203 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
976 #line 203 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
977977 { return DEFM; }
978978 YY_BREAK
979979 case 14:
980980 YY_RULE_SETUP
981 #line 204 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
981 #line 204 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
982982 { return MULTICLASS; }
983983 YY_BREAK
984984 case 15:
985985 YY_RULE_SETUP
986 #line 205 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
986 #line 205 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
987987 { return FIELD; }
988988 YY_BREAK
989989 case 16:
990990 YY_RULE_SETUP
991 #line 206 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
991 #line 206 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
992992 { return LET; }
993993 YY_BREAK
994994 case 17:
995995 YY_RULE_SETUP
996 #line 207 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
996 #line 207 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
997997 { return IN; }
998998 YY_BREAK
999999 case 18:
10001000 YY_RULE_SETUP
1001 #line 209 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1001 #line 209 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10021002 { return CONCATTOK; }
10031003 YY_BREAK
10041004 case 19:
10051005 YY_RULE_SETUP
1006 #line 210 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1006 #line 210 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10071007 { return SRATOK; }
10081008 YY_BREAK
10091009 case 20:
10101010 YY_RULE_SETUP
1011 #line 211 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1011 #line 211 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10121012 { return SRLTOK; }
10131013 YY_BREAK
10141014 case 21:
10151015 YY_RULE_SETUP
1016 #line 212 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1016 #line 212 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10171017 { return SHLTOK; }
10181018 YY_BREAK
10191019 case 22:
10201020 YY_RULE_SETUP
1021 #line 213 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1021 #line 213 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10221022 { return STRCONCATTOK; }
10231023 YY_BREAK
10241024 case 23:
10251025 YY_RULE_SETUP
1026 #line 216 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1026 #line 216 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10271027 { Filelval.StrVal = new std::string(yytext, yytext+yyleng);
10281028 return ID; }
10291029 YY_BREAK
10301030 case 24:
10311031 YY_RULE_SETUP
1032 #line 218 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1032 #line 218 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10331033 { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng);
10341034 return VARNAME; }
10351035 YY_BREAK
10361036 case 25:
10371037 YY_RULE_SETUP
1038 #line 221 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1038 #line 221 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10391039 { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1);
10401040 return STRVAL; }
10411041 YY_BREAK
10421042 case 26:
10431043 YY_RULE_SETUP
1044 #line 224 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1044 #line 224 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10451045 { Filelval.IntVal = ParseInt(Filetext); return INTVAL; }
10461046 YY_BREAK
10471047 case 27:
10481048 YY_RULE_SETUP
1049 #line 226 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1049 #line 226 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10501050 { /* Ignore whitespace */ }
10511051 YY_BREAK
10521052 case 28:
10531053 YY_RULE_SETUP
1054 #line 229 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1055 { BEGIN(comment); CommentDepth++; }
1054 #line 229 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
1055 { BEGIN(in_comment); CommentDepth++; }
10561056 YY_BREAK
10571057 case 29:
10581058 YY_RULE_SETUP
1059 #line 230 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1059 #line 230 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10601060 {} /* eat anything that's not a '*' or '/' */
10611061 YY_BREAK
10621062 case 30:
10631063 YY_RULE_SETUP
1064 #line 231 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1064 #line 231 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10651065 {} /* eat up '*'s not followed by '/'s */
10661066 YY_BREAK
10671067 case 31:
10681068 YY_RULE_SETUP
1069 #line 232 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1069 #line 232 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10701070 { ++CommentDepth; }
10711071 YY_BREAK
10721072 case 32:
10731073 YY_RULE_SETUP
1074 #line 233 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1074 #line 233 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10751075 {} /* eat up /'s not followed by *'s */
10761076 YY_BREAK
10771077 case 33:
10781078 YY_RULE_SETUP
1079 #line 234 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1079 #line 234 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10801080 { if (!--CommentDepth) { BEGIN(INITIAL); } }
10811081 YY_BREAK
1082 case YY_STATE_EOF(comment):
1083 #line 235 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1082 case YY_STATE_EOF(in_comment):
1083 #line 235 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10841084 { err() << "Unterminated comment!\n"; exit(1); }
10851085 YY_BREAK
10861086 case 34:
10871087 YY_RULE_SETUP
1088 #line 237 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1088 #line 237 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10891089 { return Filetext[0]; }
10901090 YY_BREAK
10911091 case 35:
10921092 YY_RULE_SETUP
1093 #line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1093 #line 239 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
10941094 YY_FATAL_ERROR( "flex scanner jammed" );
10951095 YY_BREAK
10961096 #line 1098 "Lexer.cpp"
19771977 return 0;
19781978 }
19791979 #endif
1980 #line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
1981
1982
1980 #line 239 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l"
1981
1982
2323 %option noreject
2424 %option noyymore
2525
26 %x comment
26 %x in_comment
2727
2828 %{
2929 #include "llvm/Config/config.h"
225225 [ \t\n\r]+ { /* Ignore whitespace */ }
226226
227227
228 "/*" { BEGIN(comment); CommentDepth++; }
229 [^*/]* {} /* eat anything that's not a '*' or '/' */
230 "*"+[^*/]* {} /* eat up '*'s not followed by '/'s */
231 "/*" { ++CommentDepth; }
232 "/"+[^*/]* {} /* eat up /'s not followed by *'s */
233 "*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } }
234 <> { err() << "Unterminated comment!\n"; exit(1); }
228 "/*" { BEGIN(in_comment); CommentDepth++; }
229 [^*/]* {} /* eat anything that's not a '*' or '/' */
230 "*"+[^*/]* {} /* eat up '*'s not followed by '/'s */
231 "/*" { ++CommentDepth; }
232 "/"+[^*/]* {} /* eat up /'s not followed by *'s */
233 "*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } }
234 <> { err() << "Unterminated comment!\n"; exit(1); }
235235
236236 . { return Filetext[0]; }
237237