mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-21 03:37:47 +00:00
Move comments a bit closer to associated code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259411 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4fa3b7eb6e
commit
0158ba6445
@ -1521,7 +1521,7 @@ bool AArch64LoadStoreOpt::tryToMergeLdStInst(
|
|||||||
bool AArch64LoadStoreOpt::optimizeBlock(MachineBasicBlock &MBB,
|
bool AArch64LoadStoreOpt::optimizeBlock(MachineBasicBlock &MBB,
|
||||||
bool enableNarrowLdOpt) {
|
bool enableNarrowLdOpt) {
|
||||||
bool Modified = false;
|
bool Modified = false;
|
||||||
// Three tranformations to do here:
|
// Four tranformations to do here:
|
||||||
// 1) Find loads that directly read from stores and promote them by
|
// 1) Find loads that directly read from stores and promote them by
|
||||||
// replacing with mov instructions. If the store is wider than the load,
|
// replacing with mov instructions. If the store is wider than the load,
|
||||||
// the load will be replaced with a bitfield extract.
|
// the load will be replaced with a bitfield extract.
|
||||||
@ -1531,30 +1531,6 @@ bool AArch64LoadStoreOpt::optimizeBlock(MachineBasicBlock &MBB,
|
|||||||
// ; becomes
|
// ; becomes
|
||||||
// str w1, [x0, #4]
|
// str w1, [x0, #4]
|
||||||
// lsr w2, w1, #16
|
// lsr w2, w1, #16
|
||||||
// 2) Find narrow loads that can be converted into a single wider load
|
|
||||||
// with bitfield extract instructions.
|
|
||||||
// e.g.,
|
|
||||||
// ldrh w0, [x2]
|
|
||||||
// ldrh w1, [x2, #2]
|
|
||||||
// ; becomes
|
|
||||||
// ldr w0, [x2]
|
|
||||||
// ubfx w1, w0, #16, #16
|
|
||||||
// and w0, w0, #ffff
|
|
||||||
// 3) Find loads and stores that can be merged into a single load or store
|
|
||||||
// pair instruction.
|
|
||||||
// e.g.,
|
|
||||||
// ldr x0, [x2]
|
|
||||||
// ldr x1, [x2, #8]
|
|
||||||
// ; becomes
|
|
||||||
// ldp x0, x1, [x2]
|
|
||||||
// 4) Find base register updates that can be merged into the load or store
|
|
||||||
// as a base-reg writeback.
|
|
||||||
// e.g.,
|
|
||||||
// ldr x0, [x2]
|
|
||||||
// add x2, x2, #4
|
|
||||||
// ; becomes
|
|
||||||
// ldr x0, [x2], #4
|
|
||||||
|
|
||||||
for (MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
|
for (MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
|
||||||
MBBI != E;) {
|
MBBI != E;) {
|
||||||
MachineInstr *MI = MBBI;
|
MachineInstr *MI = MBBI;
|
||||||
@ -1582,7 +1558,15 @@ bool AArch64LoadStoreOpt::optimizeBlock(MachineBasicBlock &MBB,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 2) Find narrow loads that can be converted into a single wider load
|
||||||
|
// with bitfield extract instructions.
|
||||||
|
// e.g.,
|
||||||
|
// ldrh w0, [x2]
|
||||||
|
// ldrh w1, [x2, #2]
|
||||||
|
// ; becomes
|
||||||
|
// ldr w0, [x2]
|
||||||
|
// ubfx w1, w0, #16, #16
|
||||||
|
// and w0, w0, #ffff
|
||||||
for (MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
|
for (MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
|
||||||
enableNarrowLdOpt && MBBI != E;) {
|
enableNarrowLdOpt && MBBI != E;) {
|
||||||
MachineInstr *MI = MBBI;
|
MachineInstr *MI = MBBI;
|
||||||
@ -1614,7 +1598,13 @@ bool AArch64LoadStoreOpt::optimizeBlock(MachineBasicBlock &MBB,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 3) Find loads and stores that can be merged into a single load or store
|
||||||
|
// pair instruction.
|
||||||
|
// e.g.,
|
||||||
|
// ldr x0, [x2]
|
||||||
|
// ldr x1, [x2, #8]
|
||||||
|
// ; becomes
|
||||||
|
// ldp x0, x1, [x2]
|
||||||
for (MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
|
for (MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
|
||||||
MBBI != E;) {
|
MBBI != E;) {
|
||||||
MachineInstr *MI = MBBI;
|
MachineInstr *MI = MBBI;
|
||||||
@ -1656,12 +1646,18 @@ bool AArch64LoadStoreOpt::optimizeBlock(MachineBasicBlock &MBB,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 4) Find base register updates that can be merged into the load or store
|
||||||
|
// as a base-reg writeback.
|
||||||
|
// e.g.,
|
||||||
|
// ldr x0, [x2]
|
||||||
|
// add x2, x2, #4
|
||||||
|
// ; becomes
|
||||||
|
// ldr x0, [x2], #4
|
||||||
for (MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
|
for (MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
|
||||||
MBBI != E;) {
|
MBBI != E;) {
|
||||||
MachineInstr *MI = MBBI;
|
MachineInstr *MI = MBBI;
|
||||||
// Do update merging. It's simpler to keep this separate from the above
|
// Do update merging. It's simpler to keep this separate from the above
|
||||||
// switch, though not strictly necessary.
|
// switchs, though not strictly necessary.
|
||||||
unsigned Opc = MI->getOpcode();
|
unsigned Opc = MI->getOpcode();
|
||||||
switch (Opc) {
|
switch (Opc) {
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user