TCE  1.21
ProgramPartitioner.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2012 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file ProgramPartitioner.hh
26  *
27  * Declaration of ProgramPartitioner class. A MachineFunctionPass that chooses
28  * more restricted register classes for program's variables. The register classes
29  * are chosen based on the connectivity and in the case of vector load sources
30  * in a clustered regular machine, according to the vector lane index. In case
31  * of clustered machines the chosen register classes map the register files in
32  * each cluster node, therefore producing a node partitioning for the program.
33  *
34  * @author Pekka Jääskeläinen 2012
35  */
36 
37 #ifndef TCE_PROGRAM_PARTITIONER_HH
38 #define TCE_PROGRAM_PARTITIONER_HH
39 
40 #include "CompilerWarnings.hh"
41 
42 IGNORE_COMPILER_WARNING("-Wunused-parameter")
43 
44 #include "llvm/CodeGen/Passes.h"
45 #include "tce_config.h"
46 #include "llvm/IR/Constant.h"
47 #include "llvm/IR/Constants.h"
48 #include "llvm/IR/Instructions.h"
49 #include "llvm/IR/Function.h"
50 #include "llvm/IR/Type.h"
51 #include "llvm/IR/Module.h"
52 #include "llvm/Pass.h"
53 #include "llvm/CodeGen/MachineFunctionPass.h"
54 #include "llvm/CodeGen/MachineRegisterInfo.h"
55 #include "llvm/Analysis/CFG.h"
56 
57 #include "llvm/Support/Compiler.h"
58 #ifdef LLVM_OLDER_THAN_6_0
59 #include "llvm/Target/TargetInstrInfo.h"
60 #else
61 #include "llvm/CodeGen/TargetInstrInfo.h"
62 #endif
63 #include "llvm/ADT/DepthFirstIterator.h"
64 
65 #include "llvm/Analysis/CallGraph.h"
66 #include "llvm/Analysis/AliasAnalysis.h"
67 #include "llvm/Analysis/Passes.h"
68 #include "llvm/Support/Debug.h"
69 #include "llvm/Support/raw_ostream.h"
70 
71 #include "llvm/ADT/StringMap.h"
72 
73 #include "hash_map.hh"
74 
76 
77 struct ProgramPartitioner : public llvm::MachineFunctionPass {
78  static char ID;
79  ProgramPartitioner() : MachineFunctionPass(ID) {}
80 
81  virtual bool doInitialization(llvm::Module &M) override;
82  virtual bool runOnMachineFunction(llvm::MachineFunction &MF) override;
83  virtual bool doFinalization(llvm::Module &M) override;
84  virtual bool findNodeIndex(
85  const llvm::MachineInstr &I,
86  hash_map<const llvm::MachineInstr*, unsigned>& partitions,
87  llvm::MachineFunction& MF,
88  unsigned int& index);
89 #if LLVM_OLDER_THAN_4_0
90  virtual const char *getPassName() const override {
91 #else
92  virtual llvm::StringRef getPassName() const override {
93 #endif
94  return "TCE: program variables to register file partitioner";
95  }
96 
97 public:
98 };
99 
100 #endif
virtual bool runOnMachineFunction(llvm::MachineFunction &MF) override
virtual bool doInitialization(llvm::Module &M) override
#define POP_COMPILER_DIAGS
virtual bool doFinalization(llvm::Module &M) override
virtual llvm::StringRef getPassName() const override
virtual bool findNodeIndex(const llvm::MachineInstr &I, hash_map< const llvm::MachineInstr *, unsigned > &partitions, llvm::MachineFunction &MF, unsigned int &index)
#define IGNORE_COMPILER_WARNING(X)