mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 06:32:24 +00:00
Added support for the extractelement operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25181 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
56107e21a5
commit
b52ee7f5ff
@ -102,6 +102,8 @@ Constant *llvm::ConstantFoldInstruction(Instruction *I) {
|
||||
if (Constant *Op2 = dyn_cast<Constant>(I->getOperand(2)))
|
||||
return ConstantExpr::getSelect(Op0, Op1, Op2);
|
||||
return 0;
|
||||
case Instruction::ExtractElement:
|
||||
return ConstantExpr::getExtractElement(Op0, Op1);
|
||||
case Instruction::GetElementPtr:
|
||||
std::vector<Constant*> IdxList;
|
||||
IdxList.reserve(I->getNumOperands()-1);
|
||||
|
@ -347,6 +347,19 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/// ExtractElementConstantExpr - This class is private to Constants.cpp, and is used
|
||||
/// behind the scenes to implement extractelement constant exprs.
|
||||
class ExtractElementConstantExpr : public ConstantExpr {
|
||||
Use Ops[2];
|
||||
public:
|
||||
ExtractElementConstantExpr(Constant *C1, Constant *C2)
|
||||
: ConstantExpr(cast<PackedType>(C1->getType())->getElementType(),
|
||||
Instruction::ExtractElement, Ops, 2) {
|
||||
Ops[0].init(C1, this);
|
||||
Ops[1].init(C2, this);
|
||||
}
|
||||
};
|
||||
|
||||
/// GetElementPtrConstantExpr - This class is private to Constants.cpp, and is
|
||||
/// used behind the scenes to implement getelementpr constant exprs.
|
||||
struct GetElementPtrConstantExpr : public ConstantExpr {
|
||||
@ -1141,6 +1154,8 @@ namespace llvm {
|
||||
return new BinaryConstantExpr(V.first, V.second[0], V.second[1]);
|
||||
if (V.first == Instruction::Select)
|
||||
return new SelectConstantExpr(V.second[0], V.second[1], V.second[2]);
|
||||
if (V.first == Instruction::ExtractElement)
|
||||
return new ExtractElementConstantExpr(V.second[0], V.second[1]);
|
||||
|
||||
assert(V.first == Instruction::GetElementPtr && "Invalid ConstantExpr!");
|
||||
|
||||
@ -1386,6 +1401,23 @@ Constant *ConstantExpr::getGetElementPtr(Constant *C,
|
||||
return getGetElementPtrTy(PointerType::get(Ty), C, IdxList);
|
||||
}
|
||||
|
||||
Constant *ConstantExpr::getExtractElementTy(const Type *ReqTy, Constant *Val,
|
||||
Constant *Idx) {
|
||||
// Look up the constant in the table first to ensure uniqueness
|
||||
std::vector<Constant*> ArgVec(1, Val);
|
||||
ArgVec.push_back(Idx);
|
||||
const ExprMapKeyType &Key = std::make_pair(Instruction::ExtractElement,ArgVec);
|
||||
return ExprConstants.getOrCreate(ReqTy, Key);
|
||||
}
|
||||
|
||||
Constant *ConstantExpr::getExtractElement(Constant *Val, Constant *Idx) {
|
||||
assert(isa<PackedType>(Val->getType()) &&
|
||||
"Tried to create extractelement operation on non-packed type!");
|
||||
assert(Idx->getType() == Type::UIntTy &&
|
||||
"Index must be uint type!");
|
||||
return getExtractElementTy(cast<PackedType>(Val->getType())->getElementType(),
|
||||
Val, Idx);
|
||||
}
|
||||
|
||||
// destroyConstant - Remove the constant from the constant table...
|
||||
//
|
||||
@ -1581,6 +1613,12 @@ void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV,
|
||||
if (C2 == From) C2 = To;
|
||||
if (C3 == From) C3 = To;
|
||||
Replacement = ConstantExpr::getSelect(C1, C2, C3);
|
||||
} else if (getOpcode() == Instruction::ExtractElement) {
|
||||
Constant *C1 = getOperand(0);
|
||||
Constant *C2 = getOperand(1);
|
||||
if (C1 == From) C1 = To;
|
||||
if (C2 == From) C2 = To;
|
||||
Replacement = ConstantExpr::getExtractElement(C1, C2);
|
||||
} else if (getNumOperands() == 2) {
|
||||
Constant *C1 = getOperand(0);
|
||||
Constant *C2 = getOperand(1);
|
||||
|
@ -120,6 +120,7 @@ const char *Instruction::getOpcodeName(unsigned OpCode) {
|
||||
case Shl: return "shl";
|
||||
case Shr: return "shr";
|
||||
case VAArg: return "va_arg";
|
||||
case ExtractElement: return "extractelement";
|
||||
|
||||
default: return "<Invalid operator> ";
|
||||
}
|
||||
|
@ -795,6 +795,26 @@ const Type* GetElementPtrInst::getIndexedType(const Type *Ptr, Value *Idx) {
|
||||
return PTy->getElementType();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ExtractElementInst Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
|
||||
const std::string &Name, Instruction *InsertBef)
|
||||
: Instruction(cast<PackedType>(Val->getType())->getElementType(),
|
||||
ExtractElement, Ops, 2, Name, InsertBef) {
|
||||
Ops[0].init(Val, this);
|
||||
Ops[1].init(Index, this);
|
||||
}
|
||||
|
||||
ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
|
||||
const std::string &Name, BasicBlock *InsertAE)
|
||||
: Instruction(cast<PackedType>(Val->getType())->getElementType(),
|
||||
ExtractElement, Ops, 2, Name, InsertAE) {
|
||||
Ops[0].init(Val, this);
|
||||
Ops[1].init(Index, this);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// BinaryOperator Class
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -1155,6 +1175,7 @@ CallInst *CallInst::clone() const { return new CallInst(*this); }
|
||||
ShiftInst *ShiftInst::clone() const { return new ShiftInst(*this); }
|
||||
SelectInst *SelectInst::clone() const { return new SelectInst(*this); }
|
||||
VAArgInst *VAArgInst::clone() const { return new VAArgInst(*this); }
|
||||
ExtractElementInst *ExtractElementInst::clone() const {return new ExtractElementInst(*this); }
|
||||
PHINode *PHINode::clone() const { return new PHINode(*this); }
|
||||
ReturnInst *ReturnInst::clone() const { return new ReturnInst(*this); }
|
||||
BranchInst *BranchInst::clone() const { return new BranchInst(*this); }
|
||||
|
@ -178,6 +178,7 @@ namespace { // Anonymous namespace for class
|
||||
void visitPHINode(PHINode &PN);
|
||||
void visitBinaryOperator(BinaryOperator &B);
|
||||
void visitShiftInst(ShiftInst &SI);
|
||||
void visitExtractElementInst(ExtractElementInst &EI);
|
||||
void visitVAArgInst(VAArgInst &VAA) { visitInstruction(VAA); }
|
||||
void visitCallInst(CallInst &CI);
|
||||
void visitGetElementPtrInst(GetElementPtrInst &GEP);
|
||||
@ -532,6 +533,18 @@ void Verifier::visitShiftInst(ShiftInst &SI) {
|
||||
visitInstruction(SI);
|
||||
}
|
||||
|
||||
void Verifier::visitExtractElementInst(ExtractElementInst &EI) {
|
||||
Assert1(isa<PackedType>(EI.getOperand(0)->getType()),
|
||||
"First operand to extractelement must be packed type!", &EI);
|
||||
Assert1(EI.getOperand(1)->getType() == Type::UIntTy,
|
||||
"Second operand to extractelement must be uint type!", &EI);
|
||||
Assert1(EI.getType() ==
|
||||
cast<PackedType>(EI.getOperand(0)->getType())->getElementType(),
|
||||
"Extractelement return type must be same as "
|
||||
"first operand element type!", &EI);
|
||||
visitInstruction(EI);
|
||||
}
|
||||
|
||||
void Verifier::visitGetElementPtrInst(GetElementPtrInst &GEP) {
|
||||
const Type *ElTy =
|
||||
GetElementPtrInst::getIndexedType(GEP.getOperand(0)->getType(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
/* A Bison parser, made from /Users/sabre/llvm/utils/TableGen/FileParser.y
|
||||
/* A Bison parser, made from /Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y
|
||||
by GNU Bison version 1.28 */
|
||||
|
||||
#define YYBISON 1 /* Identify Bison output. */
|
||||
@ -32,7 +32,7 @@
|
||||
#define STRVAL 275
|
||||
#define CODEFRAGMENT 276
|
||||
|
||||
#line 14 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 14 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
|
||||
#include "Record.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
@ -207,7 +207,7 @@ static void addSubClass(Record *SC, const std::vector<Init*> &TemplateArgs) {
|
||||
using namespace llvm;
|
||||
|
||||
|
||||
#line 189 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 189 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
typedef union {
|
||||
std::string* StrVal;
|
||||
int IntVal;
|
||||
@ -1005,7 +1005,7 @@ yyreduce:
|
||||
switch (yyn) {
|
||||
|
||||
case 1:
|
||||
#line 223 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 223 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.Rec = Records.getClass(*yyvsp[0].StrVal);
|
||||
if (yyval.Rec == 0) {
|
||||
@ -1016,97 +1016,97 @@ case 1:
|
||||
;
|
||||
break;}
|
||||
case 2:
|
||||
#line 234 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 234 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ // string type
|
||||
yyval.Ty = new StringRecTy();
|
||||
;
|
||||
break;}
|
||||
case 3:
|
||||
#line 236 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 236 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ // bit type
|
||||
yyval.Ty = new BitRecTy();
|
||||
;
|
||||
break;}
|
||||
case 4:
|
||||
#line 238 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 238 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ // bits<x> type
|
||||
yyval.Ty = new BitsRecTy(yyvsp[-1].IntVal);
|
||||
;
|
||||
break;}
|
||||
case 5:
|
||||
#line 240 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 240 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ // int type
|
||||
yyval.Ty = new IntRecTy();
|
||||
;
|
||||
break;}
|
||||
case 6:
|
||||
#line 242 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 242 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ // list<x> type
|
||||
yyval.Ty = new ListRecTy(yyvsp[-1].Ty);
|
||||
;
|
||||
break;}
|
||||
case 7:
|
||||
#line 244 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 244 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ // code type
|
||||
yyval.Ty = new CodeRecTy();
|
||||
;
|
||||
break;}
|
||||
case 8:
|
||||
#line 246 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 246 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ // dag type
|
||||
yyval.Ty = new DagRecTy();
|
||||
;
|
||||
break;}
|
||||
case 9:
|
||||
#line 248 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 248 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ // Record Type
|
||||
yyval.Ty = new RecordRecTy(yyvsp[0].Rec);
|
||||
;
|
||||
break;}
|
||||
case 10:
|
||||
#line 252 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 252 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ yyval.IntVal = 0; ;
|
||||
break;}
|
||||
case 11:
|
||||
#line 252 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 252 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ yyval.IntVal = 1; ;
|
||||
break;}
|
||||
case 12:
|
||||
#line 254 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 254 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ yyval.Initializer = 0; ;
|
||||
break;}
|
||||
case 13:
|
||||
#line 254 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 254 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ yyval.Initializer = yyvsp[0].Initializer; ;
|
||||
break;}
|
||||
case 14:
|
||||
#line 256 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 256 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.Initializer = new IntInit(yyvsp[0].IntVal);
|
||||
;
|
||||
break;}
|
||||
case 15:
|
||||
#line 258 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 258 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.Initializer = new StringInit(*yyvsp[0].StrVal);
|
||||
delete yyvsp[0].StrVal;
|
||||
;
|
||||
break;}
|
||||
case 16:
|
||||
#line 261 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 261 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.Initializer = new CodeInit(*yyvsp[0].StrVal);
|
||||
delete yyvsp[0].StrVal;
|
||||
;
|
||||
break;}
|
||||
case 17:
|
||||
#line 264 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 264 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.Initializer = new UnsetInit();
|
||||
;
|
||||
break;}
|
||||
case 18:
|
||||
#line 266 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 266 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
BitsInit *Init = new BitsInit(yyvsp[-1].FieldList->size());
|
||||
for (unsigned i = 0, e = yyvsp[-1].FieldList->size(); i != e; ++i) {
|
||||
@ -1123,7 +1123,7 @@ case 18:
|
||||
;
|
||||
break;}
|
||||
case 19:
|
||||
#line 279 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 279 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
// This is a CLASS<initvalslist> expression. This is supposed to synthesize
|
||||
// a new anonymous definition, deriving from CLASS<initvalslist> with no
|
||||
@ -1155,7 +1155,7 @@ case 19:
|
||||
;
|
||||
break;}
|
||||
case 20:
|
||||
#line 307 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 307 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
if (const RecordVal *RV = (CurRec ? CurRec->getValue(*yyvsp[0].StrVal) : 0)) {
|
||||
yyval.Initializer = new VarInit(*yyvsp[0].StrVal, RV->getType());
|
||||
@ -1174,7 +1174,7 @@ case 20:
|
||||
;
|
||||
break;}
|
||||
case 21:
|
||||
#line 322 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 322 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.Initializer = yyvsp[-3].Initializer->convertInitializerBitRange(*yyvsp[-1].BitList);
|
||||
if (yyval.Initializer == 0) {
|
||||
@ -1185,14 +1185,14 @@ case 21:
|
||||
;
|
||||
break;}
|
||||
case 22:
|
||||
#line 329 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 329 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.Initializer = new ListInit(*yyvsp[-1].FieldList);
|
||||
delete yyvsp[-1].FieldList;
|
||||
;
|
||||
break;}
|
||||
case 23:
|
||||
#line 332 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 332 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
if (!yyvsp[-2].Initializer->getFieldType(*yyvsp[0].StrVal)) {
|
||||
err() << "Cannot access field '" << *yyvsp[0].StrVal << "' of value '" << *yyvsp[-2].Initializer << "!\n";
|
||||
@ -1203,7 +1203,7 @@ case 23:
|
||||
;
|
||||
break;}
|
||||
case 24:
|
||||
#line 339 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 339 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
Record *D = Records.getDef(*yyvsp[-2].StrVal);
|
||||
if (D == 0) {
|
||||
@ -1215,7 +1215,7 @@ case 24:
|
||||
;
|
||||
break;}
|
||||
case 25:
|
||||
#line 347 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 347 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
std::reverse(yyvsp[-1].BitList->begin(), yyvsp[-1].BitList->end());
|
||||
yyval.Initializer = yyvsp[-3].Initializer->convertInitListSlice(*yyvsp[-1].BitList);
|
||||
@ -1227,7 +1227,7 @@ case 25:
|
||||
;
|
||||
break;}
|
||||
case 26:
|
||||
#line 355 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 355 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SHL, yyvsp[-1].Initializer);
|
||||
if (yyval.Initializer == 0) {
|
||||
@ -1237,7 +1237,7 @@ case 26:
|
||||
;
|
||||
break;}
|
||||
case 27:
|
||||
#line 361 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 361 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRA, yyvsp[-1].Initializer);
|
||||
if (yyval.Initializer == 0) {
|
||||
@ -1247,7 +1247,7 @@ case 27:
|
||||
;
|
||||
break;}
|
||||
case 28:
|
||||
#line 367 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 367 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRL, yyvsp[-1].Initializer);
|
||||
if (yyval.Initializer == 0) {
|
||||
@ -1257,19 +1257,19 @@ case 28:
|
||||
;
|
||||
break;}
|
||||
case 29:
|
||||
#line 375 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 375 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.StrVal = new std::string();
|
||||
;
|
||||
break;}
|
||||
case 30:
|
||||
#line 378 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 378 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.StrVal = yyvsp[0].StrVal;
|
||||
;
|
||||
break;}
|
||||
case 31:
|
||||
#line 382 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 382 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
|
||||
yyval.DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
|
||||
@ -1277,7 +1277,7 @@ case 31:
|
||||
;
|
||||
break;}
|
||||
case 32:
|
||||
#line 387 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 387 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyvsp[-3].DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
|
||||
delete yyvsp[0].StrVal;
|
||||
@ -1285,24 +1285,24 @@ case 32:
|
||||
;
|
||||
break;}
|
||||
case 33:
|
||||
#line 393 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 393 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
|
||||
;
|
||||
break;}
|
||||
case 34:
|
||||
#line 396 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 396 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ yyval.DagValueList = yyvsp[0].DagValueList; ;
|
||||
break;}
|
||||
case 35:
|
||||
#line 399 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 399 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.BitList = new std::vector<unsigned>();
|
||||
yyval.BitList->push_back(yyvsp[0].IntVal);
|
||||
;
|
||||
break;}
|
||||
case 36:
|
||||
#line 402 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 402 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
|
||||
err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
|
||||
@ -1319,7 +1319,7 @@ case 36:
|
||||
;
|
||||
break;}
|
||||
case 37:
|
||||
#line 415 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 415 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyvsp[0].IntVal = -yyvsp[0].IntVal;
|
||||
if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
|
||||
@ -1337,13 +1337,13 @@ case 37:
|
||||
;
|
||||
break;}
|
||||
case 38:
|
||||
#line 429 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 429 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
(yyval.BitList=yyvsp[-2].BitList)->push_back(yyvsp[0].IntVal);
|
||||
;
|
||||
break;}
|
||||
case 39:
|
||||
#line 431 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 431 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
|
||||
err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
|
||||
@ -1360,7 +1360,7 @@ case 39:
|
||||
;
|
||||
break;}
|
||||
case 40:
|
||||
#line 444 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 444 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyvsp[0].IntVal = -yyvsp[0].IntVal;
|
||||
if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
|
||||
@ -1378,44 +1378,44 @@ case 40:
|
||||
;
|
||||
break;}
|
||||
case 41:
|
||||
#line 460 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 460 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ yyval.BitList = yyvsp[0].BitList; std::reverse(yyvsp[0].BitList->begin(), yyvsp[0].BitList->end()); ;
|
||||
break;}
|
||||
case 42:
|
||||
#line 462 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 462 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ yyval.BitList = 0; ;
|
||||
break;}
|
||||
case 43:
|
||||
#line 462 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 462 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ yyval.BitList = yyvsp[-1].BitList; ;
|
||||
break;}
|
||||
case 44:
|
||||
#line 466 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 466 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.FieldList = new std::vector<Init*>();
|
||||
;
|
||||
break;}
|
||||
case 45:
|
||||
#line 468 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 468 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.FieldList = yyvsp[0].FieldList;
|
||||
;
|
||||
break;}
|
||||
case 46:
|
||||
#line 472 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 472 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.FieldList = new std::vector<Init*>();
|
||||
yyval.FieldList->push_back(yyvsp[0].Initializer);
|
||||
;
|
||||
break;}
|
||||
case 47:
|
||||
#line 475 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 475 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
(yyval.FieldList = yyvsp[-2].FieldList)->push_back(yyvsp[0].Initializer);
|
||||
;
|
||||
break;}
|
||||
case 48:
|
||||
#line 479 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 479 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
std::string DecName = *yyvsp[-1].StrVal;
|
||||
if (ParsingTemplateArgs)
|
||||
@ -1427,13 +1427,13 @@ case 48:
|
||||
;
|
||||
break;}
|
||||
case 49:
|
||||
#line 489 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 489 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
delete yyvsp[-1].StrVal;
|
||||
;
|
||||
break;}
|
||||
case 50:
|
||||
#line 491 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 491 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
setValue(*yyvsp[-4].StrVal, yyvsp[-3].BitList, yyvsp[-1].Initializer);
|
||||
delete yyvsp[-4].StrVal;
|
||||
@ -1441,19 +1441,19 @@ case 50:
|
||||
;
|
||||
break;}
|
||||
case 55:
|
||||
#line 500 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 500 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.SubClassRef = new SubClassRefTy(yyvsp[0].Rec, new std::vector<Init*>());
|
||||
;
|
||||
break;}
|
||||
case 56:
|
||||
#line 502 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 502 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.SubClassRef = new SubClassRefTy(yyvsp[-3].Rec, yyvsp[-1].FieldList);
|
||||
;
|
||||
break;}
|
||||
case 57:
|
||||
#line 506 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 506 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.SubClassList = new std::vector<SubClassRefTy>();
|
||||
yyval.SubClassList->push_back(*yyvsp[0].SubClassRef);
|
||||
@ -1461,52 +1461,52 @@ case 57:
|
||||
;
|
||||
break;}
|
||||
case 58:
|
||||
#line 511 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 511 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
(yyval.SubClassList=yyvsp[-2].SubClassList)->push_back(*yyvsp[0].SubClassRef);
|
||||
delete yyvsp[0].SubClassRef;
|
||||
;
|
||||
break;}
|
||||
case 59:
|
||||
#line 516 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 516 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.SubClassList = new std::vector<SubClassRefTy>();
|
||||
;
|
||||
break;}
|
||||
case 60:
|
||||
#line 519 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 519 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.SubClassList = yyvsp[0].SubClassList;
|
||||
;
|
||||
break;}
|
||||
case 61:
|
||||
#line 523 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 523 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
CurRec->addTemplateArg(*yyvsp[0].StrVal);
|
||||
delete yyvsp[0].StrVal;
|
||||
;
|
||||
break;}
|
||||
case 62:
|
||||
#line 526 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 526 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
CurRec->addTemplateArg(*yyvsp[0].StrVal);
|
||||
delete yyvsp[0].StrVal;
|
||||
;
|
||||
break;}
|
||||
case 63:
|
||||
#line 531 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 531 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{;
|
||||
break;}
|
||||
case 66:
|
||||
#line 534 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 534 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ yyval.StrVal = yyvsp[0].StrVal; ;
|
||||
break;}
|
||||
case 67:
|
||||
#line 534 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 534 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ yyval.StrVal = new std::string(); ;
|
||||
break;}
|
||||
case 68:
|
||||
#line 536 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 536 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
static unsigned AnonCounter = 0;
|
||||
if (yyvsp[0].StrVal->empty())
|
||||
@ -1515,7 +1515,7 @@ case 68:
|
||||
;
|
||||
break;}
|
||||
case 69:
|
||||
#line 543 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 543 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
// If a class of this name already exists, it must be a forward ref.
|
||||
if ((CurRec = Records.getClass(*yyvsp[0].StrVal))) {
|
||||
@ -1535,7 +1535,7 @@ case 69:
|
||||
;
|
||||
break;}
|
||||
case 70:
|
||||
#line 561 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 561 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
CurRec = new Record(*yyvsp[0].StrVal);
|
||||
delete yyvsp[0].StrVal;
|
||||
@ -1549,7 +1549,7 @@ case 70:
|
||||
;
|
||||
break;}
|
||||
case 71:
|
||||
#line 573 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 573 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
for (unsigned i = 0, e = yyvsp[0].SubClassList->size(); i != e; ++i) {
|
||||
addSubClass((*yyvsp[0].SubClassList)[i].first, *(*yyvsp[0].SubClassList)[i].second);
|
||||
@ -1567,32 +1567,32 @@ case 71:
|
||||
;
|
||||
break;}
|
||||
case 72:
|
||||
#line 587 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 587 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.Rec = CurRec;
|
||||
CurRec = 0;
|
||||
;
|
||||
break;}
|
||||
case 73:
|
||||
#line 592 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 592 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
ParsingTemplateArgs = true;
|
||||
;
|
||||
break;}
|
||||
case 74:
|
||||
#line 594 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 594 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
ParsingTemplateArgs = false;
|
||||
;
|
||||
break;}
|
||||
case 75:
|
||||
#line 596 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 596 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyval.Rec = yyvsp[0].Rec;
|
||||
;
|
||||
break;}
|
||||
case 76:
|
||||
#line 600 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 600 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
yyvsp[0].Rec->resolveReferences();
|
||||
|
||||
@ -1602,38 +1602,38 @@ case 76:
|
||||
;
|
||||
break;}
|
||||
case 79:
|
||||
#line 611 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 611 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer));
|
||||
delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList;
|
||||
;
|
||||
break;}
|
||||
case 82:
|
||||
#line 619 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 619 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{ LetStack.push_back(std::vector<LetRecord>()); ;
|
||||
break;}
|
||||
case 84:
|
||||
#line 622 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 622 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
LetStack.pop_back();
|
||||
;
|
||||
break;}
|
||||
case 85:
|
||||
#line 625 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 625 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{
|
||||
LetStack.pop_back();
|
||||
;
|
||||
break;}
|
||||
case 86:
|
||||
#line 629 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 629 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{;
|
||||
break;}
|
||||
case 87:
|
||||
#line 629 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 629 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{;
|
||||
break;}
|
||||
case 88:
|
||||
#line 631 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 631 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
{;
|
||||
break;}
|
||||
}
|
||||
@ -1858,7 +1858,7 @@ yyerrhandle:
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#line 633 "/Users/sabre/llvm/utils/TableGen/FileParser.y"
|
||||
#line 633 "/Users/bocchino/vllvm-checkin/src/utils/TableGen/FileParser.y"
|
||||
|
||||
|
||||
int yyerror(const char *ErrorMsg) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user