Ignore:
Timestamp:
May 7, 2017, 4:34:48 PM (2 years ago)
Author:
nmedfort
Message:

Continued refactoring work. PabloKernel? now abstract base type with a 'generatePabloMethod' hook to generate Pablo code.

Location:
icGREP/icgrep-devel/icgrep/pablo
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/builder.hpp

    r5329 r5436  
    202202//    }
    203203   
    204     llvm::Type * getStreamSetTy(const unsigned NumElements = 1, const unsigned FieldWidth = 1) {
    205         return mPb->getStreamSetTy(NumElements, FieldWidth);
    206     }
     204//    llvm::Type * getStreamSetTy(const unsigned NumElements = 1, const unsigned FieldWidth = 1) {
     205//        return mPb->getStreamSetTy(NumElements, FieldWidth);
     206//    }
    207207   
    208208    /// Statement Iterator Wrappers
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.cpp

    r5371 r5436  
    2424#include <pablo/ps_assign.h>
    2525#include <pablo/pablo_kernel.h>
     26#include <kernels/kernel_builder.h>
    2627#include <llvm/Support/raw_os_ostream.h>
    2728
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.h

    r5435 r5436  
    277277    Phi * createPhi(llvm::Type * type);
    278278
    279     llvm::Type * getStreamSetTy(const unsigned NumElements = 1, const unsigned FieldWidth = 1) {
    280         return mParent->getBuilder()->getStreamSetTy(NumElements, FieldWidth);
    281     }
    282    
    283279    PabloBlock * getPredecessor() const;
    284280
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.cpp

    r5435 r5436  
    1111#include <pablo/pe_ones.h>
    1212#include <pablo/pablo_toolchain.h>
     13#include <kernels/kernel_builder.h>
    1314#include "llvm/Support/Debug.h"
    1415
     
    119120
    120121void PabloKernel::prepareKernel() {
     122    if (DebugOptionIsSet(DumpTrace)) {
     123        setName(getName() + "_DumpTrace");
     124    }
     125    generatePabloMethod();
     126    pablo_function_passes(this);
    121127    mPabloCompiler->initializeKernelData(iBuilder);
    122128    BlockOrientedKernel::prepareKernel();
     
    127133}
    128134
    129 void PabloKernel::generateFinalBlockMethod(Value * remainingBytes) {
     135void PabloKernel::generateFinalBlockMethod(Value * const remainingBytes) {
    130136    // Standard Pablo convention for final block processing: set a bit marking
    131137    // the position just past EOF, as well as a mask marking all positions past EOF.
     
    135141}
    136142
    137 PabloKernel::PabloKernel(const std::unique_ptr<IDISA::IDISA_Builder> & b,
     143String * PabloKernel::makeName(const llvm::StringRef & prefix) const {
     144    return mSymbolTable->makeString(iBuilder->getContext(), prefix);
     145}
     146
     147Integer * PabloKernel::getInteger(const int64_t value) const {
     148    return mSymbolTable->getInteger(iBuilder->getContext(), value);
     149}
     150
     151PabloKernel::PabloKernel(const std::unique_ptr<KernelBuilder> & b,
    138152                         std::string kernelName,
    139153                         std::vector<Binding> stream_inputs,
     
    170184        result->setScalar();
    171185    }
    172     if (DebugOptionIsSet(DumpTrace)) {
    173         setName(getName() + "_DumpTrace");
    174     }
    175186}
    176187
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.h

    r5435 r5436  
    1414#include <boost/container/flat_map.hpp>
    1515
    16 namespace IDISA { class IDISA_Builder; }
    1716namespace llvm { class Type; }
    1817namespace pablo { class Integer; }
     
    4645    }
    4746
    48     PabloKernel(const std::unique_ptr<IDISA::IDISA_Builder> & builder, std::string kernelName,
     47    PabloKernel(const std::unique_ptr<kernel::KernelBuilder> & builder, std::string kernelName,
    4948                std::vector<Binding> stream_inputs = {},
    5049                std::vector<Binding> stream_outputs = {},
     
    126125protected:
    127126
     127    virtual void generatePabloMethod() = 0;
     128
     129    String * makeName(const llvm::StringRef & prefix) const;
     130
     131    Integer * getInteger(const int64_t value) const;
     132
    128133    // A custom method for preparing kernel declarations is needed,
    129134    // so that the carry data requirements may be accommodated before
    130135    // finalizing the KernelStateType.
    131     void prepareKernel()  override;
     136    void prepareKernel() final;
    132137
    133     void generateDoBlockMethod() override final;
     138    void generateDoBlockMethod() final;
    134139
    135140    // The default method for Pablo final block processing sets the
    136141    // EOFmark bit and then calls the standard DoBlock function.
    137142    // This may be overridden for specialized processing.
    138     virtual void generateFinalBlockMethod(llvm::Value * remainingBytes) override final;
    139 
    140     inline String * makeName(const llvm::StringRef & prefix) const {
    141         return mSymbolTable->makeString(iBuilder->getContext(), prefix);
    142     }
    143 
    144     inline Integer * getInteger(const int64_t value) const {
    145         return mSymbolTable->getInteger(iBuilder->getContext(), value);
    146     }
     143    void generateFinalBlockMethod(llvm::Value * remainingBytes) final;
    147144
    148145private:
  • icGREP/icgrep-devel/icgrep/pablo/pablo_toolchain.cpp

    r5295 r5436  
    6464bool DebugOptionIsSet(PabloDebugFlags flag) {return DebugOptions.isSet(flag);}
    6565   
    66    
    67    
     66
     67
    6868#ifdef PRINT_TIMING_INFORMATION
    6969#define READ_CYCLE_COUNTER(name) name = read_cycle_counter();
     
    169169
    170170void pablo_function_passes(PabloKernel * kernel) {
    171    
     171
    172172    if (DebugOptions.isSet(ShowPablo)) {
    173173        //Print to the terminal the AST that was generated by the pararallel bit-stream compiler.
     
    175175        PabloPrinter::print(kernel, errs());
    176176    }
    177    
     177
    178178    #ifndef NDEBUG
    179179    PabloVerifier::verify(kernel, "creation");
Note: See TracChangeset for help on using the changeset viewer.