diff options
| author | orivej <[email protected]> | 2022-02-10 16:44:49 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:44:49 +0300 |
| commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
| tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/llvm12/include/llvm/CodeGen/SwiftErrorValueTracking.h | |
| parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/include/llvm/CodeGen/SwiftErrorValueTracking.h')
| -rw-r--r-- | contrib/libs/llvm12/include/llvm/CodeGen/SwiftErrorValueTracking.h | 242 |
1 files changed, 121 insertions, 121 deletions
diff --git a/contrib/libs/llvm12/include/llvm/CodeGen/SwiftErrorValueTracking.h b/contrib/libs/llvm12/include/llvm/CodeGen/SwiftErrorValueTracking.h index 04fcc3634cc..aea46757c67 100644 --- a/contrib/libs/llvm12/include/llvm/CodeGen/SwiftErrorValueTracking.h +++ b/contrib/libs/llvm12/include/llvm/CodeGen/SwiftErrorValueTracking.h @@ -1,121 +1,121 @@ -#pragma once - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -//===- SwiftErrorValueTracking.h - Track swifterror VReg vals --*- C++ -*--===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This implements a limited mem2reg-like analysis to promote uses of function -// arguments and allocas marked with swiftalloc from memory into virtual -// registers tracked by this class. -// -//===----------------------------------------------------------------------===// - -#ifndef SWIFTERRORVALUETRACKING_H -#define SWIFTERRORVALUETRACKING_H - -#include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/CodeGen/Register.h" -#include "llvm/IR/BasicBlock.h" -#include "llvm/IR/DebugLoc.h" -#include <functional> -#include <type_traits> -#include <utility> - - -namespace llvm { - class Function; - class MachineBasicBlock; - class MachineFunction; - class MachineInstr; - class TargetInstrInfo; - class TargetLowering; - -class SwiftErrorValueTracking { - // Some useful objects to reduce the number of function arguments needed. - MachineFunction *MF; - const Function *Fn; - const TargetLowering *TLI; - const TargetInstrInfo *TII; - - /// A map from swifterror value in a basic block to the virtual register it is - /// currently represented by. - DenseMap<std::pair<const MachineBasicBlock *, const Value *>, Register> - VRegDefMap; - - /// A list of upward exposed vreg uses that need to be satisfied by either a - /// copy def or a phi node at the beginning of the basic block representing - /// the predecessor(s) swifterror value. - DenseMap<std::pair<const MachineBasicBlock *, const Value *>, Register> - VRegUpwardsUse; - - /// A map from instructions that define/use a swifterror value to the virtual - /// register that represents that def/use. - llvm::DenseMap<PointerIntPair<const Instruction *, 1, bool>, Register> - VRegDefUses; - - /// The swifterror argument of the current function. - const Value *SwiftErrorArg; - - using SwiftErrorValues = SmallVector<const Value*, 1>; - /// A function can only have a single swifterror argument. And if it does - /// have a swifterror argument, it must be the first entry in - /// SwiftErrorVals. - SwiftErrorValues SwiftErrorVals; - -public: - /// Initialize data structures for specified new function. - void setFunction(MachineFunction &MF); - - /// Get the (unique) function argument that was marked swifterror, or nullptr - /// if this function has no swifterror args. - const Value *getFunctionArg() const { - return SwiftErrorArg; - } - - /// Get or create the swifterror value virtual register in - /// VRegDefMap for this basic block. - Register getOrCreateVReg(const MachineBasicBlock *, const Value *); - - /// Set the swifterror virtual register in the VRegDefMap for this - /// basic block. - void setCurrentVReg(const MachineBasicBlock *MBB, const Value *, Register); - - /// Get or create the swifterror value virtual register for a def of a - /// swifterror by an instruction. - Register getOrCreateVRegDefAt(const Instruction *, const MachineBasicBlock *, - const Value *); - - /// Get or create the swifterror value virtual register for a use of a - /// swifterror by an instruction. - Register getOrCreateVRegUseAt(const Instruction *, const MachineBasicBlock *, - const Value *); - - /// Create initial definitions of swifterror values in the entry block of the - /// current function. - bool createEntriesInEntryBlock(DebugLoc DbgLoc); - - /// Propagate assigned swifterror vregs through a function, synthesizing PHI - /// nodes when needed to maintain consistency. - void propagateVRegs(); - - void preassignVRegs(MachineBasicBlock *MBB, BasicBlock::const_iterator Begin, - BasicBlock::const_iterator End); -}; - -} - -#endif - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- SwiftErrorValueTracking.h - Track swifterror VReg vals --*- C++ -*--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This implements a limited mem2reg-like analysis to promote uses of function +// arguments and allocas marked with swiftalloc from memory into virtual +// registers tracked by this class. +// +//===----------------------------------------------------------------------===// + +#ifndef SWIFTERRORVALUETRACKING_H +#define SWIFTERRORVALUETRACKING_H + +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/CodeGen/Register.h" +#include "llvm/IR/BasicBlock.h" +#include "llvm/IR/DebugLoc.h" +#include <functional> +#include <type_traits> +#include <utility> + + +namespace llvm { + class Function; + class MachineBasicBlock; + class MachineFunction; + class MachineInstr; + class TargetInstrInfo; + class TargetLowering; + +class SwiftErrorValueTracking { + // Some useful objects to reduce the number of function arguments needed. + MachineFunction *MF; + const Function *Fn; + const TargetLowering *TLI; + const TargetInstrInfo *TII; + + /// A map from swifterror value in a basic block to the virtual register it is + /// currently represented by. + DenseMap<std::pair<const MachineBasicBlock *, const Value *>, Register> + VRegDefMap; + + /// A list of upward exposed vreg uses that need to be satisfied by either a + /// copy def or a phi node at the beginning of the basic block representing + /// the predecessor(s) swifterror value. + DenseMap<std::pair<const MachineBasicBlock *, const Value *>, Register> + VRegUpwardsUse; + + /// A map from instructions that define/use a swifterror value to the virtual + /// register that represents that def/use. + llvm::DenseMap<PointerIntPair<const Instruction *, 1, bool>, Register> + VRegDefUses; + + /// The swifterror argument of the current function. + const Value *SwiftErrorArg; + + using SwiftErrorValues = SmallVector<const Value*, 1>; + /// A function can only have a single swifterror argument. And if it does + /// have a swifterror argument, it must be the first entry in + /// SwiftErrorVals. + SwiftErrorValues SwiftErrorVals; + +public: + /// Initialize data structures for specified new function. + void setFunction(MachineFunction &MF); + + /// Get the (unique) function argument that was marked swifterror, or nullptr + /// if this function has no swifterror args. + const Value *getFunctionArg() const { + return SwiftErrorArg; + } + + /// Get or create the swifterror value virtual register in + /// VRegDefMap for this basic block. + Register getOrCreateVReg(const MachineBasicBlock *, const Value *); + + /// Set the swifterror virtual register in the VRegDefMap for this + /// basic block. + void setCurrentVReg(const MachineBasicBlock *MBB, const Value *, Register); + + /// Get or create the swifterror value virtual register for a def of a + /// swifterror by an instruction. + Register getOrCreateVRegDefAt(const Instruction *, const MachineBasicBlock *, + const Value *); + + /// Get or create the swifterror value virtual register for a use of a + /// swifterror by an instruction. + Register getOrCreateVRegUseAt(const Instruction *, const MachineBasicBlock *, + const Value *); + + /// Create initial definitions of swifterror values in the entry block of the + /// current function. + bool createEntriesInEntryBlock(DebugLoc DbgLoc); + + /// Propagate assigned swifterror vregs through a function, synthesizing PHI + /// nodes when needed to maintain consistency. + void propagateVRegs(); + + void preassignVRegs(MachineBasicBlock *MBB, BasicBlock::const_iterator Begin, + BasicBlock::const_iterator End); +}; + +} + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif |
