Changeset 3969


Ignore:
Timestamp:
Aug 7, 2014, 4:40:07 PM (5 years ago)
Author:
daled
Message:

A change to the way unicode categories are handled. This version supports the unicode categlry 'Nd'.

Location:
icGREP/icgrep-devel/icgrep
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/icgrep.cpp

    r3965 r3969  
    5050BitBlock EOF_mask = simd<1>::constant<1>();
    5151
     52Nd* mNd = NULL;
     53
    5254struct Output {
    5355    BitBlock matches;
     
    5658
    5759/*
    58 
    5960struct Basis_bits {
    6061    BitBlock bit_0;
     
    7677
    7778void do_process(FILE *infile, FILE *outfile, int count_only_option, int carry_count, process_block_fcn process_block);
     79BitBlock get_category(Basis_bits &basis_bits, const char* category);
    7880
    7981int main(int argc, char *argv[])
     
    433435
    434436
    435 
  • icGREP/icgrep-devel/icgrep/icgrep.h

    r3966 r3969  
    99
    1010
     11
    1112#include <simd-lib/bitblock.hpp>
    1213#include <simd-lib/carryQ.hpp>
    1314#include <simd-lib/pabloSupport.hpp>
     15
    1416
    1517
  • icGREP/icgrep-devel/icgrep/llvm_gen.cpp

    r3965 r3969  
    88#include "printer_pablos.h"
    99
     10Nd nd;
     11
    1012extern "C" {
    1113  void wrapped_print_register(BitBlock bit_block) {
     
    1517
    1618extern "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    }
    3026}
    3127
     
    202198void LLVM_Generator::DeclareFunctions()
    203199{
    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);
    206205
    207206    //This function can be used for testing to print the contents of a register from JIT'd code to the terminal window.
     
    414413        {
    415414            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);
    417417            Value* ptr = b.CreateAlloca(m64x2Vect);
    418418            Value* void_1 = b.CreateStore(unicode_category, ptr);
     
    422422        std::map<std::string, Value*>::iterator itGet = mMarkerMap.find(call->getCallee());
    423423        Value * var_value = b.CreateLoad(itGet->second);
     424
    424425
    425426        retVal = var_value;
  • icGREP/icgrep-devel/icgrep/llvm_gen.h

    r3965 r3969  
    3939
    4040#include "cc_codegenobject.h"
     41
    4142#include "pbix_compiler.h"
    4243
    4344#include "llvm_gen_helper.h"
    4445
    45 #include "unicode_categories.h"
     46//TODO: Remove
     47//#include "unicode_categories.h"
     48
     49#include "categories_Nd.h"
     50
    4651
    4752#include <iostream>
     
    106111                                    CodeGenState subexpression_cg_state,
    107112                                    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);
    110113private:
    111114    void MakeLLVMModule();
     
    154157    Constant*     mFunc_test_getCategory;
    155158    Constant*     mFunc_get_unicode_category;
     159    Constant*     mFunc_get_unicode_category_Nd;
    156160
    157161    AllocaInst*  mPtr_basis_bits_addr;
  • icGREP/icgrep-devel/icgrep/unicode_categories.cpp

    r3965 r3969  
    11#include "unicode_categories.h"
     2
     3Unicode_Categories::Unicode_Categories(){}
    24
    35BitBlock Unicode_Categories::getCategory(Basis_bits &basis_bits, const char* category)
    46{
     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);
    513
    6     /*
    7     if (category == "Lu")
     14        return cc_output.cc;
     15        */
     16    }
     17    else if (std::strcmp(category, "Lu") == 0)
    818    {
     19        /*
    920        Lu lu;
    1021        Struct_Lu lu_output;
     
    1223
    1324        return lu_output.cc;
     25        */
    1426    }
    15     else if (std::strcmp(category,"Cc\n") != 0)
     27    else if (std::strcmp(category, "Nd") == 0)
    1628    {
    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        /*
    4230        Nd nd;
    4331        Struct_Nd nd_output;
     
    4533
    4634        return nd_output.cc;
     35        */
    4736    }
    4837    else
    4938    {
    50         std::cout << "Category not implemented yet." << std::endl;
    5139        BitBlock retVal = simd<1>::constant<0>();
    5240
    5341        return retVal;
    5442    }
    55 
    5643}
    5744
  • icGREP/icgrep-devel/icgrep/unicode_categories.h

    r3965 r3969  
    22#define UNICODE_CATEGORIES_H
    33
    4 //#include "categories_Cc.h"
     4#include "categories_Cc.h"
     5#include "categories_Lu.h"
    56#include "categories_Nd.h"
    67
     
    1516#include <string>
    1617
    17 //BitBlock None = simd<1>::constant<0>();
    1818
    1919class Unicode_Categories
    2020{
    2121public:
    22     //Unicode_Categories();
     22    Unicode_Categories();
    2323    static BitBlock getCategory(Basis_bits &basis_bits, const char* category);
    2424};
Note: See TracChangeset for help on using the changeset viewer.