xref: /minix3/minix/llvm/passes/include/sectionify/SectionifyPass.h (revision bdb565187c0f1a04513dd488df843317b27f86c8)
1 #ifndef SECTIONIFY_PASS_H
2 
3 #define SECTIONIFY_PASS_H
4 
5 #include <pass.h>
6 
7 using namespace llvm;
8 
9 namespace llvm {
10 
11 class SectionifyPass : public ModulePass {
12 
13   public:
14       static char ID;
15 
16       SectionifyPass();
17 
18       virtual bool runOnModule(Module &M);
19 
20   private:
21       std::map<Regex*, std::string> functionRegexMap;
22       std::vector<Regex*> functionRegexList;
23       std::map<Regex*, std::string> dataRegexMap;
24       std::vector<Regex*> dataRegexList;
25       std::string moduleName;
26 
27       bool sectionifyFromRegex(GlobalObject *value, Regex *regex, std::string &section);
28       bool sectionify(GlobalObject *value, std::vector<Regex*> &regexList, std::map<Regex*, std::string> &regexMap);
29       void parseAndInitRegexMap(cl::list<std::string> &stringListOpt, std::vector<Regex*> &regexList, std::map<Regex*, std::string> &regexMap, std::string regexType);
30       bool initRegexMap(std::map<Regex*, std::string> &regexMap, std::vector<Regex*> &regexList, std::map<std::string, std::string> &stringMap, std::vector<std::string> &stringList, std::string regexType);
31       bool parseStringMapOpt(std::map<std::string, std::string> &map, std::vector<std::string> &keyList, std::vector<std::string> &stringList);
32 };
33 
34 }
35 
36 #endif
37