Revert the earlier change that removed the M_REMATERIALIZABLE machine

instruction flag, and use the flag along with a virtual member function
hook for targets to override if there are instructions that are only
trivially rematerializable with specific operands (i.e. constant pool
loads).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37728 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2007-06-26 00:48:07 +00:00
parent 9a0930dbd9
commit d45eddd214
15 changed files with 57 additions and 48 deletions

View File

@@ -78,6 +78,10 @@ const unsigned M_VARIABLE_OPS = 1 << 11;
// controls execution. It may be set to 'always'.
const unsigned M_PREDICABLE = 1 << 12;
// M_REMATERIALIZIBLE - Set if this instruction can be trivally re-materialized
// at any time, e.g. constant generation, load from constant pool.
const unsigned M_REMATERIALIZIBLE = 1 << 13;
// M_CLOBBERS_PRED - Set if this instruction may clobbers the condition code
// register and / or registers that are used to predicate instructions.
const unsigned M_CLOBBERS_PRED = 1 << 14;
@@ -268,6 +272,28 @@ public:
return get(Opcode).Flags & M_NOT_DUPLICABLE;
}
/// isTriviallyReMaterializable - Return true if the instruction is trivially
/// rematerializable, meaning it has no side effects and requires no operands
/// that aren't always available.
bool isTriviallyReMaterializable(MachineInstr *MI) const {
return (MI->getInstrDescriptor()->Flags & M_REMATERIALIZIBLE) &&
isReallyTriviallyReMaterializable(MI);
}
protected:
/// isReallyTriviallyReMaterializable - For instructions with opcodes for
/// which the M_REMATERIALIZABLE flag is set, this function tests whether the
/// instruction itself is actually trivially rematerializable, considering
/// its operands. This is used for targets that have instructions that are
/// only trivially rematerializable for specific uses. This predicate must
/// return false if the instruction has any side effects other than
/// producing a value, or if it requres any address registers that are not
/// always available.
virtual bool isReallyTriviallyReMaterializable(MachineInstr *MI) const {
return true;
}
public:
/// getOperandConstraint - Returns the value of the specific constraint if
/// it is set. Returns -1 if it is not set.
int getOperandConstraint(MachineOpCode Opcode, unsigned OpNum,
@@ -301,16 +327,6 @@ public:
return 0;
}
/// isTriviallyReMaterializable - If the specified machine instruction can
/// be trivally re-materialized at any time, e.g. constant generation or
/// loads from constant pools. If not, return false. This predicate must
/// return false if the instruction has any side effects other than
/// producing the value from the load, or if it requres any address
/// registers that are not always available.
virtual bool isTriviallyReMaterializable(MachineInstr *MI) const {
return false;
}
/// convertToThreeAddress - This method must be implemented by targets that
/// set the M_CONVERTIBLE_TO_3_ADDR flag. When this flag is set, the target
/// may be able to convert a two-address instruction into one or moretrue