summaryrefslogtreecommitdiff
path: root/minix/llvm/passes/include/sectionify/SectionifyPass.h
blob: d859f74c8de893139240533e5008e1c1ed4bf2e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef SECTIONIFY_PASS_H

#define SECTIONIFY_PASS_H

#include <pass.h>

using namespace llvm;

namespace llvm {

class SectionifyPass : public ModulePass {

  public:
      static char ID;

      SectionifyPass();

      virtual bool runOnModule(Module &M);

  private:
      std::map<Regex*, std::string> functionRegexMap;
      std::vector<Regex*> functionRegexList;
      std::map<Regex*, std::string> dataRegexMap;
      std::vector<Regex*> dataRegexList;
      std::string moduleName;

      bool sectionifyFromRegex(GlobalObject *value, Regex *regex, std::string &section);
      bool sectionify(GlobalObject *value, std::vector<Regex*> &regexList, std::map<Regex*, std::string> &regexMap);
      void parseAndInitRegexMap(cl::list<std::string> &stringListOpt, std::vector<Regex*> &regexList, std::map<Regex*, std::string> &regexMap, std::string regexType);
      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);
      bool parseStringMapOpt(std::map<std::string, std::string> &map, std::vector<std::string> &keyList, std::vector<std::string> &stringList);
};

}

#endif