aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorPirama Arumuga Nainar <pirama@google.com>2015-04-08 08:55:49 -0700
committerPirama Arumuga Nainar <pirama@google.com>2015-04-09 15:04:38 -0700
commit4c5e43da7792f75567b693105cc53e3f1992ad98 (patch)
tree1b2c9792582e12f5af0b1512e3094425f0dc0df9 /utils
parentc75239e6119d0f9a74c57099d91cbc9bde56bf33 (diff)
downloadexternal_llvm-4c5e43da7792f75567b693105cc53e3f1992ad98.zip
external_llvm-4c5e43da7792f75567b693105cc53e3f1992ad98.tar.gz
external_llvm-4c5e43da7792f75567b693105cc53e3f1992ad98.tar.bz2
Update aosp/master llvm for rebase to r233350
Change-Id: I07d935f8793ee8ec6b7da003f6483046594bca49
Diffstat (limited to 'utils')
-rw-r--r--utils/FileCheck/FileCheck.cpp3
-rw-r--r--utils/KillTheDoctor/KillTheDoctor.cpp1
-rw-r--r--utils/TableGen/AsmMatcherEmitter.cpp12
-rw-r--r--utils/TableGen/AsmWriterEmitter.cpp2
-rw-r--r--utils/TableGen/CodeGenDAGPatterns.cpp494
-rw-r--r--utils/TableGen/CodeGenDAGPatterns.h16
-rw-r--r--utils/TableGen/CodeGenInstruction.cpp1
-rw-r--r--utils/TableGen/CodeGenInstruction.h1
-rw-r--r--utils/TableGen/CodeGenRegisters.cpp14
-rw-r--r--utils/TableGen/CodeGenRegisters.h8
-rw-r--r--utils/TableGen/DAGISelMatcherEmitter.cpp4
-rw-r--r--utils/TableGen/FixedLenDecoderEmitter.cpp2
-rw-r--r--utils/TableGen/InstrInfoEmitter.cpp18
-rw-r--r--utils/TableGen/RegisterInfoEmitter.cpp36
-rw-r--r--utils/TableGen/SubtargetEmitter.cpp46
-rw-r--r--utils/TableGen/X86DisassemblerTables.cpp12
-rw-r--r--utils/lit/lit/TestRunner.py52
-rwxr-xr-xutils/release/export.sh3
-rw-r--r--utils/unittest/googletest/include/gtest/gtest.h2
-rw-r--r--utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h3
-rw-r--r--utils/unittest/googletest/include/gtest/internal/gtest-port.h2
21 files changed, 435 insertions, 297 deletions
diff --git a/utils/FileCheck/FileCheck.cpp b/utils/FileCheck/FileCheck.cpp
index 146b512..f7c0524 100644
--- a/utils/FileCheck/FileCheck.cpp
+++ b/utils/FileCheck/FileCheck.cpp
@@ -1053,7 +1053,6 @@ size_t CheckString::Check(const SourceMgr &SM, StringRef Buffer,
PrintCheckFailed(SM, *this, MatchBuffer, VariableTable);
return StringRef::npos;
}
- MatchPos += LastPos;
// Similar to the above, in "label-scan mode" we can't yet handle CHECK-NEXT
// or CHECK-NOT
@@ -1076,7 +1075,7 @@ size_t CheckString::Check(const SourceMgr &SM, StringRef Buffer,
return StringRef::npos;
}
- return MatchPos;
+ return LastPos + MatchPos;
}
bool CheckString::CheckNext(const SourceMgr &SM, StringRef Buffer) const {
diff --git a/utils/KillTheDoctor/KillTheDoctor.cpp b/utils/KillTheDoctor/KillTheDoctor.cpp
index 111bad2..fae3b1a 100644
--- a/utils/KillTheDoctor/KillTheDoctor.cpp
+++ b/utils/KillTheDoctor/KillTheDoctor.cpp
@@ -38,6 +38,7 @@
#include "llvm/ADT/Twine.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/Path.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/WindowsError.h"
diff --git a/utils/TableGen/AsmMatcherEmitter.cpp b/utils/TableGen/AsmMatcherEmitter.cpp
index 65a34d3..159bc23 100644
--- a/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/utils/TableGen/AsmMatcherEmitter.cpp
@@ -264,6 +264,11 @@ public:
}
/// operator< - Compare two classes.
+ // FIXME: This ordering seems to be broken. For example:
+ // u64 < i64, i64 < s8, s8 < u64, forming a cycle
+ // u64 is a subset of i64
+ // i64 and s8 are not subsets of each other, so are ordered by name
+ // s8 and u64 are not subsets of each other, so are ordered by name
bool operator<(const ClassInfo &RHS) const {
if (this == &RHS)
return false;
@@ -1447,8 +1452,9 @@ void AsmMatcherInfo::buildInfo() {
II->buildAliasResultOperands();
}
if (!NewMatchables.empty())
- std::move(NewMatchables.begin(), NewMatchables.end(),
- std::back_inserter(Matchables));
+ Matchables.insert(Matchables.end(),
+ std::make_move_iterator(NewMatchables.begin()),
+ std::make_move_iterator(NewMatchables.end()));
// Process token alias definitions and set up the associated superclass
// information.
@@ -2881,7 +2887,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
OS << " uint64_t MissingFeatures = ~0ULL;\n";
OS << " // Set ErrorInfo to the operand that mismatches if it is\n";
OS << " // wrong for all instances of the instruction.\n";
- OS << " ErrorInfo = ~0U;\n";
+ OS << " ErrorInfo = ~0ULL;\n";
// Emit code to search the table.
OS << " // Find the appropriate table for this asm variant.\n";
diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp
index 587de26..447b7c8 100644
--- a/utils/TableGen/AsmWriterEmitter.cpp
+++ b/utils/TableGen/AsmWriterEmitter.cpp
@@ -727,7 +727,7 @@ public:
OS.flush();
// Emit the string.
- O.indent(6) << "AsmString = \"" << OutString.str() << "\";\n";
+ O.indent(6) << "AsmString = \"" << OutString << "\";\n";
O.indent(6) << "break;\n";
O.indent(4) << '}';
diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp
index 4e3e588..56743f3 100644
--- a/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -389,52 +389,6 @@ bool EEVT::TypeSet::EnforceSmallerThan(EEVT::TypeSet &Other, TreePattern &TP) {
else if (!Other.hasScalarTypes())
MadeChange |= EnforceVector(TP);
- // For vectors we need to ensure that smaller size doesn't produce larger
- // vector and vice versa.
- if (isConcrete() && isVector(getConcrete())) {
- MVT IVT = getConcrete();
- unsigned Size = IVT.getSizeInBits();
-
- // Only keep types that have at least as many bits.
- TypeSet InputSet(Other);
-
- for (unsigned i = 0; i != Other.TypeVec.size(); ++i) {
- assert(isVector(Other.TypeVec[i]) && "EnforceVector didn't work");
- if (MVT(Other.TypeVec[i]).getSizeInBits() < Size) {
- Other.TypeVec.erase(Other.TypeVec.begin()+i--);
- MadeChange = true;
- }
- }
-
- if (Other.TypeVec.empty()) { // FIXME: Really want an SMLoc here!
- TP.error("Type inference contradiction found, forcing '" +
- InputSet.getName() + "' to have at least as many bits as " +
- getName() + "'");
- return false;
- }
- } else if (Other.isConcrete() && isVector(Other.getConcrete())) {
- MVT IVT = Other.getConcrete();
- unsigned Size = IVT.getSizeInBits();
-
- // Only keep types with the same or fewer total bits
- TypeSet InputSet(*this);
-
- for (unsigned i = 0; i != TypeVec.size(); ++i) {
- assert(isVector(TypeVec[i]) && "EnforceVector didn't work");
- if (MVT(TypeVec[i]).getSizeInBits() > Size) {
- TypeVec.erase(TypeVec.begin()+i--);
- MadeChange = true;
- }
- }
-
- if (TypeVec.empty()) { // FIXME: Really want an SMLoc here!
- TP.error("Type inference contradiction found, forcing '" +
- InputSet.getName() + "' to have the same or fewer bits than " +
- Other.getName() + "'");
- return false;
- }
- }
-
// This code does not currently handle nodes which have multiple types,
// where some types are integer, and some are fp. Assert that this is not
// the case.
@@ -445,12 +399,22 @@ bool EEVT::TypeSet::EnforceSmallerThan(EEVT::TypeSet &Other, TreePattern &TP) {
if (TP.hasError())
return false;
- // Okay, find the smallest scalar type from the other set and remove
- // anything the same or smaller from the current set.
+ // Okay, find the smallest type from current set and remove anything the
+ // same or smaller from the other set. We need to ensure that the scalar
+ // type size is smaller than the scalar size of the smallest type. For
+ // vectors, we also need to make sure that the total size is no larger than
+ // the size of the smallest type.
TypeSet InputSet(Other);
- MVT::SimpleValueType Smallest = TypeVec[0];
+ MVT Smallest = TypeVec[0];
for (unsigned i = 0; i != Other.TypeVec.size(); ++i) {
- if (Other.TypeVec[i] <= Smallest) {
+ MVT OtherVT = Other.TypeVec[i];
+ // Don't compare vector and non-vector types.
+ if (OtherVT.isVector() != Smallest.isVector())
+ continue;
+ // The getSizeInBits() check here is only needed for vectors, but is
+ // a subset of the scalar check for scalars so no need to qualify.
+ if (OtherVT.getScalarSizeInBits() <= Smallest.getScalarSizeInBits() ||
+ OtherVT.getSizeInBits() < Smallest.getSizeInBits()) {
Other.TypeVec.erase(Other.TypeVec.begin()+i--);
MadeChange = true;
}
@@ -462,12 +426,22 @@ bool EEVT::TypeSet::EnforceSmallerThan(EEVT::TypeSet &Other, TreePattern &TP) {
return false;
}
- // Okay, find the largest scalar type from the other set and remove
- // anything the same or larger from the current set.
+ // Okay, find the largest type from the other set and remove anything the
+ // same or smaller from the current set. We need to ensure that the scalar
+ // type size is larger than the scalar size of the largest type. For
+ // vectors, we also need to make sure that the total size is no smaller than
+ // the size of the largest type.
InputSet = TypeSet(*this);
- MVT::SimpleValueType Largest = Other.TypeVec[Other.TypeVec.size()-1];
+ MVT Largest = Other.TypeVec[Other.TypeVec.size()-1];
for (unsigned i = 0; i != TypeVec.size(); ++i) {
- if (TypeVec[i] >= Largest) {
+ MVT OtherVT = TypeVec[i];
+ // Don't compare vector and non-vector types.
+ if (OtherVT.isVector() != Largest.isVector())
+ continue;
+ // The getSizeInBits() check here is only needed for vectors, but is
+ // a subset of the scalar check for scalars so no need to qualify.
+ if (OtherVT.getScalarSizeInBits() >= Largest.getScalarSizeInBits() ||
+ OtherVT.getSizeInBits() > Largest.getSizeInBits()) {
TypeVec.erase(TypeVec.begin()+i--);
MadeChange = true;
}
@@ -484,6 +458,34 @@ bool EEVT::TypeSet::EnforceSmallerThan(EEVT::TypeSet &Other, TreePattern &TP) {
/// EnforceVectorEltTypeIs - 'this' is now constrainted to be a vector type
/// whose element is specified by VTOperand.
+bool EEVT::TypeSet::EnforceVectorEltTypeIs(MVT::SimpleValueType VT,
+ TreePattern &TP) {
+ bool MadeChange = false;
+
+ MadeChange |= EnforceVector(TP);
+
+ TypeSet InputSet(*this);
+
+ // Filter out all the types which don't have the right element type.
+ for (unsigned i = 0; i != TypeVec.size(); ++i) {
+ assert(isVector(TypeVec[i]) && "EnforceVector didn't work");
+ if (MVT(TypeVec[i]).getVectorElementType().SimpleTy != VT) {
+ TypeVec.erase(TypeVec.begin()+i--);
+ MadeChange = true;
+ }
+ }
+
+ if (TypeVec.empty()) { // FIXME: Really want an SMLoc here!
+ TP.error("Type inference contradiction found, forcing '" +
+ InputSet.getName() + "' to have a vector element");
+ return false;
+ }
+
+ return MadeChange;
+}
+
+/// EnforceVectorEltTypeIs - 'this' is now constrainted to be a vector type
+/// whose element is specified by VTOperand.
bool EEVT::TypeSet::EnforceVectorEltTypeIs(EEVT::TypeSet &VTOperand,
TreePattern &TP) {
if (TP.hasError())
@@ -609,6 +611,64 @@ bool EEVT::TypeSet::EnforceVectorSubVectorTypeIs(EEVT::TypeSet &VTOperand,
return MadeChange;
}
+/// EnforceVectorSameNumElts - 'this' is now constrainted to
+/// be a vector with same num elements as VTOperand.
+bool EEVT::TypeSet::EnforceVectorSameNumElts(EEVT::TypeSet &VTOperand,
+ TreePattern &TP) {
+ if (TP.hasError())
+ return false;
+
+ // "This" must be a vector and "VTOperand" must be a vector.
+ bool MadeChange = false;
+ MadeChange |= EnforceVector(TP);
+ MadeChange |= VTOperand.EnforceVector(TP);
+
+ // If we know one of the vector types, it forces the other type to agree.
+ if (isConcrete()) {
+ MVT IVT = getConcrete();
+ unsigned NumElems = IVT.getVectorNumElements();
+
+ // Only keep types that have same elements as VTOperand.
+ TypeSet InputSet(VTOperand);
+
+ for (unsigned i = 0; i != VTOperand.TypeVec.size(); ++i) {
+ assert(isVector(VTOperand.TypeVec[i]) && "EnforceVector didn't work");
+ if (MVT(VTOperand.TypeVec[i]).getVectorNumElements() != NumElems) {
+ VTOperand.TypeVec.erase(VTOperand.TypeVec.begin()+i--);
+ MadeChange = true;
+ }
+ }
+ if (VTOperand.TypeVec.empty()) { // FIXME: Really want an SMLoc here!
+ TP.error("Type inference contradiction found, forcing '" +
+ InputSet.getName() + "' to have same number elements as '" +
+ getName() + "'");
+ return false;
+ }
+ } else if (VTOperand.isConcrete()) {
+ MVT IVT = VTOperand.getConcrete();
+ unsigned NumElems = IVT.getVectorNumElements();
+
+ // Only keep types that have same elements as 'this'.
+ TypeSet InputSet(*this);
+
+ for (unsigned i = 0; i != TypeVec.size(); ++i) {
+ assert(isVector(TypeVec[i]) && "EnforceVector didn't work");
+ if (MVT(TypeVec[i]).getVectorNumElements() != NumElems) {
+ TypeVec.erase(TypeVec.begin()+i--);
+ MadeChange = true;
+ }
+ }
+ if (TypeVec.empty()) { // FIXME: Really want an SMLoc here!
+ TP.error("Type inference contradiction found, forcing '" +
+ InputSet.getName() + "' to have same number elements than '" +
+ VTOperand.getName() + "'");
+ return false;
+ }
+ }
+
+ return MadeChange;
+}
+
//===----------------------------------------------------------------------===//
// Helpers for working with extended types.
@@ -839,6 +899,19 @@ SDTypeConstraint::SDTypeConstraint(Record *R) {
ConstraintType = SDTCisSubVecOfVec;
x.SDTCisSubVecOfVec_Info.OtherOperandNum =
R->getValueAsInt("OtherOpNum");
+ } else if (R->isSubClassOf("SDTCVecEltisVT")) {
+ ConstraintType = SDTCVecEltisVT;
+ x.SDTCVecEltisVT_Info.VT = getValueType(R->getValueAsDef("VT"));
+ if (MVT(x.SDTCVecEltisVT_Info.VT).isVector())
+ PrintFatalError(R->getLoc(), "Cannot use vector type as SDTCVecEltisVT");
+ if (!MVT(x.SDTCVecEltisVT_Info.VT).isInteger() &&
+ !MVT(x.SDTCVecEltisVT_Info.VT).isFloatingPoint())
+ PrintFatalError(R->getLoc(), "Must use integer or floating point type "
+ "as SDTCVecEltisVT");
+ } else if (R->isSubClassOf("SDTCisSameNumEltsAs")) {
+ ConstraintType = SDTCisSameNumEltsAs;
+ x.SDTCisSameNumEltsAs_Info.OtherOperandNum =
+ R->getValueAsInt("OtherOperandNum");
} else {
errs() << "Unrecognized SDTypeConstraint '" << R->getName() << "'!\n";
exit(1);
@@ -901,8 +974,8 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N,
unsigned OResNo = 0;
TreePatternNode *OtherNode =
getOperandNum(x.SDTCisSameAs_Info.OtherOperandNum, N, NodeInfo, OResNo);
- return NodeToApply->UpdateNodeType(OResNo, OtherNode->getExtType(ResNo),TP)|
- OtherNode->UpdateNodeType(ResNo,NodeToApply->getExtType(OResNo),TP);
+ return NodeToApply->UpdateNodeType(ResNo, OtherNode->getExtType(OResNo),TP)|
+ OtherNode->UpdateNodeType(OResNo,NodeToApply->getExtType(ResNo),TP);
}
case SDTCisVTSmallerThanOp: {
// The NodeToApply must be a leaf node that is a VT. OtherOperandNum must
@@ -956,6 +1029,18 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N,
return BigVecOperand->getExtType(VResNo).
EnforceVectorSubVectorTypeIs(NodeToApply->getExtType(ResNo), TP);
}
+ case SDTCVecEltisVT: {
+ return NodeToApply->getExtType(ResNo).
+ EnforceVectorEltTypeIs(x.SDTCVecEltisVT_Info.VT, TP);
+ }
+ case SDTCisSameNumEltsAs: {
+ unsigned OResNo = 0;
+ TreePatternNode *OtherNode =
+ getOperandNum(x.SDTCisSameNumEltsAs_Info.OtherOperandNum,
+ N, NodeInfo, OResNo);
+ return OtherNode->getExtType(OResNo).
+ EnforceVectorSameNumElts(NodeToApply->getExtType(ResNo), TP);
+ }
}
llvm_unreachable("Invalid ConstraintType!");
}
@@ -1111,10 +1196,16 @@ static unsigned GetNumNodeResults(Record *Operator, CodeGenDAGPatterns &CDP) {
if (Operator->isSubClassOf("Instruction")) {
CodeGenInstruction &InstInfo = CDP.getTargetInfo().getInstruction(Operator);
- // FIXME: Should allow access to all the results here.
- unsigned NumDefsToAdd = InstInfo.Operands.NumDefs ? 1 : 0;
- if (InstInfo.hasTwoExplicitDefs)
- ++NumDefsToAdd;
+ unsigned NumDefsToAdd = InstInfo.Operands.NumDefs;
+
+ // Subtract any defaulted outputs.
+ for (unsigned i = 0; i != InstInfo.Operands.NumDefs; ++i) {
+ Record *OperandNode = InstInfo.Operands[i].Rec;
+
+ if (OperandNode->isSubClassOf("OperandWithDefaultOps") &&
+ !CDP.getDefaultOperand(OperandNode).DefaultOps.empty())
+ --NumDefsToAdd;
+ }
// Add on one implicit def if it has a resolvable type.
if (InstInfo.HasOneImplicitDefWithKnownVT(CDP.getTargetInfo()) !=MVT::Other)
@@ -1611,20 +1702,11 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
assert(getNumTypes() == 0 && "Set doesn't produce a value");
assert(getNumChildren() >= 2 && "Missing RHS of a set?");
unsigned NC = getNumChildren();
- unsigned NumOfSrcs = NC-1;
- // destination
TreePatternNode *SetVal = getChild(NC-1);
bool MadeChange = SetVal->ApplyTypeConstraints(TP, NotRegisters);
- // second explicit destination
- if (TP.getRecord()->getValueAsBit("hasTwoExplicitDefs")) {
- TreePatternNode *Set2Val = getChild(NC-2);
- MadeChange = Set2Val->ApplyTypeConstraints(TP, NotRegisters);
- NumOfSrcs --;
- }
-
- for (unsigned i = 0; i < NumOfSrcs; ++i) {
+ for (unsigned i = 0; i < NC-1; ++i) {
TreePatternNode *Child = getChild(i);
MadeChange |= Child->ApplyTypeConstraints(TP, NotRegisters);
@@ -1700,8 +1782,8 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
// Apply the result types to the node, these come from the things in the
// (outs) list of the instruction.
- // FIXME: Cap at one result so far.
- unsigned NumResultsToAdd = InstInfo.Operands.NumDefs ? 1 : 0;
+ unsigned NumResultsToAdd = std::min(InstInfo.Operands.NumDefs,
+ Inst.getNumResults());
for (unsigned ResNo = 0; ResNo != NumResultsToAdd; ++ResNo)
MadeChange |= UpdateNodeTypeFromInst(ResNo, Inst.getResult(ResNo), TP);
@@ -2822,158 +2904,161 @@ static bool checkOperandClass(CGIOperandList::OperandInfo &OI,
const DAGInstruction &CodeGenDAGPatterns::parseInstructionPattern(
CodeGenInstruction &CGI, ListInit *Pat, DAGInstMap &DAGInsts) {
- assert(!DAGInsts.count(CGI.TheDef) && "Instruction already parsed!");
+ assert(!DAGInsts.count(CGI.TheDef) && "Instruction already parsed!");
- // Parse the instruction.
- TreePattern *I = new TreePattern(CGI.TheDef, Pat, true, *this);
- // Inline pattern fragments into it.
- I->InlinePatternFragments();
+ // Parse the instruction.
+ TreePattern *I = new TreePattern(CGI.TheDef, Pat, true, *this);
+ // Inline pattern fragments into it.
+ I->InlinePatternFragments();
- // Infer as many types as possible. If we cannot infer all of them, we can
- // never do anything with this instruction pattern: report it to the user.
- if (!I->InferAllTypes())
- I->error("Could not infer all types in pattern!");
+ // Infer as many types as possible. If we cannot infer all of them, we can
+ // never do anything with this instruction pattern: report it to the user.
+ if (!I->InferAllTypes())
+ I->error("Could not infer all types in pattern!");
- // InstInputs - Keep track of all of the inputs of the instruction, along
- // with the record they are declared as.
- std::map<std::string, TreePatternNode*> InstInputs;
+ // InstInputs - Keep track of all of the inputs of the instruction, along
+ // with the record they are declared as.
+ std::map<std::string, TreePatternNode*> InstInputs;
- // InstResults - Keep track of all the virtual registers that are 'set'
- // in the instruction, including what reg class they are.
- std::map<std::string, TreePatternNode*> InstResults;
+ // InstResults - Keep track of all the virtual registers that are 'set'
+ // in the instruction, including what reg class they are.
+ std::map<std::string, TreePatternNode*> InstResults;
- std::vector<Record*> InstImpResults;
+ std::vector<Record*> InstImpResults;
- // Verify that the top-level forms in the instruction are of void type, and
- // fill in the InstResults map.
- for (unsigned j = 0, e = I->getNumTrees(); j != e; ++j) {
- TreePatternNode *Pat = I->getTree(j);
- if (Pat->getNumTypes() != 0)
- I->error("Top-level forms in instruction pattern should have"
- " void types");
+ // Verify that the top-level forms in the instruction are of void type, and
+ // fill in the InstResults map.
+ for (unsigned j = 0, e = I->getNumTrees(); j != e; ++j) {
+ TreePatternNode *Pat = I->getTree(j);
+ if (Pat->getNumTypes() != 0)
+ I->error("Top-level forms in instruction pattern should have"
+ " void types");
- // Find inputs and outputs, and verify the structure of the uses/defs.
- FindPatternInputsAndOutputs(I, Pat, InstInputs, InstResults,
- InstImpResults);
- }
+ // Find inputs and outputs, and verify the structure of the uses/defs.
+ FindPatternInputsAndOutputs(I, Pat, InstInputs, InstResults,
+ InstImpResults);
+ }
- // Now that we have inputs and outputs of the pattern, inspect the operands
- // list for the instruction. This determines the order that operands are
- // added to the machine instruction the node corresponds to.
- unsigned NumResults = InstResults.size();
+ // Now that we have inputs and outputs of the pattern, inspect the operands
+ // list for the instruction. This determines the order that operands are
+ // added to the machine instruction the node corresponds to.
+ unsigned NumResults = InstResults.size();
- // Parse the operands list from the (ops) list, validating it.
- assert(I->getArgList().empty() && "Args list should still be empty here!");
+ // Parse the operands list from the (ops) list, validating it.
+ assert(I->getArgList().empty() && "Args list should still be empty here!");
- // Check that all of the results occur first in the list.
- std::vector<Record*> Results;
- SmallVector<TreePatternNode *, 2> ResNode;
- for (unsigned i = 0; i != NumResults; ++i) {
- if (i == CGI.Operands.size())
- I->error("'" + InstResults.begin()->first +
- "' set but does not appear in operand list!");
- const std::string &OpName = CGI.Operands[i].Name;
+ // Check that all of the results occur first in the list.
+ std::vector<Record*> Results;
+ SmallVector<TreePatternNode *, 2> ResNodes;
+ for (unsigned i = 0; i != NumResults; ++i) {
+ if (i == CGI.Operands.size())
+ I->error("'" + InstResults.begin()->first +
+ "' set but does not appear in operand list!");
+ const std::string &OpName = CGI.Operands[i].Name;
- // Check that it exists in InstResults.
- TreePatternNode *RNode = InstResults[OpName];
- if (!RNode)
- I->error("Operand $" + OpName + " does not exist in operand list!");
+ // Check that it exists in InstResults.
+ TreePatternNode *RNode = InstResults[OpName];
+ if (!RNode)
+ I->error("Operand $" + OpName + " does not exist in operand list!");
- ResNode.push_back(RNode);
- Record *R = cast<DefInit>(RNode->getLeafValue())->getDef();
- if (!R)
- I->error("Operand $" + OpName + " should be a set destination: all "
- "outputs must occur before inputs in operand list!");
+ ResNodes.push_back(RNode);
- if (!checkOperandClass(CGI.Operands[i], R))
- I->error("Operand $" + OpName + " class mismatch!");
+ Record *R = cast<DefInit>(RNode->getLeafValue())->getDef();
+ if (!R)
+ I->error("Operand $" + OpName + " should be a set destination: all "
+ "outputs must occur before inputs in operand list!");
- // Remember the return type.
- Results.push_back(CGI.Operands[i].Rec);
+ if (!checkOperandClass(CGI.Operands[i], R))
+ I->error("Operand $" + OpName + " class mismatch!");
- // Okay, this one checks out.
- InstResults.erase(OpName);
- }
+ // Remember the return type.
+ Results.push_back(CGI.Operands[i].Rec);
- // Loop over the inputs next. Make a copy of InstInputs so we can destroy
- // the copy while we're checking the inputs.
- std::map<std::string, TreePatternNode*> InstInputsCheck(InstInputs);
+ // Okay, this one checks out.
+ InstResults.erase(OpName);
+ }
- std::vector<TreePatternNode*> ResultNodeOperands;
- std::vector<Record*> Operands;
- for (unsigned i = NumResults, e = CGI.Operands.size(); i != e; ++i) {
- CGIOperandList::OperandInfo &Op = CGI.Operands[i];
- const std::string &OpName = Op.Name;
- if (OpName.empty())
- I->error("Operand #" + utostr(i) + " in operands list has no name!");
-
- if (!InstInputsCheck.count(OpName)) {
- // If this is an operand with a DefaultOps set filled in, we can ignore
- // this. When we codegen it, we will do so as always executed.
- if (Op.Rec->isSubClassOf("OperandWithDefaultOps")) {
- // Does it have a non-empty DefaultOps field? If so, ignore this
- // operand.
- if (!getDefaultOperand(Op.Rec).DefaultOps.empty())
- continue;
- }
- I->error("Operand $" + OpName +
- " does not appear in the instruction pattern");
- }
- TreePatternNode *InVal = InstInputsCheck[OpName];
- InstInputsCheck.erase(OpName); // It occurred, remove from map.
-
- if (InVal->isLeaf() && isa<DefInit>(InVal->getLeafValue())) {
- Record *InRec = static_cast<DefInit*>(InVal->getLeafValue())->getDef();
- if (!checkOperandClass(Op, InRec))
- I->error("Operand $" + OpName + "'s register class disagrees"
- " between the operand and pattern");
+ // Loop over the inputs next. Make a copy of InstInputs so we can destroy
+ // the copy while we're checking the inputs.
+ std::map<std::string, TreePatternNode*> InstInputsCheck(InstInputs);
+
+ std::vector<TreePatternNode*> ResultNodeOperands;
+ std::vector<Record*> Operands;
+ for (unsigned i = NumResults, e = CGI.Operands.size(); i != e; ++i) {
+ CGIOperandList::OperandInfo &Op = CGI.Operands[i];
+ const std::string &OpName = Op.Name;
+ if (OpName.empty())
+ I->error("Operand #" + utostr(i) + " in operands list has no name!");
+
+ if (!InstInputsCheck.count(OpName)) {
+ // If this is an operand with a DefaultOps set filled in, we can ignore
+ // this. When we codegen it, we will do so as always executed.
+ if (Op.Rec->isSubClassOf("OperandWithDefaultOps")) {
+ // Does it have a non-empty DefaultOps field? If so, ignore this
+ // operand.
+ if (!getDefaultOperand(Op.Rec).DefaultOps.empty())
+ continue;
}
- Operands.push_back(Op.Rec);
+ I->error("Operand $" + OpName +
+ " does not appear in the instruction pattern");
+ }
+ TreePatternNode *InVal = InstInputsCheck[OpName];
+ InstInputsCheck.erase(OpName); // It occurred, remove from map.
- // Construct the result for the dest-pattern operand list.
- TreePatternNode *OpNode = InVal->clone();
+ if (InVal->isLeaf() && isa<DefInit>(InVal->getLeafValue())) {
+ Record *InRec = static_cast<DefInit*>(InVal->getLeafValue())->getDef();
+ if (!checkOperandClass(Op, InRec))
+ I->error("Operand $" + OpName + "'s register class disagrees"
+ " between the operand and pattern");
+ }
+ Operands.push_back(Op.Rec);
- // No predicate is useful on the result.
- OpNode->clearPredicateFns();
+ // Construct the result for the dest-pattern operand list.
+ TreePatternNode *OpNode = InVal->clone();
- // Promote the xform function to be an explicit node if set.
- if (Record *Xform = OpNode->getTransformFn()) {
- OpNode->setTransformFn(nullptr);
- std::vector<TreePatternNode*> Children;
- Children.push_back(OpNode);
- OpNode = new TreePatternNode(Xform, Children, OpNode->getNumTypes());
- }
+ // No predicate is useful on the result.
+ OpNode->clearPredicateFns();
- ResultNodeOperands.push_back(OpNode);
+ // Promote the xform function to be an explicit node if set.
+ if (Record *Xform = OpNode->getTransformFn()) {
+ OpNode->setTransformFn(nullptr);
+ std::vector<TreePatternNode*> Children;
+ Children.push_back(OpNode);
+ OpNode = new TreePatternNode(Xform, Children, OpNode->getNumTypes());
}
- if (!InstInputsCheck.empty())
- I->error("Input operand $" + InstInputsCheck.begin()->first +
- " occurs in pattern but not in operands list!");
+ ResultNodeOperands.push_back(OpNode);
+ }
- TreePatternNode *ResultPattern =
- new TreePatternNode(I->getRecord(), ResultNodeOperands,
- GetNumNodeResults(I->getRecord(), *this));
- // Copy fully inferred output node type to instruction result pattern.
- for (unsigned i = 0; i != NumResults; ++i)
- ResultPattern->setType(i, ResNode[i]->getExtType(0));
+ if (!InstInputsCheck.empty())
+ I->error("Input operand $" + InstInputsCheck.begin()->first +
+ " occurs in pattern but not in operands list!");
- // Create and insert the instruction.
- // FIXME: InstImpResults should not be part of DAGInstruction.
- DAGInstruction TheInst(I, Results, Operands, InstImpResults);
- DAGInsts.insert(std::make_pair(I->getRecord(), TheInst));
+ TreePatternNode *ResultPattern =
+ new TreePatternNode(I->getRecord(), ResultNodeOperands,
+ GetNumNodeResults(I->getRecord(), *this));
+ // Copy fully inferred output node types to instruction result pattern.
+ for (unsigned i = 0; i != NumResults; ++i) {
+ assert(ResNodes[i]->getNumTypes() == 1 && "FIXME: Unhandled");
+ ResultPattern->setType(i, ResNodes[i]->getExtType(0));
+ }
- // Use a temporary tree pattern to infer all types and make sure that the
- // constructed result is correct. This depends on the instruction already
- // being inserted into the DAGInsts map.
- TreePattern Temp(I->getRecord(), ResultPattern, false, *this);
- Temp.InferAllTypes(&I->getNamedNodesMap());
+ // Create and insert the instruction.
+ // FIXME: InstImpResults should not be part of DAGInstruction.
+ DAGInstruction TheInst(I, Results, Operands, InstImpResults);
+ DAGInsts.insert(std::make_pair(I->getRecord(), TheInst));
- DAGInstruction &TheInsertedInst = DAGInsts.find(I->getRecord())->second;
- TheInsertedInst.setResultPattern(Temp.getOnlyTree());
+ // Use a temporary tree pattern to infer all types and make sure that the
+ // constructed result is correct. This depends on the instruction already
+ // being inserted into the DAGInsts map.
+ TreePattern Temp(I->getRecord(), ResultPattern, false, *this);
+ Temp.InferAllTypes(&I->getNamedNodesMap());
- return TheInsertedInst;
- }
+ DAGInstruction &TheInsertedInst = DAGInsts.find(I->getRecord())->second;
+ TheInsertedInst.setResultPattern(Temp.getOnlyTree());
+
+ return TheInsertedInst;
+}
/// ParseInstructions - Parse all of the instructions, inlining and resolving
/// any fragments involved. This populates the Instructions list with fully
@@ -3000,18 +3085,13 @@ void CodeGenDAGPatterns::ParseInstructions() {
CodeGenInstruction &InstInfo = Target.getInstruction(Instrs[i]);
if (InstInfo.Operands.size() != 0) {
- if (InstInfo.Operands.NumDefs == 0) {
- // These produce no results
- for (unsigned j = 0, e = InstInfo.Operands.size(); j < e; ++j)
- Operands.push_back(InstInfo.Operands[j].Rec);
- } else {
- // Assume the first operand is the result.
- Results.push_back(InstInfo.Operands[0].Rec);
-
- // The rest are inputs.
- for (unsigned j = 1, e = InstInfo.Operands.size(); j < e; ++j)
- Operands.push_back(InstInfo.Operands[j].Rec);
- }
+ for (unsigned j = 0, e = InstInfo.Operands.NumDefs; j < e; ++j)
+ Results.push_back(InstInfo.Operands[j].Rec);
+
+ // The rest are inputs.
+ for (unsigned j = InstInfo.Operands.NumDefs,
+ e = InstInfo.Operands.size(); j < e; ++j)
+ Operands.push_back(InstInfo.Operands[j].Rec);
}
// Create and insert the instruction.
diff --git a/utils/TableGen/CodeGenDAGPatterns.h b/utils/TableGen/CodeGenDAGPatterns.h
index c0812cf..9ce3cdf 100644
--- a/utils/TableGen/CodeGenDAGPatterns.h
+++ b/utils/TableGen/CodeGenDAGPatterns.h
@@ -136,10 +136,18 @@ namespace EEVT {
/// whose element is VT.
bool EnforceVectorEltTypeIs(EEVT::TypeSet &VT, TreePattern &TP);
+ /// EnforceVectorEltTypeIs - 'this' is now constrainted to be a vector type
+ /// whose element is VT.
+ bool EnforceVectorEltTypeIs(MVT::SimpleValueType VT, TreePattern &TP);
+
/// EnforceVectorSubVectorTypeIs - 'this' is now constrainted to
/// be a vector type VT.
bool EnforceVectorSubVectorTypeIs(EEVT::TypeSet &VT, TreePattern &TP);
+ /// EnforceVectorSameNumElts - 'this' is now constrainted to
+ /// be a vector with same num elements as VT.
+ bool EnforceVectorSameNumElts(EEVT::TypeSet &VT, TreePattern &TP);
+
bool operator!=(const TypeSet &RHS) const { return TypeVec != RHS.TypeVec; }
bool operator==(const TypeSet &RHS) const { return TypeVec == RHS.TypeVec; }
@@ -165,7 +173,7 @@ struct SDTypeConstraint {
enum {
SDTCisVT, SDTCisPtrTy, SDTCisInt, SDTCisFP, SDTCisVec, SDTCisSameAs,
SDTCisVTSmallerThanOp, SDTCisOpSmallerThanOp, SDTCisEltOfVec,
- SDTCisSubVecOfVec
+ SDTCisSubVecOfVec, SDTCVecEltisVT, SDTCisSameNumEltsAs
} ConstraintType;
union { // The discriminated union.
@@ -187,6 +195,12 @@ struct SDTypeConstraint {
struct {
unsigned OtherOperandNum;
} SDTCisSubVecOfVec_Info;
+ struct {
+ MVT::SimpleValueType VT;
+ } SDTCVecEltisVT_Info;
+ struct {
+ unsigned OtherOperandNum;
+ } SDTCisSameNumEltsAs_Info;
} x;
/// ApplyTypeConstraint - Given a node in a pattern, apply this type
diff --git a/utils/TableGen/CodeGenInstruction.cpp b/utils/TableGen/CodeGenInstruction.cpp
index b1e4318..1060296 100644
--- a/utils/TableGen/CodeGenInstruction.cpp
+++ b/utils/TableGen/CodeGenInstruction.cpp
@@ -320,7 +320,6 @@ CodeGenInstruction::CodeGenInstruction(Record *R)
isRegSequence = R->getValueAsBit("isRegSequence");
isExtractSubreg = R->getValueAsBit("isExtractSubreg");
isInsertSubreg = R->getValueAsBit("isInsertSubreg");
- hasTwoExplicitDefs = R->getValueAsBit("hasTwoExplicitDefs");
bool Unset;
mayLoad = R->getValueAsBitOrUnset("mayLoad", Unset);
diff --git a/utils/TableGen/CodeGenInstruction.h b/utils/TableGen/CodeGenInstruction.h
index 82b23f4..bdbe546 100644
--- a/utils/TableGen/CodeGenInstruction.h
+++ b/utils/TableGen/CodeGenInstruction.h
@@ -255,7 +255,6 @@ namespace llvm {
bool isRegSequence : 1;
bool isExtractSubreg : 1;
bool isInsertSubreg : 1;
- bool hasTwoExplicitDefs : 1;
std::string DeprecatedReason;
bool HasComplexDeprecationPredicate;
diff --git a/utils/TableGen/CodeGenRegisters.cpp b/utils/TableGen/CodeGenRegisters.cpp
index 37f8905..68c2716 100644
--- a/utils/TableGen/CodeGenRegisters.cpp
+++ b/utils/TableGen/CodeGenRegisters.cpp
@@ -108,6 +108,7 @@ CodeGenRegister::CodeGenRegister(Record *R, unsigned Enum)
EnumValue(Enum),
CostPerUse(R->getValueAsInt("CostPerUse")),
CoveredBySubRegs(R->getValueAsBit("CoveredBySubRegs")),
+ HasDisjunctSubRegs(false),
SubRegsComplete(false),
SuperRegsComplete(false),
TopoSig(~0u)
@@ -217,6 +218,8 @@ CodeGenRegister::computeSubRegs(CodeGenRegBank &RegBank) {
return SubRegs;
SubRegsComplete = true;
+ HasDisjunctSubRegs = ExplicitSubRegs.size() > 1;
+
// First insert the explicit subregs and make sure they are fully indexed.
for (unsigned i = 0, e = ExplicitSubRegs.size(); i != e; ++i) {
CodeGenRegister *SR = ExplicitSubRegs[i];
@@ -237,6 +240,7 @@ CodeGenRegister::computeSubRegs(CodeGenRegBank &RegBank) {
for (unsigned i = 0, e = ExplicitSubRegs.size(); i != e; ++i) {
CodeGenRegister *SR = ExplicitSubRegs[i];
const SubRegMap &Map = SR->computeSubRegs(RegBank);
+ HasDisjunctSubRegs |= SR->HasDisjunctSubRegs;
for (SubRegMap::const_iterator SI = Map.begin(), SE = Map.end(); SI != SE;
++SI) {
@@ -1260,7 +1264,7 @@ void CodeGenRegBank::computeSubRegLaneMasks() {
for (auto &RegClass : RegClasses) {
unsigned LaneMask = 0;
for (const auto &SubRegIndex : SubRegIndices) {
- if (RegClass.getSubClassWithSubReg(&SubRegIndex) != &RegClass)
+ if (RegClass.getSubClassWithSubReg(&SubRegIndex) == nullptr)
continue;
LaneMask |= SubRegIndex.LaneMask;
}
@@ -1781,6 +1785,7 @@ void CodeGenRegBank::computeRegUnitLaneMasks() {
}
++u;
}
+ (void)Found;
assert(Found);
}
}
@@ -1802,6 +1807,13 @@ void CodeGenRegBank::computeDerivedInfo() {
computeRegUnitLaneMasks();
+ // Compute register class HasDisjunctSubRegs flag.
+ for (CodeGenRegisterClass &RC : RegClasses) {
+ RC.HasDisjunctSubRegs = false;
+ for (const CodeGenRegister *Reg : RC.getMembers())
+ RC.HasDisjunctSubRegs |= Reg->HasDisjunctSubRegs;
+ }
+
// Get the weight of each set.
for (unsigned Idx = 0, EndIdx = RegUnitSets.size(); Idx != EndIdx; ++Idx)
RegUnitSets[Idx].Weight = getRegUnitSetWeight(RegUnitSets[Idx].Units);
diff --git a/utils/TableGen/CodeGenRegisters.h b/utils/TableGen/CodeGenRegisters.h
index 7c723d9..00e2957 100644
--- a/utils/TableGen/CodeGenRegisters.h
+++ b/utils/TableGen/CodeGenRegisters.h
@@ -18,6 +18,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SparseBitVector.h"
#include "llvm/CodeGen/MachineValueType.h"
@@ -41,10 +42,10 @@ namespace llvm {
struct MaskRolPair {
unsigned Mask;
uint8_t RotateLeft;
- bool operator==(const MaskRolPair Other) {
+ bool operator==(const MaskRolPair Other) const {
return Mask == Other.Mask && RotateLeft == Other.RotateLeft;
}
- bool operator!=(const MaskRolPair Other) {
+ bool operator!=(const MaskRolPair Other) const {
return Mask != Other.Mask || RotateLeft != Other.RotateLeft;
}
};
@@ -128,6 +129,7 @@ namespace llvm {
unsigned EnumValue;
unsigned CostPerUse;
bool CoveredBySubRegs;
+ bool HasDisjunctSubRegs;
// Map SubRegIndex -> Register.
typedef std::map<CodeGenSubRegIndex *, CodeGenRegister *, deref<llvm::less>>
@@ -306,6 +308,8 @@ namespace llvm {
std::string AltOrderSelect;
/// Contains the combination of the lane masks of all subregisters.
unsigned LaneMask;
+ /// True if there are at least 2 subregisters which do not interfere.
+ bool HasDisjunctSubRegs;
// Return the Record that defined this class, or NULL if the class was
// created by TableGen.
diff --git a/utils/TableGen/DAGISelMatcherEmitter.cpp b/utils/TableGen/DAGISelMatcherEmitter.cpp
index 302f27b..4659dc1 100644
--- a/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ b/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -188,7 +188,7 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
<< " children in Scope";
}
- OS << '\n' << TmpBuf.str();
+ OS << '\n' << TmpBuf;
CurrentIdx += ChildSize;
}
@@ -342,7 +342,7 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
if (!OmitComments)
OS << "// ->" << CurrentIdx+ChildSize;
OS << '\n';
- OS << TmpBuf.str();
+ OS << TmpBuf;
CurrentIdx += ChildSize;
}
diff --git a/utils/TableGen/FixedLenDecoderEmitter.cpp b/utils/TableGen/FixedLenDecoderEmitter.cpp
index 292a2b1..c69b89b 100644
--- a/utils/TableGen/FixedLenDecoderEmitter.cpp
+++ b/utils/TableGen/FixedLenDecoderEmitter.cpp
@@ -1091,7 +1091,7 @@ unsigned FilterChooser::getDecoderIndex(DecoderSet &Decoders,
// overkill for now, though.
// Make sure the predicate is in the table.
- Decoders.insert(Decoder.str());
+ Decoders.insert(StringRef(Decoder));
// Now figure out the index for when we write out the table.
DecoderSet::const_iterator P = std::find(Decoders.begin(),
Decoders.end(),
diff --git a/utils/TableGen/InstrInfoEmitter.cpp b/utils/TableGen/InstrInfoEmitter.cpp
index c5999de..f999326 100644
--- a/utils/TableGen/InstrInfoEmitter.cpp
+++ b/utils/TableGen/InstrInfoEmitter.cpp
@@ -248,7 +248,7 @@ void InstrInfoEmitter::emitOperandNameMappings(raw_ostream &OS,
OS << "#ifdef GET_INSTRINFO_OPERAND_ENUM\n";
OS << "#undef GET_INSTRINFO_OPERAND_ENUM\n";
- OS << "namespace llvm {";
+ OS << "namespace llvm {\n";
OS << "namespace " << Namespace << " {\n";
OS << "namespace " << OpNameNS << " { \n";
OS << "enum {\n";
@@ -264,7 +264,7 @@ void InstrInfoEmitter::emitOperandNameMappings(raw_ostream &OS,
OS << "#ifdef GET_INSTRINFO_NAMED_OPS\n";
OS << "#undef GET_INSTRINFO_NAMED_OPS\n";
- OS << "namespace llvm {";
+ OS << "namespace llvm {\n";
OS << "namespace " << Namespace << " {\n";
OS << "LLVM_READONLY\n";
OS << "int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx) {\n";
@@ -315,7 +315,7 @@ void InstrInfoEmitter::emitOperandTypesEnum(raw_ostream &OS,
OS << "\n#ifdef GET_INSTRINFO_OPERAND_TYPES_ENUM\n";
OS << "#undef GET_INSTRINFO_OPERAND_TYPES_ENUM\n";
- OS << "namespace llvm {";
+ OS << "namespace llvm {\n";
OS << "namespace " << Namespace << " {\n";
OS << "namespace OpTypes { \n";
OS << "enum OperandType {\n";
@@ -430,7 +430,8 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
std::string ClassName = TargetName + "GenInstrInfo";
OS << "namespace llvm {\n";
OS << "struct " << ClassName << " : public TargetInstrInfo {\n"
- << " explicit " << ClassName << "(int SO = -1, int DO = -1);\n"
+ << " explicit " << ClassName
+ << "(int CFSetupOpcode = -1, int CFDestroyOpcode = -1);\n"
<< " virtual ~" << ClassName << "();\n"
<< "};\n";
OS << "} // End llvm namespace \n";
@@ -444,10 +445,11 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
OS << "extern const MCInstrDesc " << TargetName << "Insts[];\n";
OS << "extern const unsigned " << TargetName << "InstrNameIndices[];\n";
OS << "extern const char " << TargetName << "InstrNameData[];\n";
- OS << ClassName << "::" << ClassName << "(int SO, int DO)\n"
- << " : TargetInstrInfo(SO, DO) {\n"
- << " InitMCInstrInfo(" << TargetName << "Insts, "
- << TargetName << "InstrNameIndices, " << TargetName << "InstrNameData, "
+ OS << ClassName << "::" << ClassName
+ << "(int CFSetupOpcode, int CFDestroyOpcode)\n"
+ << " : TargetInstrInfo(CFSetupOpcode, CFDestroyOpcode) {\n"
+ << " InitMCInstrInfo(" << TargetName << "Insts, " << TargetName
+ << "InstrNameIndices, " << TargetName << "InstrNameData, "
<< NumberedInstructions.size() << ");\n}\n"
<< ClassName << "::~" << ClassName << "() {}\n";
OS << "} // End llvm namespace \n";
diff --git a/utils/TableGen/RegisterInfoEmitter.cpp b/utils/TableGen/RegisterInfoEmitter.cpp
index 5a6694e..17bee6e 100644
--- a/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/utils/TableGen/RegisterInfoEmitter.cpp
@@ -247,7 +247,7 @@ EmitRegUnitPressure(raw_ostream &OS, const CodeGenRegBank &RegBank,
OS << "// Get the register unit pressure limit for this dimension.\n"
<< "// This limit must be adjusted dynamically for reserved registers.\n"
<< "unsigned " << ClassName << "::\n"
- << "getRegPressureSetLimit(unsigned Idx) const {\n"
+ << "getRegPressureSetLimit(const MachineFunction &MF, unsigned Idx) const {\n"
<< " static const " << getMinimalTypeForRange(MaxRegUnitWeight)
<< " PressureLimitTable[] = {\n";
for (unsigned i = 0; i < NumSets; ++i ) {
@@ -610,17 +610,19 @@ static void printMask(raw_ostream &OS, unsigned Val) {
static bool combine(const CodeGenSubRegIndex *Idx,
SmallVectorImpl<CodeGenSubRegIndex*> &Vec) {
const CodeGenSubRegIndex::CompMap &Map = Idx->getComposites();
- for (CodeGenSubRegIndex::CompMap::const_iterator
- I = Map.begin(), E = Map.end(); I != E; ++I) {
- CodeGenSubRegIndex *&Entry = Vec[I->first->EnumValue - 1];
- if (Entry && Entry != I->second)
+ for (const auto &I : Map) {
+ CodeGenSubRegIndex *&Entry = Vec[I.first->EnumValue - 1];
+ if (Entry && Entry != I.second)
return false;
}
// All entries are compatible. Make it so.
- for (CodeGenSubRegIndex::CompMap::const_iterator
- I = Map.begin(), E = Map.end(); I != E; ++I)
- Vec[I->first->EnumValue - 1] = I->second;
+ for (const auto &I : Map) {
+ auto *&Entry = Vec[I.first->EnumValue - 1];
+ assert((!Entry || Entry == I.second) &&
+ "Expected EnumValue to be unique");
+ Entry = I.second;
+ }
return true;
}
@@ -714,16 +716,7 @@ RegisterInfoEmitter::emitComposeSubRegIndexLaneMask(raw_ostream &OS,
for (size_t s = 0, se = Sequences.size(); s != se; ++s, SIdx = NextSIdx) {
SmallVectorImpl<MaskRolPair> &Sequence = Sequences[s];
NextSIdx = SIdx + Sequence.size() + 1;
- if (Sequence.size() != IdxSequence.size())
- continue;
- bool Identical = true;
- for (size_t o = 0, oe = Sequence.size(); o != oe; ++o) {
- if (Sequence[o] != IdxSequence[o]) {
- Identical = false;
- break;
- }
- }
- if (Identical) {
+ if (Sequence == IdxSequence) {
Found = SIdx;
break;
}
@@ -1095,7 +1088,8 @@ RegisterInfoEmitter::runTargetHeader(raw_ostream &OS, CodeGenTarget &Target,
<< " unsigned getRegUnitWeight(unsigned RegUnit) const override;\n"
<< " unsigned getNumRegPressureSets() const override;\n"
<< " const char *getRegPressureSetName(unsigned Idx) const override;\n"
- << " unsigned getRegPressureSetLimit(unsigned Idx) const override;\n"
+ << " unsigned getRegPressureSetLimit(const MachineFunction &MF, unsigned "
+ "Idx) const override;\n"
<< " const int *getRegClassPressureSets("
<< "const TargetRegisterClass *RC) const override;\n"
<< " const int *getRegUnitPressureSets("
@@ -1292,7 +1286,9 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target,
<< "VTLists + " << VTSeqs.get(RC.VTs) << ",\n " << RC.getName()
<< "SubClassMask,\n SuperRegIdxSeqs + "
<< SuperRegIdxSeqs.get(SuperRegIdxLists[RC.EnumValue]) << ",\n "
- << format("0x%08x,\n ", RC.LaneMask);
+ << format("0x%08x,\n ", RC.LaneMask)
+ << (RC.HasDisjunctSubRegs?"true":"false")
+ << ", /* HasDisjunctSubRegs */\n ";
if (RC.getSuperClasses().empty())
OS << "NullRegClasses,\n ";
else
diff --git a/utils/TableGen/SubtargetEmitter.cpp b/utils/TableGen/SubtargetEmitter.cpp
index d8cf0d1..e5c62fa 100644
--- a/utils/TableGen/SubtargetEmitter.cpp
+++ b/utils/TableGen/SubtargetEmitter.cpp
@@ -128,42 +128,29 @@ void SubtargetEmitter::Enumeration(raw_ostream &OS,
OS << "namespace " << Target << " {\n";
- // For bit flag enumerations with more than 32 items, emit constants.
- // Emit an enum for everything else.
- if (isBits && N > 32) {
- // For each record
- for (unsigned i = 0; i < N; i++) {
- // Next record
- Record *Def = DefList[i];
-
- // Get and emit name and expression (1 << i)
- OS << " const uint64_t " << Def->getName() << " = 1ULL << " << i << ";\n";
- }
- } else {
- // Open enumeration
- OS << "enum {\n";
-
- // For each record
- for (unsigned i = 0; i < N;) {
- // Next record
- Record *Def = DefList[i];
+ // Open enumeration. Use a 64-bit underlying type.
+ OS << "enum : uint64_t {\n";
- // Get and emit name
- OS << " " << Def->getName();
+ // For each record
+ for (unsigned i = 0; i < N;) {
+ // Next record
+ Record *Def = DefList[i];
- // If bit flags then emit expression (1 << i)
- if (isBits) OS << " = " << " 1ULL << " << i;
+ // Get and emit name
+ OS << " " << Def->getName();
- // Depending on 'if more in the list' emit comma
- if (++i < N) OS << ",";
+ // If bit flags then emit expression (1 << i)
+ if (isBits) OS << " = " << " 1ULL << " << i;
- OS << "\n";
- }
+ // Depending on 'if more in the list' emit comma
+ if (++i < N) OS << ",";
- // Close enumeration
- OS << "};\n";
+ OS << "\n";
}
+ // Close enumeration
+ OS << "};\n";
+
OS << "}\n";
}
@@ -1487,6 +1474,7 @@ void SubtargetEmitter::run(raw_ostream &OS) {
OS << "#undef GET_SUBTARGETINFO_TARGET_DESC\n";
OS << "#include \"llvm/Support/Debug.h\"\n";
+ OS << "#include \"llvm/Support/raw_ostream.h\"\n";
ParseFeaturesFunction(OS, NumFeatures, NumProcs);
OS << "#endif // GET_SUBTARGETINFO_TARGET_DESC\n\n";
diff --git a/utils/TableGen/X86DisassemblerTables.cpp b/utils/TableGen/X86DisassemblerTables.cpp
index fbe5502..e7e292d 100644
--- a/utils/TableGen/X86DisassemblerTables.cpp
+++ b/utils/TableGen/X86DisassemblerTables.cpp
@@ -215,11 +215,17 @@ static inline bool inheritsFrom(InstructionContext child,
return inheritsFrom(child, IC_EVEX_W_K) ||
inheritsFrom(child, IC_EVEX_L_W_K);
case IC_EVEX_XS_K:
+ case IC_EVEX_XS_K_B:
+ case IC_EVEX_XS_KZ_B:
return inheritsFrom(child, IC_EVEX_W_XS_K) ||
inheritsFrom(child, IC_EVEX_L_W_XS_K);
case IC_EVEX_XD_K:
+ case IC_EVEX_XD_K_B:
+ case IC_EVEX_XD_KZ_B:
return inheritsFrom(child, IC_EVEX_W_XD_K) ||
inheritsFrom(child, IC_EVEX_L_W_XD_K);
+ case IC_EVEX_XS_B:
+ case IC_EVEX_XD_B:
case IC_EVEX_K_B:
case IC_EVEX_KZ:
return false;
@@ -253,6 +259,12 @@ static inline bool inheritsFrom(InstructionContext child,
case IC_EVEX_W_KZ:
case IC_EVEX_W_XS_KZ:
case IC_EVEX_W_XD_KZ:
+ case IC_EVEX_W_XS_B:
+ case IC_EVEX_W_XD_B:
+ case IC_EVEX_W_XS_K_B:
+ case IC_EVEX_W_XD_K_B:
+ case IC_EVEX_W_XS_KZ_B:
+ case IC_EVEX_W_XD_KZ_B:
case IC_EVEX_W_OPSIZE_KZ:
case IC_EVEX_W_OPSIZE_KZ_B:
return false;
diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py
index 268e46c..f1734ec 100644
--- a/utils/lit/lit/TestRunner.py
+++ b/utils/lit/lit/TestRunner.py
@@ -22,33 +22,56 @@ kUseCloseFDs = not kIsWindows
# Use temporary files to replace /dev/null on Windows.
kAvoidDevNull = kIsWindows
-def executeShCmd(cmd, cfg, cwd, results):
+class ShellEnvironment(object):
+
+ """Mutable shell environment containing things like CWD and env vars.
+
+ Environment variables are not implemented, but cwd tracking is.
+ """
+
+ def __init__(self, cwd, env):
+ self.cwd = cwd
+ self.env = env
+
+def executeShCmd(cmd, shenv, results):
if isinstance(cmd, ShUtil.Seq):
if cmd.op == ';':
- res = executeShCmd(cmd.lhs, cfg, cwd, results)
- return executeShCmd(cmd.rhs, cfg, cwd, results)
+ res = executeShCmd(cmd.lhs, shenv, results)
+ return executeShCmd(cmd.rhs, shenv, results)
if cmd.op == '&':
raise InternalShellError(cmd,"unsupported shell operator: '&'")
if cmd.op == '||':
- res = executeShCmd(cmd.lhs, cfg, cwd, results)
+ res = executeShCmd(cmd.lhs, shenv, results)
if res != 0:
- res = executeShCmd(cmd.rhs, cfg, cwd, results)
+ res = executeShCmd(cmd.rhs, shenv, results)
return res
if cmd.op == '&&':
- res = executeShCmd(cmd.lhs, cfg, cwd, results)
+ res = executeShCmd(cmd.lhs, shenv, results)
if res is None:
return res
if res == 0:
- res = executeShCmd(cmd.rhs, cfg, cwd, results)
+ res = executeShCmd(cmd.rhs, shenv, results)
return res
raise ValueError('Unknown shell command: %r' % cmd.op)
-
assert isinstance(cmd, ShUtil.Pipeline)
+
+ # Handle shell builtins first.
+ if cmd.commands[0].args[0] == 'cd':
+ # Update the cwd in the environment.
+ if len(cmd.commands[0].args) != 2:
+ raise ValueError('cd supports only one argument')
+ newdir = cmd.commands[0].args[1]
+ if os.path.isabs(newdir):
+ shenv.cwd = newdir
+ else:
+ shenv.cwd = os.path.join(shenv.cwd, newdir)
+ return 0
+
procs = []
input = subprocess.PIPE
stderrTempFiles = []
@@ -102,7 +125,9 @@ def executeShCmd(cmd, cfg, cwd, results):
if kAvoidDevNull and r[0] == '/dev/null':
r[2] = tempfile.TemporaryFile(mode=r[1])
else:
- r[2] = open(r[0], r[1])
+ # Make sure relative paths are relative to the cwd.
+ redir_filename = os.path.join(shenv.cwd, r[0])
+ r[2] = open(redir_filename, r[1])
# Workaround a Win32 and/or subprocess bug when appending.
#
# FIXME: Actually, this is probably an instance of PR6753.
@@ -132,7 +157,7 @@ def executeShCmd(cmd, cfg, cwd, results):
# Resolve the executable path ourselves.
args = list(j.args)
- executable = lit.util.which(args[0], cfg.environment['PATH'])
+ executable = lit.util.which(args[0], shenv.env['PATH'])
if not executable:
raise InternalShellError(j, '%r: command not found' % j.args[0])
@@ -146,12 +171,12 @@ def executeShCmd(cmd, cfg, cwd, results):
args[i] = f.name
try:
- procs.append(subprocess.Popen(args, cwd=cwd,
+ procs.append(subprocess.Popen(args, cwd=shenv.cwd,
executable = executable,
stdin = stdin,
stdout = stdout,
stderr = stderr,
- env = cfg.environment,
+ env = shenv.env,
close_fds = kUseCloseFDs))
except OSError as e:
raise InternalShellError(j, 'Could not create process due to {}'.format(e))
@@ -257,7 +282,8 @@ def executeScriptInternal(test, litConfig, tmpBase, commands, cwd):
results = []
try:
- exitCode = executeShCmd(cmd, test.config, cwd, results)
+ shenv = ShellEnvironment(cwd, test.config.environment)
+ exitCode = executeShCmd(cmd, shenv, results)
except InternalShellError:
e = sys.exc_info()[1]
exitCode = 127
diff --git a/utils/release/export.sh b/utils/release/export.sh
index 38e5a81..4da5fe4 100755
--- a/utils/release/export.sh
+++ b/utils/release/export.sh
@@ -79,5 +79,8 @@ if [ "x$release" = "x" ]; then
exit 1
fi
+# Make sure umask is not overly restrictive.
+umask 0022
+
export_sources
exit 0
diff --git a/utils/unittest/googletest/include/gtest/gtest.h b/utils/unittest/googletest/include/gtest/gtest.h
index 07ed92b..257cee6 100644
--- a/utils/unittest/googletest/include/gtest/gtest.h
+++ b/utils/unittest/googletest/include/gtest/gtest.h
@@ -74,7 +74,7 @@
// define it to 0 to indicate otherwise.
//
// If the user's ::std::string and ::string are the same class due to
-// aliasing, he should define GTEST_HAS_GLOBAL_STRING to 0.
+// aliasing, they should define GTEST_HAS_GLOBAL_STRING to 0.
//
// If the user doesn't define GTEST_HAS_GLOBAL_STRING, it is defined
// heuristically.
diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h b/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h
index 2582675..e32c762 100644
--- a/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h
+++ b/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h
@@ -100,9 +100,6 @@ class ValueArray2 {
}
private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray2& other);
-
const T1 v1_;
const T2 v2_;
};
diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-port.h b/utils/unittest/googletest/include/gtest/internal/gtest-port.h
index f5bfd4e..9ddcea1 100644
--- a/utils/unittest/googletest/include/gtest/internal/gtest-port.h
+++ b/utils/unittest/googletest/include/gtest/internal/gtest-port.h
@@ -503,7 +503,7 @@
# define _TR1_FUNCTIONAL 1
# include <tr1/tuple>
# undef _TR1_FUNCTIONAL // Allows the user to #include
- // <tr1/functional> if he chooses to.
+ // <tr1/functional> if they choose to.
# else
# include <tr1/tuple> // NOLINT
# endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302