|
LLVM
4.0.0
|
#include "MCTargetDesc/AArch64AddressingModes.h"#include "AArch64InstrInfo.h"#include "AArch64Subtarget.h"#include "llvm/CodeGen/LivePhysRegs.h"#include "llvm/CodeGen/MachineFunctionPass.h"#include "llvm/CodeGen/MachineInstrBuilder.h"#include "llvm/Support/MathExtras.h"Go to the source code of this file.
Macros | |
| #define | AARCH64_EXPAND_PSEUDO_NAME "AArch64 pseudo instruction expansion pass" |
Functions | |
| INITIALIZE_PASS (AArch64ExpandPseudo,"aarch64-expand-pseudo", AARCH64_EXPAND_PSEUDO_NAME, false, false) static void transferImpOps(MachineInstr &OldMI | |
| Transfer implicit operands on the pseudo instruction to the instructions created from the expansion. More... | |
| for (unsigned i=Desc.getNumOperands(), e=OldMI.getNumOperands();i!=e;++i) | |
| static uint64_t | getChunk (uint64_t Imm, unsigned ChunkIdx) |
| Helper function which extracts the specified 16-bit chunk from a 64-bit value. More... | |
| static uint64_t | replicateChunk (uint64_t Imm, unsigned FromIdx, unsigned ToIdx) |
| Helper function which replicates a 16-bit chunk within a 64-bit value. More... | |
| static bool | tryOrrMovk (uint64_t UImm, uint64_t OrrImm, MachineInstr &MI, MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const AArch64InstrInfo *TII, unsigned ChunkIdx) |
| Helper function which tries to materialize a 64-bit value with an ORR + MOVK instruction sequence. More... | |
| static bool | canUseOrr (uint64_t Chunk, uint64_t &Encoding) |
| Check whether the given 16-bit chunk replicated to full 64-bit width can be materialized with an ORR instruction. More... | |
| static bool | tryToreplicateChunks (uint64_t UImm, MachineInstr &MI, MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const AArch64InstrInfo *TII) |
| Check for identical 16-bit chunks within the constant and if so materialize them with a single ORR instruction. More... | |
| static bool | isStartChunk (uint64_t Chunk) |
| Check whether this chunk matches the pattern '1...0...'. More... | |
| static bool | isEndChunk (uint64_t Chunk) |
| Check whether this chunk matches the pattern '0...1...' This pattern ends a contiguous sequence of ones if we look at the bits from the LSB towards the MSB. More... | |
| static uint64_t | updateImm (uint64_t Imm, unsigned Idx, bool Clear) |
| Clear or set all bits in the chunk at the given index. More... | |
| static bool | trySequenceOfOnes (uint64_t UImm, MachineInstr &MI, MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const AArch64InstrInfo *TII) |
| Check whether the constant contains a sequence of contiguous ones, which might be interrupted by one or two chunks. More... | |
| static void | addPostLoopLiveIns (MachineBasicBlock *MBB, LivePhysRegs &LiveRegs) |
Variables | |
| MachineInstrBuilder & | UseMI |
| MachineInstrBuilder MachineInstrBuilder &DefMI const MCInstrDesc & | Desc = OldMI.getDesc() |
| #define AARCH64_EXPAND_PSEUDO_NAME "AArch64 pseudo instruction expansion pass" |
Definition at line 26 of file AArch64ExpandPseudoInsts.cpp.
|
static |
Definition at line 586 of file AArch64ExpandPseudoInsts.cpp.
References llvm::MachineBasicBlock::addLiveIn(), llvm::LivePhysRegs::begin(), llvm::LivePhysRegs::end(), and I.
|
static |
Check whether the given 16-bit chunk replicated to full 64-bit width can be materialized with an ORR instruction.
Definition at line 140 of file AArch64ExpandPseudoInsts.cpp.
References llvm::AArch64_AM::processLogicalImmediate().
Referenced by tryToreplicateChunks().
Definition at line 68 of file AArch64ExpandPseudoInsts.cpp.
References assert(), llvm::MachineOperand::getReg(), i, llvm::MachineOperand::isReg(), and llvm::MachineOperand::isUse().
|
static |
Helper function which extracts the specified 16-bit chunk from a 64-bit value.
Definition at line 81 of file AArch64ExpandPseudoInsts.cpp.
References assert().
Referenced by replicateChunk(), tryOrrMovk(), trySequenceOfOnes(), and tryToreplicateChunks().
| INITIALIZE_PASS | ( | AArch64ExpandPseudo | , |
| "aarch64-expand-pseudo" | , | ||
| AARCH64_EXPAND_PSEUDO_NAME | , | ||
| false | , | ||
| false | |||
| ) |
Transfer implicit operands on the pseudo instruction to the instructions created from the expansion.
|
static |
Check whether this chunk matches the pattern '0...1...' This pattern ends a contiguous sequence of ones if we look at the bits from the LSB towards the MSB.
Definition at line 253 of file AArch64ExpandPseudoInsts.cpp.
References llvm::isMask_64().
Referenced by trySequenceOfOnes().
|
static |
Check whether this chunk matches the pattern '1...0...'.
This pattern starts a contiguous sequence of ones if we look at the bits from the LSB towards the MSB.
Definition at line 243 of file AArch64ExpandPseudoInsts.cpp.
References llvm::isMask_64().
Referenced by trySequenceOfOnes().
Helper function which replicates a 16-bit chunk within a 64-bit value.
Indices correspond to element numbers in a v4i16.
Definition at line 89 of file AArch64ExpandPseudoInsts.cpp.
References assert(), and getChunk().
|
static |
Helper function which tries to materialize a 64-bit value with an ORR + MOVK instruction sequence.
Definition at line 103 of file AArch64ExpandPseudoInsts.cpp.
References llvm::MachineInstrBuilder::addImm(), addOperand(), assert(), llvm::BuildMI(), llvm::RegState::Define, llvm::MachineInstr::eraseFromParent(), getChunk(), llvm::getDeadRegState(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::AArch64_AM::getShifterImm(), llvm::X86II::Imm16, llvm::MachineOperand::isDead(), llvm::AArch64_AM::LSL, and llvm::AArch64_AM::processLogicalImmediate().
|
static |
Check whether the constant contains a sequence of contiguous ones, which might be interrupted by one or two chunks.
If so, materialize the sequence of contiguous ones with an ORR instruction. Materialize the chunks which are either interrupting the sequence or outside of the sequence with a MOVK instruction.
Assuming S is a chunk which starts the sequence (1...0...), E is a chunk which ends the sequence (0...1...). Then we are looking for constants which contain at least one S and E chunk. E.g. |E|A|B|S|, |A|E|B|S| or |A|B|E|S|.
We are also looking for constants like |S|A|B|E| where the contiguous sequence of ones wraps around the MSB into the LSB.
Definition at line 288 of file AArch64ExpandPseudoInsts.cpp.
References llvm::MachineInstrBuilder::addImm(), addOperand(), assert(), llvm::BuildMI(), llvm::RegState::Define, llvm::MachineInstr::eraseFromParent(), getChunk(), llvm::getDeadRegState(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::AArch64_AM::getShifterImm(), llvm::MachineOperand::isDead(), isEndChunk(), isStartChunk(), llvm::AArch64_AM::LSL, llvm::BitmaskEnumDetail::Mask(), llvm::AArch64_AM::processLogicalImmediate(), std::swap(), and updateImm().
|
static |
Check for identical 16-bit chunks within the constant and if so materialize them with a single ORR instruction.
The remaining one or two 16-bit chunks will be materialized with MOVK instructions.
This allows us to materialize constants like |A|B|A|A| or |A|B|C|A| (order of the chunks doesn't matter), assuming |A|A|A|A| can be materialized with an ORR instruction.
Definition at line 154 of file AArch64ExpandPseudoInsts.cpp.
References llvm::MachineInstrBuilder::addImm(), addOperand(), llvm::BuildMI(), canUseOrr(), llvm::RegState::Define, llvm::WebAssembly::End, llvm::MachineInstr::eraseFromParent(), getChunk(), llvm::getDeadRegState(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::AArch64_AM::getShifterImm(), llvm::X86II::Imm16, llvm::MachineOperand::isDead(), and llvm::AArch64_AM::LSL.
Clear or set all bits in the chunk at the given index.
Definition at line 261 of file AArch64ExpandPseudoInsts.cpp.
References llvm::BitmaskEnumDetail::Mask().
Referenced by trySequenceOfOnes().
| MachineInstrBuilder MachineInstrBuilder& DefMI const MCInstrDesc& Desc = OldMI.getDesc() |
Definition at line 67 of file AArch64ExpandPseudoInsts.cpp.
Referenced by llvm::HexagonMCInstrInfo::deriveExtender(), llvm::DWARFDebugArangeSet::dump(), llvm::X86InstrInfo::findCommutedOpIndices(), GetCostForDef(), getDescription(), llvm::ARMBaseRegisterInfo::getFrameIndexInstrOffset(), llvm::AArch64InstrInfo::getInstSizeInBytes(), llvm::MSP430InstrInfo::getInstSizeInBytes(), llvm::AVRInstrInfo::getInstSizeInBytes(), llvm::PPCInstrInfo::getInstSizeInBytes(), getItineraryLatency(), getLatency(), llvm::X86InstrInfo::getMemOpBaseRegImmOfs(), llvm::ARMBaseInstrInfo::getNumMicroOps(), getNumMicroOpsSwiftLdSt(), llvm::SIInstrInfo::getOpRegClass(), llvm::MCRegisterInfo::InitMCRegisterInfo(), llvm::ARMBaseRegisterInfo::isFrameOffsetLegal(), llvm::MCRegisterInfo::operator[](), llvm::X86ATTInstPrinter::printInst(), llvm::X86IntelInstPrinter::printInst(), llvm::WebAssemblyInstPrinter::printInst(), llvm::WebAssemblyInstPrinter::printOperand(), llvm::rewriteARMFrameIndex(), llvm::ThumbRegisterInfo::rewriteFrameIndex(), llvm::rewriteT2FrameIndex(), stripExtraCopyOperands(), and llvm::SIInstrInfo::verifyInstruction().
| MachineInstrBuilder& UseMI |
Definition at line 65 of file AArch64ExpandPseudoInsts.cpp.
Referenced by findOnlyInterestingUse(), llvm::ARMBaseInstrInfo::FoldImmediate(), llvm::ARMBaseInstrInfo::getOperandLatency(), llvm::isDefLiveOut(), llvm::MachineRegisterInfo::markUsesInDebugValueAsUndef(), llvm::PPCInstrInfo::optimizeCompareInstr(), llvm::SIInstrInfo::readlaneVGPRToSGPR(), llvm::MachineSSAUpdater::RewriteUse(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::ThumbRegisterInfo::saveScavengerRegister(), llvm::RegScavenger::scavengeRegister(), llvm::LiveIntervals::shrinkToUses(), llvm::TailDuplicator::tailDuplicateAndUpdate(), and updatePhysDepsDownwards().
1.8.6