diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
| commit | 044eb2f6afba375a914ac9d8024f8f5142bb912e (patch) | |
| tree | 1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp | |
| parent | eb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff) | |
Notes
Diffstat (limited to 'lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp')
| -rw-r--r-- | lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp b/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp index 00cbd24b84fb..0e788df1c9c0 100644 --- a/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp +++ b/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp @@ -1,4 +1,4 @@ -//===-- R600ControlFlowFinalizer.cpp - Finalize Control Flow Inst----------===// +//===- R600ControlFlowFinalizer.cpp - Finalize Control Flow Inst ----------===// // // The LLVM Compiler Infrastructure // @@ -9,7 +9,8 @@ // /// \file /// This pass compute turns all control flow pseudo instructions into native one -/// computing their address on the fly ; it also sets STACK_SIZE info. +/// computing their address on the fly; it also sets STACK_SIZE info. +// //===----------------------------------------------------------------------===// #include "AMDGPU.h" @@ -29,13 +30,15 @@ #include "llvm/CodeGen/MachineOperand.h" #include "llvm/IR/CallingConv.h" #include "llvm/IR/DebugLoc.h" +#include "llvm/IR/Function.h" +#include "llvm/Pass.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> #include <cassert> #include <cstdint> -#include <new> #include <set> #include <utility> #include <vector> @@ -47,7 +50,6 @@ using namespace llvm; namespace { struct CFStack { - enum StackItem { ENTRY = 0, SUB_ENTRY = 1, @@ -214,7 +216,7 @@ void CFStack::popLoop() { class R600ControlFlowFinalizer : public MachineFunctionPass { private: - typedef std::pair<MachineInstr *, std::vector<MachineInstr *>> ClauseFile; + using ClauseFile = std::pair<MachineInstr *, std::vector<MachineInstr *>>; enum ControlFlowInstruction { CF_TC, @@ -230,7 +232,6 @@ private: CF_END }; - static char ID; const R600InstrInfo *TII = nullptr; const R600RegisterInfo *TRI = nullptr; unsigned MaxFetchInst; @@ -499,6 +500,8 @@ private: } public: + static char ID; + R600ControlFlowFinalizer() : MachineFunctionPass(ID) {} bool runOnMachineFunction(MachineFunction &MF) override { @@ -509,14 +512,14 @@ public: R600MachineFunctionInfo *MFI = MF.getInfo<R600MachineFunctionInfo>(); - CFStack CFStack(ST, MF.getFunction()->getCallingConv()); + CFStack CFStack(ST, MF.getFunction().getCallingConv()); for (MachineFunction::iterator MB = MF.begin(), ME = MF.end(); MB != ME; ++MB) { MachineBasicBlock &MBB = *MB; unsigned CfCount = 0; std::vector<std::pair<unsigned, std::set<MachineInstr *>>> LoopStack; std::vector<MachineInstr * > IfThenElseStack; - if (MF.getFunction()->getCallingConv() == CallingConv::AMDGPU_VS) { + if (MF.getFunction().getCallingConv() == CallingConv::AMDGPU_VS) { BuildMI(MBB, MBB.begin(), MBB.findDebugLoc(MBB.begin()), getHWInstrDesc(CF_CALL_FS)); CfCount++; @@ -702,9 +705,16 @@ public: } }; +} // end anonymous namespace + +INITIALIZE_PASS_BEGIN(R600ControlFlowFinalizer, DEBUG_TYPE, + "R600 Control Flow Finalizer", false, false) +INITIALIZE_PASS_END(R600ControlFlowFinalizer, DEBUG_TYPE, + "R600 Control Flow Finalizer", false, false) + char R600ControlFlowFinalizer::ID = 0; -} // end anonymous namespace +char &llvm::R600ControlFlowFinalizerID = R600ControlFlowFinalizer::ID; FunctionPass *llvm::createR600ControlFlowFinalizer() { return new R600ControlFlowFinalizer(); |
