|
LLVM 24.0.0git
|
Form VOPD instructions from adjacent VALU operations on wave32. More...
#include "AMDGPU.h"#include "GCNSubtarget.h"#include "GCNVOPDUtils.h"#include "SIInstrInfo.h"#include "Utils/AMDGPUBaseInfo.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/SmallBitVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/CodeGen/LiveRegUnits.h"#include "llvm/CodeGen/MachineBasicBlock.h"#include "llvm/CodeGen/MachineInstr.h"#include "llvm/CodeGen/MachineOperand.h"#include "llvm/CodeGen/MachinePassManager.h"#include "llvm/CodeGen/MachineRegisterInfo.h"#include "llvm/Support/Debug.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "gcn-create-vopd" |
Functions | |
| STATISTIC (NumVOPDCreated, "Number of VOPD Insts Created.") | |
| STATISTIC (NumLiteralsMaterialized, "Number of immediates moved into a scalar register to allow VOPD3 " "pairing.") | |
| STATISTIC (NumCandidateEdgesWithoutFreeSGPR, "Number of VOPD3 candidate edges skipped because no scalar register " "was free for their immediate.") | |
| static void | addRangeUses (LiveRegUnits &Live, MachineBasicBlock::iterator Begin, MachineInstr &RangeEnd) |
Add everything the instructions in [Begin, RangeEnd] touch to Live, which already holds what is live after RangeEnd. | |
| static Register | takeFreeSGPR (const GCNSubtarget &ST, const MachineRegisterInfo &MRI, const LiveRegUnits &Live, ArrayRef< VOPDLiteralFixup > Fixups) |
Return a scalar register which every fixup can read and which no value in Live occupies, or a null register. | |
Form VOPD instructions from adjacent VALU operations on wave32.
The post-RA scheduler puts likely component pairs next to each other. This pass checks their final physical-register constraints and selects a non-overlapping set.
VOPD3 components cannot encode literal operands. When all non-inline immediates in a pair have the same 32-bit value, the pass can materialize that value in an SGPR which is free over the pair. The move and its register stay pair-local, so fusion adds at most one move and does not extend register pressure across pairs.
The pass considers every adjacent candidate. It first maximizes the number of pairs, then minimizes scalar moves among equal-size matchings. The earlier candidate wins an exact tie.
Definition in file GCNCreateVOPD.cpp.
| #define DEBUG_TYPE "gcn-create-vopd" |
Definition at line 43 of file GCNCreateVOPD.cpp.
|
static |
Add everything the instructions in [Begin, RangeEnd] touch to Live, which already holds what is live after RangeEnd.
Definition at line 72 of file GCNCreateVOPD.cpp.
References llvm::LiveRegUnits::accumulate(), llvm::make_range(), and MI.
| STATISTIC | ( | NumCandidateEdgesWithoutFreeSGPR | , |
| "Number of VOPD3 candidate edges skipped because no scalar register " "was free for their immediate." | ) |
| STATISTIC | ( | NumLiteralsMaterialized | , |
| "Number of immediates moved into a scalar register to allow VOPD3 " "pairing." | ) |
| STATISTIC | ( | NumVOPDCreated | , |
| "Number of VOPD Insts Created." | ) |
|
static |
Return a scalar register which every fixup can read and which no value in Live occupies, or a null register.
Low registers are preferred, because those are most likely in use already, so the function's register count does not grow.
Definition at line 86 of file GCNCreateVOPD.cpp.
References llvm::all_of(), assert(), llvm::LiveRegUnits::available(), Fixup, llvm::MachineRegisterInfo::isReserved(), Reg, Register, and TRI.