[llvm-commits] CVS: llvm/utils/TableGen/FileLexer.l FileParser.y
Chris Lattner
lattner at cs.uiuc.edu
Mon Aug 4 00:02:05 PDT 2003
Changes in directory llvm/utils/TableGen:
FileLexer.l updated: 1.8 -> 1.9
FileParser.y updated: 1.18 -> 1.19
---
Log message:
Start transitioning towards using 'let X = y in' statements, instead of 'set X = y in'.
---
Diffs of the changes:
Index: llvm/utils/TableGen/FileLexer.l
diff -u llvm/utils/TableGen/FileLexer.l:1.8 llvm/utils/TableGen/FileLexer.l:1.9
--- llvm/utils/TableGen/FileLexer.l:1.8 Sun Aug 3 23:50:57 2003
+++ llvm/utils/TableGen/FileLexer.l Sun Aug 3 23:56:53 2003
@@ -159,7 +159,8 @@
class { return CLASS; }
def { return DEF; }
field { return FIELD; }
-set { return SET; }
+let { return LET; }
+set { return LET; }
in { return IN; }
{Identifier} { Filelval.StrVal = new std::string(yytext, yytext+yyleng);
Index: llvm/utils/TableGen/FileParser.y
diff -u llvm/utils/TableGen/FileParser.y:1.18 llvm/utils/TableGen/FileParser.y:1.19
--- llvm/utils/TableGen/FileParser.y:1.18 Sun Aug 3 23:50:57 2003
+++ llvm/utils/TableGen/FileParser.y Sun Aug 3 23:56:53 2003
@@ -18,18 +18,18 @@
typedef std::pair<Record*, std::vector<Init*>*> SubClassRefTy;
-struct SetRecord {
+struct LetRecord {
std::string Name;
std::vector<unsigned> Bits;
Init *Value;
bool HasBits;
- SetRecord(const std::string &N, std::vector<unsigned> *B, Init *V)
+ LetRecord(const std::string &N, std::vector<unsigned> *B, Init *V)
: Name(N), Value(V), HasBits(B != 0) {
if (HasBits) Bits = *B;
}
};
-static std::vector<std::vector<SetRecord> > SetStack;
+static std::vector<std::vector<LetRecord> > LetStack;
extern std::ostream &err();
@@ -168,7 +168,7 @@
std::vector<SubClassRefTy> *SubClassList;
};
-%token INT BIT STRING BITS LIST CODE DAG CLASS DEF FIELD SET IN
+%token INT BIT STRING BITS LIST CODE DAG CLASS DEF FIELD LET IN
%token <IntVal> INTVAL
%token <StrVal> ID STRVAL CODEFRAGMENT
@@ -340,7 +340,7 @@
BodyItem : Declaration ';' {
delete $1;
-} | SET ID OptBitList '=' Value ';' {
+} | LET ID OptBitList '=' Value ';' {
setValue(*$2, $3, $5);
delete $2;
delete $3;
@@ -399,11 +399,11 @@
}
// Process any variables on the set stack...
- for (unsigned i = 0, e = SetStack.size(); i != e; ++i)
- for (unsigned j = 0, e = SetStack[i].size(); j != e; ++j)
- setValue(SetStack[i][j].Name,
- SetStack[i][j].HasBits ? &SetStack[i][j].Bits : 0,
- SetStack[i][j].Value);
+ for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
+ for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
+ setValue(LetStack[i][j].Name,
+ LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0,
+ LetStack[i][j].Value);
} Body {
CurRec->resolveReferences();
@@ -446,22 +446,22 @@
Object : ClassInst | DefInst;
-SETItem : ID OptBitList '=' Value {
- SetStack.back().push_back(SetRecord(*$1, $2, $4));
+LETItem : ID OptBitList '=' Value {
+ LetStack.back().push_back(LetRecord(*$1, $2, $4));
delete $1; delete $2;
};
-SETList : SETItem | SETList ',' SETItem;
+LETList : LETItem | LETList ',' LETItem;
-// SETCommand - A 'SET' statement start...
-SETCommand : SET { SetStack.push_back(std::vector<SetRecord>()); } SETList IN;
+// LETCommand - A 'LET' statement start...
+LETCommand : LET { LetStack.push_back(std::vector<LetRecord>()); } LETList IN;
// Support Set commands wrapping objects... both with and without braces.
-Object : SETCommand '{' ObjectList '}' {
- SetStack.pop_back();
+Object : LETCommand '{' ObjectList '}' {
+ LetStack.pop_back();
}
- | SETCommand Object {
- SetStack.pop_back();
+ | LETCommand Object {
+ LetStack.pop_back();
};
ObjectList : Object {} | ObjectList Object {};
More information about the llvm-commits
mailing list