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