Mercurial > hg > CbC > CbC_llvm
comparison lib/Target/NVPTX/NVPTXPeephole.cpp @ 134:3a76565eade5 LLVM5.0.1
update 5.0.1
author | mir3636 |
---|---|
date | Sat, 17 Feb 2018 09:57:20 +0900 |
parents | 803732b1fca8 |
children | c2174574ed3a |
comparison
equal
deleted
inserted
replaced
133:c60214abe0e8 | 134:3a76565eade5 |
---|---|
20 // cvta.to.local instructions. Performance can be improved if we avoid casting | 20 // cvta.to.local instructions. Performance can be improved if we avoid casting |
21 // address back and forth and directly calculate local address based on %SPL. | 21 // address back and forth and directly calculate local address based on %SPL. |
22 // This peephole pass optimizes these cases, for example | 22 // This peephole pass optimizes these cases, for example |
23 // | 23 // |
24 // It will transform the following pattern | 24 // It will transform the following pattern |
25 // %vreg0<def> = LEA_ADDRi64 %VRFrame, 4 | 25 // %0 = LEA_ADDRi64 %VRFrame, 4 |
26 // %vreg1<def> = cvta_to_local_yes_64 %vreg0 | 26 // %1 = cvta_to_local_yes_64 %0 |
27 // | 27 // |
28 // into | 28 // into |
29 // %vreg1<def> = LEA_ADDRi64 %VRFrameLocal, 4 | 29 // %1 = LEA_ADDRi64 %VRFrameLocal, 4 |
30 // | 30 // |
31 // %VRFrameLocal is the virtual register name of %SPL | 31 // %VRFrameLocal is the virtual register name of %SPL |
32 // | 32 // |
33 //===----------------------------------------------------------------------===// | 33 //===----------------------------------------------------------------------===// |
34 | 34 |
35 #include "NVPTX.h" | 35 #include "NVPTX.h" |
36 #include "llvm/CodeGen/MachineFunctionPass.h" | 36 #include "llvm/CodeGen/MachineFunctionPass.h" |
37 #include "llvm/CodeGen/MachineInstrBuilder.h" | 37 #include "llvm/CodeGen/MachineInstrBuilder.h" |
38 #include "llvm/CodeGen/MachineRegisterInfo.h" | 38 #include "llvm/CodeGen/MachineRegisterInfo.h" |
39 #include "llvm/Target/TargetInstrInfo.h" | 39 #include "llvm/CodeGen/TargetInstrInfo.h" |
40 #include "llvm/Target/TargetRegisterInfo.h" | 40 #include "llvm/CodeGen/TargetRegisterInfo.h" |
41 | 41 |
42 using namespace llvm; | 42 using namespace llvm; |
43 | 43 |
44 #define DEBUG_TYPE "nvptx-peephole" | 44 #define DEBUG_TYPE "nvptx-peephole" |
45 | 45 |
123 } | 123 } |
124 Root.eraseFromParentAndMarkDBGValuesForRemoval(); | 124 Root.eraseFromParentAndMarkDBGValuesForRemoval(); |
125 } | 125 } |
126 | 126 |
127 bool NVPTXPeephole::runOnMachineFunction(MachineFunction &MF) { | 127 bool NVPTXPeephole::runOnMachineFunction(MachineFunction &MF) { |
128 if (skipFunction(*MF.getFunction())) | 128 if (skipFunction(MF.getFunction())) |
129 return false; | 129 return false; |
130 | 130 |
131 bool Changed = false; | 131 bool Changed = false; |
132 // Loop over all of the basic blocks. | 132 // Loop over all of the basic blocks. |
133 for (auto &MBB : MF) { | 133 for (auto &MBB : MF) { |