LLVM 20.0.0git
|
#include "llvm/CodeGen/SwiftErrorValueTracking.h"
Public Member Functions | |
void | setFunction (MachineFunction &MF) |
Initialize data structures for specified new function. | |
const Value * | getFunctionArg () const |
Get the (unique) function argument that was marked swifterror, or nullptr if this function has no swifterror args. | |
Register | getOrCreateVReg (const MachineBasicBlock *, const Value *) |
Get or create the swifterror value virtual register in VRegDefMap for this basic block. | |
void | setCurrentVReg (const MachineBasicBlock *MBB, const Value *, Register) |
Set the swifterror virtual register in the VRegDefMap for this basic block. | |
Register | getOrCreateVRegDefAt (const Instruction *, const MachineBasicBlock *, const Value *) |
Get or create the swifterror value virtual register for a def of a swifterror by an instruction. | |
Register | getOrCreateVRegUseAt (const Instruction *, const MachineBasicBlock *, const Value *) |
Get or create the swifterror value virtual register for a use of a swifterror by an instruction. | |
bool | createEntriesInEntryBlock (DebugLoc DbgLoc) |
Create initial definitions of swifterror values in the entry block of the current function. | |
void | propagateVRegs () |
Propagate assigned swifterror vregs through a function, synthesizing PHI nodes when needed to maintain consistency. | |
void | preassignVRegs (MachineBasicBlock *MBB, BasicBlock::const_iterator Begin, BasicBlock::const_iterator End) |
Definition at line 34 of file SwiftErrorValueTracking.h.
Create initial definitions of swifterror values in the entry block of the current function.
Definition at line 115 of file SwiftErrorValueTracking.cpp.
References llvm::MachineFunction::begin(), llvm::BuildMI(), llvm::MachineRegisterInfo::createVirtualRegister(), DL, llvm::SmallVectorBase< Size_T >::empty(), llvm::MCInstrInfo::get(), llvm::MachineFunction::getDataLayout(), llvm::MachineBasicBlock::getFirstNonPHI(), llvm::TargetLoweringBase::getPointerTy(), llvm::TargetLoweringBase::getRegClassFor(), llvm::MachineFunction::getRegInfo(), MBB, setCurrentVReg(), and llvm::TargetLowering::supportSwiftError().
Referenced by llvm::IRTranslator::runOnMachineFunction().
Get the (unique) function argument that was marked swifterror, or nullptr if this function has no swifterror args.
Definition at line 72 of file SwiftErrorValueTracking.h.
Referenced by llvm::IRTranslator::runOnMachineFunction().
Register SwiftErrorValueTracking::getOrCreateVReg | ( | const MachineBasicBlock * | MBB, |
const Value * | Val | ||
) |
Get or create the swifterror value virtual register in VRegDefMap for this basic block.
Definition at line 26 of file SwiftErrorValueTracking.cpp.
References llvm::MachineRegisterInfo::createVirtualRegister(), DL, llvm::MachineFunction::getDataLayout(), llvm::TargetLoweringBase::getPointerTy(), llvm::TargetLoweringBase::getRegClassFor(), llvm::MachineFunction::getRegInfo(), and MBB.
Referenced by getOrCreateVRegUseAt(), and propagateVRegs().
Register SwiftErrorValueTracking::getOrCreateVRegDefAt | ( | const Instruction * | I, |
const MachineBasicBlock * | MBB, | ||
const Value * | Val | ||
) |
Get or create the swifterror value virtual register for a def of a swifterror by an instruction.
Definition at line 50 of file SwiftErrorValueTracking.cpp.
References llvm::MachineRegisterInfo::createVirtualRegister(), DL, llvm::MachineFunction::getDataLayout(), llvm::TargetLoweringBase::getPointerTy(), llvm::TargetLoweringBase::getRegClassFor(), llvm::MachineFunction::getRegInfo(), I, MBB, and setCurrentVReg().
Referenced by llvm::SelectionDAGBuilder::LowerCallTo(), and preassignVRegs().
Register SwiftErrorValueTracking::getOrCreateVRegUseAt | ( | const Instruction * | I, |
const MachineBasicBlock * | MBB, | ||
const Value * | Val | ||
) |
Get or create the swifterror value virtual register for a use of a swifterror by an instruction.
Definition at line 65 of file SwiftErrorValueTracking.cpp.
References getOrCreateVReg(), I, and MBB.
Referenced by llvm::SelectionDAGBuilder::LowerCallTo(), and preassignVRegs().
void SwiftErrorValueTracking::preassignVRegs | ( | MachineBasicBlock * | MBB, |
BasicBlock::const_iterator | Begin, | ||
BasicBlock::const_iterator | End | ||
) |
Definition at line 277 of file SwiftErrorValueTracking.cpp.
References assert(), llvm::SmallVectorBase< Size_T >::empty(), End, F, getOrCreateVRegDefAt(), getOrCreateVRegUseAt(), llvm::Value::isSwiftError(), MBB, and llvm::TargetLowering::supportSwiftError().
void SwiftErrorValueTracking::propagateVRegs | ( | ) |
Propagate assigned swifterror vregs through a function, synthesizing PHI nodes when needed to maintain consistency.
Propagate swifterror values through the machine function CFG.
Definition at line 147 of file SwiftErrorValueTracking.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::any_of(), assert(), llvm::ReversePostOrderTraversal< GraphT, GT >::begin(), llvm::BuildMI(), llvm::MachineRegisterInfo::createVirtualRegister(), DL, llvm::SmallVectorBase< Size_T >::empty(), llvm::ReversePostOrderTraversal< GraphT, GT >::end(), llvm::MCInstrInfo::get(), llvm::MachineFunction::getBlockNumbered(), llvm::MachineFunction::getDataLayout(), llvm::MachineBasicBlock::getFirstNonPHI(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineBasicBlock::getNumber(), getOrCreateVReg(), llvm::TargetLoweringBase::getPointerTy(), llvm::TargetLoweringBase::getRegClassFor(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), llvm::SmallSet< T, N, C >::insert(), MBB, MRI, PHI, llvm::MachineBasicBlock::predecessors(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), setCurrentVReg(), llvm::SmallVectorBase< Size_T >::size(), and llvm::TargetLowering::supportSwiftError().
Referenced by llvm::IRTranslator::runOnMachineFunction().
void SwiftErrorValueTracking::setCurrentVReg | ( | const MachineBasicBlock * | MBB, |
const Value * | Val, | ||
Register | VReg | ||
) |
Set the swifterror virtual register in the VRegDefMap for this basic block.
Definition at line 45 of file SwiftErrorValueTracking.cpp.
References MBB.
Referenced by createEntriesInEntryBlock(), getOrCreateVRegDefAt(), propagateVRegs(), and llvm::IRTranslator::runOnMachineFunction().
void SwiftErrorValueTracking::setFunction | ( | MachineFunction & | mf | ) |
Initialize data structures for specified new function.
Set up SwiftErrorVals by going through the function.
If the function has swifterror argument, it will be the first entry.
Definition at line 79 of file SwiftErrorValueTracking.cpp.
References llvm::Function::arg_begin(), llvm::Function::arg_end(), assert(), llvm::SmallVectorImpl< T >::clear(), llvm::MachineFunction::getFunction(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFunction::getSubtarget(), llvm::TargetSubtargetInfo::getTargetLowering(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::TargetLowering::supportSwiftError().
Referenced by llvm::SelectionDAGISel::runOnMachineFunction(), and llvm::IRTranslator::runOnMachineFunction().