projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Mark x86's V_SET0 and V_SETALLONES with isSimpleLoad, and teach X86's
[oota-llvm.git]
/
utils
/
TableGen
/
CodeGenInstruction.cpp
diff --git
a/utils/TableGen/CodeGenInstruction.cpp
b/utils/TableGen/CodeGenInstruction.cpp
index 5d42d3489405e322d8b3998a64ac9b47d6e8d5f7..a8f747647dc8caf71b5e1a3296066a0d8a80ab7f 100644
(file)
--- a/
utils/TableGen/CodeGenInstruction.cpp
+++ b/
utils/TableGen/CodeGenInstruction.cpp
@@
-21,7
+21,8
@@
static void ParseConstraint(const std::string &CStr, CodeGenInstruction *I) {
// FIXME: Only supports TIED_TO for now.
std::string::size_type pos = CStr.find_first_of('=');
assert(pos != std::string::npos && "Unrecognized constraint");
// FIXME: Only supports TIED_TO for now.
std::string::size_type pos = CStr.find_first_of('=');
assert(pos != std::string::npos && "Unrecognized constraint");
- std::string Name = CStr.substr(0, pos);
+ std::string::size_type start = CStr.find_first_not_of(" \t");
+ std::string Name = CStr.substr(start, pos);
// TIED_TO: $src1 = $dst
std::string::size_type wpos = Name.find_first_of(" \t");
// TIED_TO: $src1 = $dst
std::string::size_type wpos = Name.find_first_of(" \t");
@@
-76,7
+77,6
@@
static void ParseConstraints(const std::string &CStr, CodeGenInstruction *I) {
CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
: TheDef(R), AsmString(AsmStr) {
CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
: TheDef(R), AsmString(AsmStr) {
- Name = R->getValueAsString("Name");
Namespace = R->getValueAsString("Namespace");
isReturn = R->getValueAsBit("isReturn");
Namespace = R->getValueAsString("Namespace");
isReturn = R->getValueAsBit("isReturn");
@@
-84,9
+84,9
@@
CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
isIndirectBranch = R->getValueAsBit("isIndirectBranch");
isBarrier = R->getValueAsBit("isBarrier");
isCall = R->getValueAsBit("isCall");
isIndirectBranch = R->getValueAsBit("isIndirectBranch");
isBarrier = R->getValueAsBit("isBarrier");
isCall = R->getValueAsBit("isCall");
- is
Load = R->getValueAsBit("is
Load");
-
isStore = R->getValueAsBit("isStore
");
-
isImplicitDef= R->getValueAsBit("isImplicitDef
");
+ is
SimpleLoad = R->getValueAsBit("isSimple
Load");
+
mayLoad = R->getValueAsBit("mayLoad
");
+
mayStore = R->getValueAsBit("mayStore
");
bool isTwoAddress = R->getValueAsBit("isTwoAddress");
isPredicable = R->getValueAsBit("isPredicable");
isConvertibleToThreeAddress = R->getValueAsBit("isConvertibleToThreeAddress");
bool isTwoAddress = R->getValueAsBit("isTwoAddress");
isPredicable = R->getValueAsBit("isPredicable");
isConvertibleToThreeAddress = R->getValueAsBit("isConvertibleToThreeAddress");
@@
-97,14
+97,15
@@
CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
usesCustomDAGSchedInserter = R->getValueAsBit("usesCustomDAGSchedInserter");
hasCtrlDep = R->getValueAsBit("hasCtrlDep");
isNotDuplicable = R->getValueAsBit("isNotDuplicable");
usesCustomDAGSchedInserter = R->getValueAsBit("usesCustomDAGSchedInserter");
hasCtrlDep = R->getValueAsBit("hasCtrlDep");
isNotDuplicable = R->getValueAsBit("isNotDuplicable");
+ hasSideEffects = R->getValueAsBit("hasSideEffects");
mayHaveSideEffects = R->getValueAsBit("mayHaveSideEffects");
neverHasSideEffects = R->getValueAsBit("neverHasSideEffects");
mayHaveSideEffects = R->getValueAsBit("mayHaveSideEffects");
neverHasSideEffects = R->getValueAsBit("neverHasSideEffects");
+ isAsCheapAsAMove = R->getValueAsBit("isAsCheapAsAMove");
hasOptionalDef = false;
hasOptionalDef = false;
-
hasVariableNumberOfOperands
= false;
+
isVariadic
= false;
- if (mayHaveSideEffects && neverHasSideEffects)
- throw R->getName() +
- ": cannot have both 'mayHaveSideEffects' and 'neverHasSideEffects' set!";
+ if (mayHaveSideEffects + neverHasSideEffects + hasSideEffects > 1)
+ throw R->getName() + ": multiple conflicting side-effect flags set!";
DagInit *DI;
try {
DagInit *DI;
try {
@@
-160,12
+161,12
@@
CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
else if (Rec->isSubClassOf("OptionalDefOperand"))
hasOptionalDef = true;
} else if (Rec->getName() == "variable_ops") {
else if (Rec->isSubClassOf("OptionalDefOperand"))
hasOptionalDef = true;
} else if (Rec->getName() == "variable_ops") {
-
hasVariableNumberOfOperands
= true;
+
isVariadic
= true;
continue;
} else if (!Rec->isSubClassOf("RegisterClass") &&
continue;
} else if (!Rec->isSubClassOf("RegisterClass") &&
- Rec->getName() != "ptr_rc")
+ Rec->getName() != "ptr_rc"
&& Rec->getName() != "unknown"
)
throw "Unknown operand class '" + Rec->getName() +
throw "Unknown operand class '" + Rec->getName() +
- "' in
instruction
'" + R->getName() + "' instruction!";
+ "' in '" + R->getName() + "' instruction!";
// Check that the operand has a name and that it's unique.
if (DI->getArgName(i).empty())
// Check that the operand has a name and that it's unique.
if (DI->getArgName(i).empty())
@@
-214,14
+215,6
@@
CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
}
}
}
}
-/// getName - Return the contents of the instruction Name field if set,
-/// otherwise return the name of the def.
-std::string CodeGenInstruction::getName() const {
- if (!Name.empty()) return Name;
- return TheDef->getName();
-}
-
-
/// getOperandNamed - Return the index of the operand with the specified
/// non-empty name. If the instruction does not have an operand with the
/// specified name, throw an exception.
/// getOperandNamed - Return the index of the operand with the specified
/// non-empty name. If the instruction does not have an operand with the
/// specified name, throw an exception.