llvm.org GIT mirror llvm / 8ec9d62
Rename ExpandPseudos to ExpandISelPseudos to help clarify its role. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119716 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 9 years ago
5 changed file(s) with 87 addition(s) and 87 deletion(s). Raw diff Collapse all Expand all
212212 /// addressing.
213213 FunctionPass *createLocalStackSlotAllocationPass();
214214
215 /// createExpandPseudosPass - This pass expands pseudo-instructions.
216 ///
217 FunctionPass *createExpandPseudosPass();
215 /// createExpandISelPseudosPass - This pass expands pseudo-instructions.
216 ///
217 FunctionPass *createExpandISelPseudosPass();
218218
219219 } // End llvm namespace
220220
9191 void initializeDominanceFrontierPass(PassRegistry&);
9292 void initializeDominatorTreePass(PassRegistry&);
9393 void initializeEdgeProfilerPass(PassRegistry&);
94 void initializeExpandPseudosPass(PassRegistry&);
94 void initializeExpandISelPseudosPass(PassRegistry&);
9595 void initializeFindUsedTypesPass(PassRegistry&);
9696 void initializeFunctionAttrsPass(PassRegistry&);
9797 void initializeGCModuleInfoPass(PassRegistry&);
1010 DwarfEHPrepare.cpp
1111 ELFCodeEmitter.cpp
1212 ELFWriter.cpp
13 ExpandPseudos.cpp
13 ExpandISelPseudos.cpp
1414 GCMetadata.cpp
1515 GCMetadataPrinter.cpp
1616 GCStrategy.cpp
0 //===-- llvm/CodeGen/ExpandISelPseudos.cpp ----------------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Expand Psuedo-instructions produced by ISel. These are usually to allow
10 // the expansion to contain control flow, such as a conditional move
11 // implemented with a conditional branch and a phi, or an atomic operation
12 // implemented with a loop.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #define DEBUG_TYPE "expand-isel-pseudos"
17 #include "llvm/CodeGen/MachineFunction.h"
18 #include "llvm/CodeGen/MachineFunctionPass.h"
19 #include "llvm/CodeGen/Passes.h"
20 #include "llvm/Target/TargetLowering.h"
21 #include "llvm/Target/TargetMachine.h"
22 #include "llvm/Support/Debug.h"
23 using namespace llvm;
24
25 namespace {
26 class ExpandISelPseudos : public MachineFunctionPass {
27 public:
28 static char ID; // Pass identification, replacement for typeid
29 ExpandISelPseudos() : MachineFunctionPass(ID) {}
30
31 private:
32 virtual bool runOnMachineFunction(MachineFunction &MF);
33
34 const char *getPassName() const {
35 return "Expand ISel Pseudo-instructions";
36 }
37
38 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
39 MachineFunctionPass::getAnalysisUsage(AU);
40 }
41 };
42 } // end anonymous namespace
43
44 char ExpandISelPseudos::ID = 0;
45 INITIALIZE_PASS(ExpandISelPseudos, "expand-isel-pseudos",
46 "Expand CodeGen Pseudo-instructions", false, false)
47
48 FunctionPass *llvm::createExpandISelPseudosPass() {
49 return new ExpandISelPseudos();
50 }
51
52 bool ExpandISelPseudos::runOnMachineFunction(MachineFunction &MF) {
53 bool Changed = false;
54 const TargetLowering *TLI = MF.getTarget().getTargetLowering();
55
56 // Iterate through each instruction in the function, looking for pseudos.
57 for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
58 MachineBasicBlock *MBB = I;
59 for (MachineBasicBlock::iterator MBBI = MBB->begin(), MBBE = MBB->end();
60 MBBI != MBBE; ) {
61 MachineInstr *MI = MBBI++;
62
63 // If MI is a pseudo, expand it.
64 const TargetInstrDesc &TID = MI->getDesc();
65 if (TID.usesCustomInsertionHook()) {
66 Changed = true;
67 MachineBasicBlock *NewMBB =
68 TLI->EmitInstrWithCustomInserter(MI, MBB);
69 // The expansion may involve new basic blocks.
70 if (NewMBB != MBB) {
71 MBB = NewMBB;
72 I = NewMBB;
73 MBBI = NewMBB->begin();
74 MBBE = NewMBB->end();
75 }
76 }
77 }
78 }
79
80 return Changed;
81 }
+0
-82
lib/CodeGen/ExpandPseudos.cpp less more
None //===-- llvm/CodeGen/ExpandPseudos.cpp --------------------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Expand Psuedo-instructions produced by ISel. These are usually to allow
10 // the expansion to contain control flow, such as a conditional move
11 // implemented with a conditional branch and a phi, or an atomic operation
12 // implemented with a loop.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #define DEBUG_TYPE "expand-pseudos"
17 #include "llvm/CodeGen/MachineFunction.h"
18 #include "llvm/CodeGen/MachineFunctionPass.h"
19 #include "llvm/CodeGen/Passes.h"
20 #include "llvm/Target/TargetLowering.h"
21 #include "llvm/Target/TargetMachine.h"
22 #include "llvm/Support/Debug.h"
23 using namespace llvm;
24
25 namespace {
26 class ExpandPseudos : public MachineFunctionPass {
27 public:
28 static char ID; // Pass identification, replacement for typeid
29 ExpandPseudos() : MachineFunctionPass(ID) {}
30
31 private:
32 virtual bool runOnMachineFunction(MachineFunction &MF);
33
34 const char *getPassName() const {
35 return "Expand CodeGen Pseudo-instructions";
36 }
37
38 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
39 MachineFunctionPass::getAnalysisUsage(AU);
40 }
41 };
42 } // end anonymous namespace
43
44 char ExpandPseudos::ID = 0;
45 INITIALIZE_PASS(ExpandPseudos, "expand-pseudos",
46 "Expand CodeGen Pseudo-instructions", false, false)
47
48 FunctionPass *llvm::createExpandPseudosPass() {
49 return new ExpandPseudos();
50 }
51
52 bool ExpandPseudos::runOnMachineFunction(MachineFunction &MF) {
53 bool Changed = false;
54 const TargetLowering *TLI = MF.getTarget().getTargetLowering();
55
56 // Iterate through each instruction in the function, looking for pseudos.
57 for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
58 MachineBasicBlock *MBB = I;
59 for (MachineBasicBlock::iterator MBBI = MBB->begin(), MBBE = MBB->end();
60 MBBI != MBBE; ) {
61 MachineInstr *MI = MBBI++;
62
63 // If MI is a pseudo, expand it.
64 const TargetInstrDesc &TID = MI->getDesc();
65 if (TID.usesCustomInsertionHook()) {
66 Changed = true;
67 MachineBasicBlock *NewMBB =
68 TLI->EmitInstrWithCustomInserter(MI, MBB);
69 // The expansion may involve new basic blocks.
70 if (NewMBB != MBB) {
71 MBB = NewMBB;
72 I = NewMBB;
73 MBBI = NewMBB->begin();
74 MBBE = NewMBB->end();
75 }
76 }
77 }
78 }
79
80 return Changed;
81 }