aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-19 06:53:02 +0000
committerChris Lattner <sabre@nondot.org>2005-01-19 06:53:02 +0000
commitd7e2fe40e42dffa04a770191c3414446d5e8c30a (patch)
treefe72e7bfed9128e270b35006693b6945a6e40f9f
parent7c79de7c65cc28beff8f4535a32b7e704fbdd298 (diff)
Add a new method, described in the comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19683 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/TargetInstrInfo.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h
index 855ce86ed0..d5237f2f7c 100644
--- a/include/llvm/Target/TargetInstrInfo.h
+++ b/include/llvm/Target/TargetInstrInfo.h
@@ -177,6 +177,18 @@ public:
return 0;
}
+ /// commuteInstruction - If a target has any instructions that are commutable,
+ /// but require converting to a different instruction or making non-trivial
+ /// changes to commute them, this method can overloaded to do this. The
+ /// default implementation of this method simply swaps the first two operands
+ /// of MI and returns it.
+ ///
+ /// If a target wants to make more aggressive changes, they can construct and
+ /// return a new machine instruction. If an instruction cannot commute, it
+ /// can also return null.
+ ///
+ virtual MachineInstr *commuteInstruction(MachineInstr *MI) const;
+
/// Insert a goto (unconditional branch) sequence to TMBB, at the
/// end of MBB
virtual void insertGoto(MachineBasicBlock& MBB,