aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen/CodeGenInstruction.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-07-11 23:06:52 +0000
committerEric Christopher <echristo@apple.com>2011-07-11 23:06:52 +0000
commitd568b3f55294917d1cc701da14a8a7daeb6563e6 (patch)
tree44a2842bc0b635140d86fc4c7896e4ca1e2a6d87 /utils/TableGen/CodeGenInstruction.cpp
parentd1c2bd8e6e37e08393f7c4980efc5bcb66b6f0d0 (diff)
downloadexternal_llvm-d568b3f55294917d1cc701da14a8a7daeb6563e6.zip
external_llvm-d568b3f55294917d1cc701da14a8a7daeb6563e6.tar.gz
external_llvm-d568b3f55294917d1cc701da14a8a7daeb6563e6.tar.bz2
Revert r134921, 134917, 134908 and 134907. They're causing failures
in multiple buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134936 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenInstruction.cpp')
-rw-r--r--utils/TableGen/CodeGenInstruction.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/utils/TableGen/CodeGenInstruction.cpp b/utils/TableGen/CodeGenInstruction.cpp
index c723c36..d1e63a9 100644
--- a/utils/TableGen/CodeGenInstruction.cpp
+++ b/utils/TableGen/CodeGenInstruction.cpp
@@ -30,10 +30,9 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
hasOptionalDef = false;
isVariadic = false;
- const DagInit *OutDI = R->getValueAsDag("OutOperandList");
+ DagInit *OutDI = R->getValueAsDag("OutOperandList");
- if (const DefInit *Init =
- dynamic_cast<const DefInit*>(OutDI->getOperator())) {
+ if (DefInit *Init = dynamic_cast<DefInit*>(OutDI->getOperator())) {
if (Init->getDef()->getName() != "outs")
throw R->getName() + ": invalid def name for output list: use 'outs'";
} else
@@ -41,8 +40,8 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
NumDefs = OutDI->getNumArgs();
- const DagInit *InDI = R->getValueAsDag("InOperandList");
- if (const DefInit *Init = dynamic_cast<const DefInit*>(InDI->getOperator())) {
+ DagInit *InDI = R->getValueAsDag("InOperandList");
+ if (DefInit *Init = dynamic_cast<DefInit*>(InDI->getOperator())) {
if (Init->getDef()->getName() != "ins")
throw R->getName() + ": invalid def name for input list: use 'ins'";
} else
@@ -51,7 +50,7 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
unsigned MIOperandNo = 0;
std::set<std::string> OperandNames;
for (unsigned i = 0, e = InDI->getNumArgs()+OutDI->getNumArgs(); i != e; ++i){
- const Init *ArgInit;
+ Init *ArgInit;
std::string ArgName;
if (i < NumDefs) {
ArgInit = OutDI->getArg(i);
@@ -61,7 +60,7 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
ArgName = InDI->getArgName(i-NumDefs);
}
- const DefInit *Arg = dynamic_cast<const DefInit*>(ArgInit);
+ DefInit *Arg = dynamic_cast<DefInit*>(ArgInit);
if (!Arg)
throw "Illegal operand for the '" + R->getName() + "' instruction!";
@@ -69,7 +68,7 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
std::string PrintMethod = "printOperand";
std::string EncoderMethod;
unsigned NumOps = 1;
- const DagInit *MIOpInfo = 0;
+ DagInit *MIOpInfo = 0;
if (Rec->isSubClassOf("RegisterOperand")) {
PrintMethod = Rec->getValueAsString("PrintMethod");
} else if (Rec->isSubClassOf("Operand")) {
@@ -79,8 +78,8 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
MIOpInfo = Rec->getValueAsDag("MIOperandInfo");
// Verify that MIOpInfo has an 'ops' root value.
- if (!dynamic_cast<const DefInit*>(MIOpInfo->getOperator()) ||
- dynamic_cast<const DefInit*>(MIOpInfo->getOperator())
+ if (!dynamic_cast<DefInit*>(MIOpInfo->getOperator()) ||
+ dynamic_cast<DefInit*>(MIOpInfo->getOperator())
->getDef()->getName() != "ops")
throw "Bad value for MIOperandInfo in operand '" + Rec->getName() +
"'\n";
@@ -179,7 +178,7 @@ CGIOperandList::ParseOperandName(const std::string &Op, bool AllowWholeOp) {
}
// Find the suboperand number involved.
- const DagInit *MIOpInfo = OperandList[OpIdx].MIOperandInfo;
+ DagInit *MIOpInfo = OperandList[OpIdx].MIOperandInfo;
if (MIOpInfo == 0)
throw TheDef->getName() + ": unknown suboperand name in '" + Op + "'";
@@ -401,13 +400,12 @@ FlattenAsmStringVariants(StringRef Cur, unsigned Variant) {
/// constructor. It checks if an argument in an InstAlias pattern matches
/// the corresponding operand of the instruction. It returns true on a
/// successful match, with ResOp set to the result operand to be used.
-bool CodeGenInstAlias::tryAliasOpMatch(const DagInit *Result,
- unsigned AliasOpNo,
+bool CodeGenInstAlias::tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo,
Record *InstOpRec, bool hasSubOps,
SMLoc Loc, CodeGenTarget &T,
ResultOperand &ResOp) {
- const Init *Arg = Result->getArg(AliasOpNo);
- const DefInit *ADI = dynamic_cast<const DefInit*>(Arg);
+ Init *Arg = Result->getArg(AliasOpNo);
+ DefInit *ADI = dynamic_cast<DefInit*>(Arg);
if (ADI && ADI->getDef() == InstOpRec) {
// If the operand is a record, it must have a name, and the record type
@@ -453,7 +451,7 @@ bool CodeGenInstAlias::tryAliasOpMatch(const DagInit *Result,
return true;
}
- if (const IntInit *II = dynamic_cast<const IntInit*>(Arg)) {
+ if (IntInit *II = dynamic_cast<IntInit*>(Arg)) {
if (hasSubOps || !InstOpRec->isSubClassOf("Operand"))
return false;
// Integer arguments can't have names.
@@ -472,7 +470,7 @@ CodeGenInstAlias::CodeGenInstAlias(Record *R, CodeGenTarget &T) : TheDef(R) {
Result = R->getValueAsDag("ResultInst");
// Verify that the root of the result is an instruction.
- const DefInit *DI = dynamic_cast<const DefInit*>(Result->getOperator());
+ DefInit *DI = dynamic_cast<DefInit*>(Result->getOperator());
if (DI == 0 || !DI->getDef()->isSubClassOf("Instruction"))
throw TGError(R->getLoc(), "result of inst alias should be an instruction");
@@ -482,7 +480,7 @@ CodeGenInstAlias::CodeGenInstAlias(Record *R, CodeGenTarget &T) : TheDef(R) {
// the same class.
StringMap<Record*> NameClass;
for (unsigned i = 0, e = Result->getNumArgs(); i != e; ++i) {
- const DefInit *ADI = dynamic_cast<const DefInit*>(Result->getArg(i));
+ DefInit *ADI = dynamic_cast<DefInit*>(Result->getArg(i));
if (!ADI || Result->getArgName(i).empty())
continue;
// Verify we don't have something like: (someinst GR16:$foo, GR32:$foo)
@@ -521,12 +519,11 @@ CodeGenInstAlias::CodeGenInstAlias(Record *R, CodeGenTarget &T) : TheDef(R) {
// If the argument did not match the instruction operand, and the operand
// is composed of multiple suboperands, try matching the suboperands.
if (NumSubOps > 1) {
- const DagInit *MIOI = ResultInst->Operands[i].MIOperandInfo;
+ DagInit *MIOI = ResultInst->Operands[i].MIOperandInfo;
for (unsigned SubOp = 0; SubOp != NumSubOps; ++SubOp) {
if (AliasOpNo >= Result->getNumArgs())
throw TGError(R->getLoc(), "not enough arguments for instruction!");
- Record *SubRec =
- dynamic_cast<const DefInit*>(MIOI->getArg(SubOp))->getDef();
+ Record *SubRec = dynamic_cast<DefInit*>(MIOI->getArg(SubOp))->getDef();
if (tryAliasOpMatch(Result, AliasOpNo, SubRec, false,
R->getLoc(), T, ResOp)) {
ResultOperands.push_back(ResOp);