mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 23:17:16 +00:00
Generalize tblgen's dag parsing logic to handle arbitrary expressions
as the operator of the dag. Specifically, this allows parsing things like (F.x 4) in addition to just (a 4). Unfortunately, this runs afoul of an idiom being used by llvmc. It is using dags like (foo [1,2,3]) to represent a list of stuff being passed into foo. With this change, this is parsed as a [1,2,3] subscript on foo instead of being the first argument to the dag. Cope with this in the short term by requiring a "-llvmc-temp-hack" argument to tblgen to get the old parsing behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115742 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -17,8 +17,14 @@
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
using namespace llvm;
|
||||
|
||||
/// LLVMCHack - This is a temporary hack that changes how "(foo [1, 2, 3])"
|
||||
/// parses.
|
||||
/// FIXME: REMOVE THIS.
|
||||
static cl::opt<bool> LLVMCHack("llvmc-temp-hack", cl::ReallyHidden);
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Support Code for the Semantic Actions.
|
||||
//===----------------------------------------------------------------------===//
|
||||
@@ -1213,11 +1219,18 @@ Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Init *Operator = 0;
|
||||
if (Lex.getCode() == tgtok::Id)
|
||||
Operator = ParseIDValue(CurRec);
|
||||
else
|
||||
Operator = ParseOperation(CurRec);
|
||||
Init *Operator;
|
||||
/// LLVMC Requires an old grammar and I don't know how to update it, placate
|
||||
/// it in the short term by changing the grammar specifically for llvmc.
|
||||
/// FIXME: REMOVE THIS.
|
||||
if (!LLVMCHack)
|
||||
Operator = ParseValue(CurRec);
|
||||
else {
|
||||
if (Lex.getCode() == tgtok::Id)
|
||||
Operator = ParseIDValue(CurRec);
|
||||
else
|
||||
Operator = ParseOperation(CurRec);
|
||||
}
|
||||
if (Operator == 0) return 0;
|
||||
|
||||
// If the operator name is present, parse it.
|
||||
|
||||
Reference in New Issue
Block a user