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