mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-05 00:49:43 +00:00
Tristate mayLoad, mayStore, and hasSideEffects.
Keep track of the set/unset state of these bits along with their true/false values, but treat '?' as '0' for now. llvm-svn: 162461
This commit is contained in:
parent
9dc03bba14
commit
af507bf450
@ -1511,6 +1511,12 @@ public:
|
||||
///
|
||||
bool getValueAsBit(StringRef FieldName) const;
|
||||
|
||||
/// getValueAsBitOrUnset - This method looks up the specified field and
|
||||
/// returns its value as a bit. If the field is unset, sets Unset to true and
|
||||
/// retunrs false.
|
||||
///
|
||||
bool getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const;
|
||||
|
||||
/// getValueAsInt - This method looks up the specified field and returns its
|
||||
/// value as an int64_t, throwing an exception if the field does not exist or
|
||||
/// if the value is not the right type.
|
||||
|
@ -343,8 +343,8 @@ class Instruction {
|
||||
bit isBarrier = 0; // Can control flow fall through this instruction?
|
||||
bit isCall = 0; // Is this instruction a call instruction?
|
||||
bit canFoldAsLoad = 0; // Can this be folded as a simple memory operand?
|
||||
bit mayLoad = 0; // Is it possible for this inst to read memory?
|
||||
bit mayStore = 0; // Is it possible for this inst to write memory?
|
||||
bit mayLoad = ?; // Is it possible for this inst to read memory?
|
||||
bit mayStore = ?; // Is it possible for this inst to write memory?
|
||||
bit isConvertibleToThreeAddress = 0; // Can this 2-addr instruction promote?
|
||||
bit isCommutable = 0; // Is this 3 operand instruction commutable?
|
||||
bit isTerminator = 0; // Is this part of the terminator for a basic block?
|
||||
@ -369,7 +369,7 @@ class Instruction {
|
||||
//
|
||||
// neverHasSideEffects - Set on an instruction with no pattern if it has no
|
||||
// side effects.
|
||||
bit hasSideEffects = 0;
|
||||
bit hasSideEffects = ?;
|
||||
bit neverHasSideEffects = 0;
|
||||
|
||||
// Is this instruction a "real" instruction (with a distinct machine
|
||||
|
@ -1963,6 +1963,23 @@ bool Record::getValueAsBit(StringRef FieldName) const {
|
||||
"' does not have a bit initializer!";
|
||||
}
|
||||
|
||||
bool Record::getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const {
|
||||
const RecordVal *R = getValue(FieldName);
|
||||
if (R == 0 || R->getValue() == 0)
|
||||
throw "Record `" + getName() + "' does not have a field named `" +
|
||||
FieldName.str() + "'!\n";
|
||||
|
||||
if (R->getValue() == UnsetInit::get()) {
|
||||
Unset = true;
|
||||
return false;
|
||||
}
|
||||
Unset = false;
|
||||
if (BitInit *BI = dynamic_cast<BitInit*>(R->getValue()))
|
||||
return BI->getValue();
|
||||
throw "Record `" + getName() + "', field `" + FieldName.str() +
|
||||
"' does not have a bit initializer!";
|
||||
}
|
||||
|
||||
/// getValueAsDag - This method looks up the specified field and returns its
|
||||
/// value as an Dag, throwing an exception if the field does not exist or if
|
||||
/// the value is not the right type.
|
||||
|
@ -301,8 +301,6 @@ CodeGenInstruction::CodeGenInstruction(Record *R) : TheDef(R), Operands(R) {
|
||||
isBarrier = R->getValueAsBit("isBarrier");
|
||||
isCall = R->getValueAsBit("isCall");
|
||||
canFoldAsLoad = R->getValueAsBit("canFoldAsLoad");
|
||||
mayLoad = R->getValueAsBit("mayLoad");
|
||||
mayStore = R->getValueAsBit("mayStore");
|
||||
isPredicable = Operands.isPredicable || R->getValueAsBit("isPredicable");
|
||||
isConvertibleToThreeAddress = R->getValueAsBit("isConvertibleToThreeAddress");
|
||||
isCommutable = R->getValueAsBit("isCommutable");
|
||||
@ -313,8 +311,13 @@ CodeGenInstruction::CodeGenInstruction(Record *R) : TheDef(R), Operands(R) {
|
||||
hasPostISelHook = R->getValueAsBit("hasPostISelHook");
|
||||
hasCtrlDep = R->getValueAsBit("hasCtrlDep");
|
||||
isNotDuplicable = R->getValueAsBit("isNotDuplicable");
|
||||
hasSideEffects = R->getValueAsBit("hasSideEffects");
|
||||
|
||||
mayLoad = R->getValueAsBitOrUnset("mayLoad", mayLoad_Unset);
|
||||
mayStore = R->getValueAsBitOrUnset("mayStore", mayStore_Unset);
|
||||
hasSideEffects = R->getValueAsBitOrUnset("hasSideEffects",
|
||||
hasSideEffects_Unset);
|
||||
neverHasSideEffects = R->getValueAsBit("neverHasSideEffects");
|
||||
|
||||
isAsCheapAsAMove = R->getValueAsBit("isAsCheapAsAMove");
|
||||
hasExtraSrcRegAllocReq = R->getValueAsBit("hasExtraSrcRegAllocReq");
|
||||
hasExtraDefRegAllocReq = R->getValueAsBit("hasExtraDefRegAllocReq");
|
||||
|
@ -226,7 +226,10 @@ namespace llvm {
|
||||
bool isBarrier;
|
||||
bool isCall;
|
||||
bool canFoldAsLoad;
|
||||
bool mayLoad, mayStore;
|
||||
bool mayLoad;
|
||||
bool mayLoad_Unset;
|
||||
bool mayStore;
|
||||
bool mayStore_Unset;
|
||||
bool isPredicable;
|
||||
bool isConvertibleToThreeAddress;
|
||||
bool isCommutable;
|
||||
@ -238,6 +241,7 @@ namespace llvm {
|
||||
bool hasCtrlDep;
|
||||
bool isNotDuplicable;
|
||||
bool hasSideEffects;
|
||||
bool hasSideEffects_Unset;
|
||||
bool neverHasSideEffects;
|
||||
bool isAsCheapAsAMove;
|
||||
bool hasExtraSrcRegAllocReq;
|
||||
|
Loading…
x
Reference in New Issue
Block a user