source: icGREP/icgrep-devel/icgrep/grep_engine.h @ 5351

Last change on this file since 5351 was 5341, checked in by xuedongx, 2 years ago

LineBreak? Kernel for GPU.

File size: 1.9 KB
Line 
1/*
2 *  Copyright (c) 2016 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6#ifndef DO_GREP_H
7#define DO_GREP_H
8#include <grep_type.h>  // for GrepType, GrepType::Normal
9#include <string>       // for string
10#include <vector>
11namespace llvm { class ExecutionEngine; }
12namespace llvm { class Module; }
13namespace re { class CC; }
14namespace re { class RE; }
15
16class GrepEngine {
17    typedef void (*GrepFunctionType)(char * byte_data, size_t filesize, const int fileIdx);
18    typedef uint64_t (*GrepFunctionType_CountOnly)(char * byte_data, size_t filesize, const int fileIdx);
19    typedef void (*GrepFunctionType_CPU)(char * rslt, char * LineBreak, char * byte_data, size_t filesize, const int fileIdx);
20public:
21
22    GrepEngine();
23    ~GrepEngine();
24 
25    void grepCodeGen(std::string moduleName, re::RE * re_ast, bool CountOnly, bool UTF_16 = false, GrepType grepType = GrepType::Normal);
26    void multiGrepCodeGen(std::string moduleName, std::vector<re::RE *> REs, bool CountOnly, bool UTF_16 = false, GrepType grepType = GrepType::Normal);
27     
28    void doGrep(const std::string & fileName, const int fileIdx, bool CountOnly, std::vector<size_t> & total_CountOnly, bool UTF_16);
29   
30    re::CC *  grepCodepoints();
31
32    const std::vector<std::string> & grepPropertyValues(const std::string & propertyName);
33   
34private:
35   
36    GrepFunctionType mGrepFunction;
37    GrepFunctionType_CountOnly mGrepFunction_CountOnly;
38    GrepFunctionType_CPU mGrepFunction_CPU;
39
40    GrepType mGrepType;
41    llvm::ExecutionEngine * mEngine;
42};
43
44void icgrep_Linking(llvm::Module * m, llvm::ExecutionEngine * e);
45
46
47re::CC * getParsedCodePointSet();
48void setParsedCodePointSet();
49
50void setParsedPropertyValues();
51
52
53void initResult(std::vector<std::string> filenames);
54void PrintResult(bool CountOnly, std::vector<size_t> & total_CountOnly);
55
56#endif
Note: See TracBrowser for help on using the repository browser.