mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-30 20:18:22 +00:00
Add a quick pass to optimize sign / zero extension instructions. For targets where the pre-extension values are available in the subreg of the result of the extension, replace the uses of the pre-extension value with the result + extract_subreg.
For now, this pass is fairly conservative. It only perform the replacement when both the pre- and post- extension values are used in the block. It will miss cases where the post-extension values are live, but not used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93278 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -170,6 +170,10 @@ namespace llvm {
|
||||
/// instructions.
|
||||
FunctionPass *createMachineSinkingPass();
|
||||
|
||||
/// createOptimizeExtsPass - This pass performs sign / zero extension
|
||||
/// optimization by increasing uses of extended values.
|
||||
FunctionPass *createOptimizeExtsPass();
|
||||
|
||||
/// createStackSlotColoringPass - This pass performs stack slot coloring.
|
||||
FunctionPass *createStackSlotColoringPass(bool);
|
||||
|
||||
|
||||
@@ -149,16 +149,15 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
/// isCoalescableInstr - Return true if the instruction is "coalescable". That
|
||||
/// is, it's like a copy where it's legal for the source to overlap the
|
||||
/// destination. e.g. X86::MOVSX64rr32.
|
||||
virtual bool isCoalescableInstr(const MachineInstr &MI, bool &isCopy,
|
||||
unsigned &SrcReg, unsigned &DstReg,
|
||||
unsigned &SrcSubIdx, unsigned &DstSubIdx) const {
|
||||
if (isMoveInstr(MI, SrcReg, DstReg, SrcSubIdx, DstSubIdx)) {
|
||||
isCopy = true;
|
||||
return true;
|
||||
}
|
||||
/// isCoalescableExtInstr - Return true if the instruction is a "coalescable"
|
||||
/// extension instruction. That is, it's like a copy where it's legal for the
|
||||
/// source to overlap the destination. e.g. X86::MOVSX64rr32. If this returns
|
||||
/// true, then it's expected the pre-extension value is available as a subreg
|
||||
/// of the result register. This also returns the sub-register index in
|
||||
/// SubIdx.
|
||||
virtual bool isCoalescableExtInstr(const MachineInstr &MI,
|
||||
unsigned &SrcReg, unsigned &DstReg,
|
||||
unsigned &SubIdx) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user