@@ -64,6 +64,14 @@ template <class T> class SmallVectorImpl;
64
64
65
65
using ParamLoadedValue = std::pair<MachineOperand, DIExpression*>;
66
66
67
+ struct DestSourcePair {
68
+ const MachineOperand *Destination;
69
+ const MachineOperand *Source;
70
+
71
+ DestSourcePair (const MachineOperand &Dest, const MachineOperand &Src)
72
+ : Destination(&Dest), Source(&Src) {}
73
+ };
74
+
67
75
// ---------------------------------------------------------------------------
68
76
// /
69
77
// / TargetInstrInfo - Interface to description of machine instruction set
@@ -918,41 +926,36 @@ class TargetInstrInfo : public MCInstrInfo {
918
926
}
919
927
920
928
protected:
921
- // / Target-dependent implemenation for IsCopyInstr.
929
+ // / Target-dependent implementation for IsCopyInstr.
922
930
// / If the specific machine instruction is a instruction that moves/copies
923
- // / value from one register to another register return true along with
924
- // / @Source machine operand and @Destination machine operand.
925
- virtual bool isCopyInstrImpl (const MachineInstr &MI,
926
- const MachineOperand *&Source,
927
- const MachineOperand *&Destination) const {
928
- return false ;
931
+ // / value from one register to another register return destination and source
932
+ // / registers as machine operands.
933
+ virtual Optional<DestSourcePair>
934
+ isCopyInstrImpl (const MachineInstr &MI) const {
935
+ return None;
929
936
}
930
937
931
938
public:
932
939
// / If the specific machine instruction is a instruction that moves/copies
933
- // / value from one register to another register return true along with
934
- // / @Source machine operand and @Destination machine operand .
935
- // / For COPY-instruction the method naturally returns true, for all other
936
- // / instructions the method calls target-dependent implementation.
937
- bool isCopyInstr ( const MachineInstr &MI, const MachineOperand *&Source,
938
- const MachineOperand *&Destination ) const {
940
+ // / value from one register to another register return destination and source
941
+ // / registers as machine operands .
942
+ // / For COPY-instruction the method naturally returns destination and source
943
+ // / registers as machine operands, for all other instructions the method calls
944
+ // / target-dependent implementation.
945
+ Optional<DestSourcePair> isCopyInstr ( const MachineInstr &MI ) const {
939
946
if (MI.isCopy ()) {
940
- Destination = &MI.getOperand (0 );
941
- Source = &MI.getOperand (1 );
942
- return true ;
947
+ return DestSourcePair{MI.getOperand (0 ), MI.getOperand (1 )};
943
948
}
944
- return isCopyInstrImpl (MI, Source, Destination );
949
+ return isCopyInstrImpl (MI);
945
950
}
946
951
947
952
// / If the specific machine instruction is an instruction that adds an
948
- // / immediate value to its \c Source operand and stores it in \c Destination,
949
- // / return true along with \c Destination and \c Source machine operand to
950
- // / which \c Offset has been added.
951
- virtual bool isAddImmediate (const MachineInstr &MI,
952
- const MachineOperand *&Destination,
953
- const MachineOperand *&Source,
954
- int64_t &Offset) const {
955
- return false ;
953
+ // / immediate value to its source operand and stores it in destination,
954
+ // / return destination and source registers as machine operands along with
955
+ // / \c Offset which has been added.
956
+ virtual Optional<DestSourcePair> isAddImmediate (const MachineInstr &MI,
957
+ int64_t &Offset) const {
958
+ return None;
956
959
}
957
960
958
961
// / Store the specified register of the given register class to the specified
0 commit comments