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 §ion); 28 bool sectionify(GlobalObject *value, std::vector<Regex*> ®exList, std::map<Regex*, std::string> ®exMap); 29 void parseAndInitRegexMap(cl::list<std::string> &stringListOpt, std::vector<Regex*> ®exList, std::map<Regex*, std::string> ®exMap, std::string regexType); 30 bool initRegexMap(std::map<Regex*, std::string> ®exMap, std::vector<Regex*> ®exList, 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