Changeset 3969
- Timestamp:
- Aug 7, 2014, 4:40:07 PM (5 years ago)
- Location:
- icGREP/icgrep-devel/icgrep
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
icGREP/icgrep-devel/icgrep/icgrep.cpp
r3965 r3969 50 50 BitBlock EOF_mask = simd<1>::constant<1>(); 51 51 52 Nd* mNd = NULL; 53 52 54 struct Output { 53 55 BitBlock matches; … … 56 58 57 59 /* 58 59 60 struct Basis_bits { 60 61 BitBlock bit_0; … … 76 77 77 78 void do_process(FILE *infile, FILE *outfile, int count_only_option, int carry_count, process_block_fcn process_block); 79 BitBlock get_category(Basis_bits &basis_bits, const char* category); 78 80 79 81 int main(int argc, char *argv[]) … … 433 435 434 436 435 -
icGREP/icgrep-devel/icgrep/icgrep.h
r3966 r3969 9 9 10 10 11 11 12 #include <simd-lib/bitblock.hpp> 12 13 #include <simd-lib/carryQ.hpp> 13 14 #include <simd-lib/pabloSupport.hpp> 15 14 16 15 17 -
icGREP/icgrep-devel/icgrep/llvm_gen.cpp
r3965 r3969 8 8 #include "printer_pablos.h" 9 9 10 Nd nd; 11 10 12 extern "C" { 11 13 void wrapped_print_register(BitBlock bit_block) { … … 15 17 16 18 extern "C" { 17 BitBlock wrapped_get_unicode_category(Basis_bits &basis_bits, const char* name){ 18 return Unicode_Categories::getCategory(basis_bits, name); 19 } 20 } 21 22 BitBlock LLVM_Generator::Get_UnicodeCategory(Basis_bits &basis_bits, const char *name) 23 { 24 return Unicode_Categories::getCategory(basis_bits, name); 25 } 26 27 void LLVM_Generator::Print_Register(char *name, BitBlock bit_block) 28 { 29 print_register<BitBlock>(name, bit_block); 19 BitBlock wrapped_get_category_Nd(Basis_bits &basis_bits, const char* name){ 20 21 Struct_Nd nd_output; 22 nd.do_block(basis_bits, nd_output); 23 24 return nd_output.cc; 25 } 30 26 } 31 27 … … 202 198 void LLVM_Generator::DeclareFunctions() 203 199 { 204 mFunc_get_unicode_category = mMod->getOrInsertFunction("wrapped_get_unicode_category", m64x2Vect, mStruct_Basis_Bits_Ptr1, Type::getInt8PtrTy(mMod->getContext()), NULL); 205 mExecutionEngine->addGlobalMapping(cast<GlobalValue>(mFunc_get_unicode_category), (void *)&wrapped_get_unicode_category); 200 mFunc_get_unicode_category_Nd = mMod->getOrInsertFunction("wrapped_get_category_Nd", m64x2Vect, mStruct_Basis_Bits_Ptr1, Type::getInt8PtrTy(mMod->getContext()), NULL); 201 mExecutionEngine->addGlobalMapping(cast<GlobalValue>(mFunc_get_unicode_category_Nd), (void *)&wrapped_get_category_Nd); 202 203 //mFunc_get_unicode_category = mMod->getOrInsertFunction("wrapped_get_unicode_category", m64x2Vect, mStruct_Basis_Bits_Ptr1, Type::getInt8PtrTy(mMod->getContext()), NULL); 204 //mExecutionEngine->addGlobalMapping(cast<GlobalValue>(mFunc_get_unicode_category), (void *)&wrapped_get_unicode_category); 206 205 207 206 //This function can be used for testing to print the contents of a register from JIT'd code to the terminal window. … … 414 413 { 415 414 Value* basis_bits_struct = b.CreateLoad(mPtr_basis_bits_addr); 416 Value* unicode_category = b.CreateCall2(mFunc_get_unicode_category, basis_bits_struct, b.CreateGlobalStringPtr(call->getCallee())); 415 Value* unicode_category = b.CreateCall2(mFunc_get_unicode_category_Nd, basis_bits_struct, b.CreateGlobalStringPtr(call->getCallee())); 416 //b.CreateCall(mFunc_print_register, unicode_category); 417 417 Value* ptr = b.CreateAlloca(m64x2Vect); 418 418 Value* void_1 = b.CreateStore(unicode_category, ptr); … … 422 422 std::map<std::string, Value*>::iterator itGet = mMarkerMap.find(call->getCallee()); 423 423 Value * var_value = b.CreateLoad(itGet->second); 424 424 425 425 426 retVal = var_value; -
icGREP/icgrep-devel/icgrep/llvm_gen.h
r3965 r3969 39 39 40 40 #include "cc_codegenobject.h" 41 41 42 #include "pbix_compiler.h" 42 43 43 44 #include "llvm_gen_helper.h" 44 45 45 #include "unicode_categories.h" 46 //TODO: Remove 47 //#include "unicode_categories.h" 48 49 #include "categories_Nd.h" 50 46 51 47 52 #include <iostream> … … 106 111 CodeGenState subexpression_cg_state, 107 112 std::list<PabloS*> cc_cgo); 108 void Print_Register(char* name, BitBlock bit_block);109 BitBlock Get_UnicodeCategory(Basis_bits &basis_bits, const char* name);110 113 private: 111 114 void MakeLLVMModule(); … … 154 157 Constant* mFunc_test_getCategory; 155 158 Constant* mFunc_get_unicode_category; 159 Constant* mFunc_get_unicode_category_Nd; 156 160 157 161 AllocaInst* mPtr_basis_bits_addr; -
icGREP/icgrep-devel/icgrep/unicode_categories.cpp
r3965 r3969 1 1 #include "unicode_categories.h" 2 3 Unicode_Categories::Unicode_Categories(){} 2 4 3 5 BitBlock Unicode_Categories::getCategory(Basis_bits &basis_bits, const char* category) 4 6 { 7 if (std::strcmp(category, "Cc") == 0) 8 { 9 /* 10 Cc cc; 11 Struct_Cc cc_output; 12 cc.do_block(basis_bits, cc_output); 5 13 6 /* 7 if (category == "Lu") 14 return cc_output.cc; 15 */ 16 } 17 else if (std::strcmp(category, "Lu") == 0) 8 18 { 19 /* 9 20 Lu lu; 10 21 Struct_Lu lu_output; … … 12 23 13 24 return lu_output.cc; 25 */ 14 26 } 15 else if (std::strcmp(category, "Cc\n") != 0)27 else if (std::strcmp(category, "Nd") == 0) 16 28 { 17 Cc cc; 18 Struct_Cc cc_output; 19 cc.do_block(basis_bits, cc_output); 20 21 return cc_output.cc; 22 } 23 else 24 { 25 std::cout << "Category not implemented yet." << std::endl; 26 BitBlock retVal = simd<1>::constant<0>(); 27 28 return retVal; 29 } 30 */ 31 32 if (std::strcmp(category, "Cc\n") != 0) 33 { 34 //Cc cc; 35 //Struct_Cc cc_output; 36 //cc.do_block(basis_bits, cc_output); 37 38 //return cc_output.cc; 39 } 40 else if (std::strcmp(category, "Nd\n") !=0) 41 { 29 /* 42 30 Nd nd; 43 31 Struct_Nd nd_output; … … 45 33 46 34 return nd_output.cc; 35 */ 47 36 } 48 37 else 49 38 { 50 std::cout << "Category not implemented yet." << std::endl;51 39 BitBlock retVal = simd<1>::constant<0>(); 52 40 53 41 return retVal; 54 42 } 55 56 43 } 57 44 -
icGREP/icgrep-devel/icgrep/unicode_categories.h
r3965 r3969 2 2 #define UNICODE_CATEGORIES_H 3 3 4 //#include "categories_Cc.h" 4 #include "categories_Cc.h" 5 #include "categories_Lu.h" 5 6 #include "categories_Nd.h" 6 7 … … 15 16 #include <string> 16 17 17 //BitBlock None = simd<1>::constant<0>();18 18 19 19 class Unicode_Categories 20 20 { 21 21 public: 22 //Unicode_Categories();22 Unicode_Categories(); 23 23 static BitBlock getCategory(Basis_bits &basis_bits, const char* category); 24 24 };
Note: See TracChangeset
for help on using the changeset viewer.