Changeset 3977 for trunk


Ignore:
Timestamp:
Aug 8, 2014, 3:22:27 PM (5 years ago)
Author:
linmengl
Message:

Create a template system to generate lowering logic for v64i2 and the test cases.

Location:
trunk/lib_ir/gen
Files:
4 added
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib_ir/gen/CMakeLists.txt

    r3970 r3977  
    1212  OUTPUT llc_func.ll test_llc.cpp
    1313  COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/gen.py
    14   DEPENDS llc_func.ll.pytemplate test_llc.cpp.pytemplate gen.py)
     14  DEPENDS llc_func.pytemplate.ll test_llc.pytemplate.cpp gen.py)
    1515
    1616add_test(
  • trunk/lib_ir/gen/gen.py

    r3970 r3977  
    33
    44from jinja2 import Template, Environment, FileSystemLoader
    5 import os
     5import impl_data
    66
    7 TestTemplate    = "test_llc.cpp.pytemplate"
     7TestTemplate    = "test_llc.pytemplate.cpp"
    88TestOutput      = "test_llc.cpp"
    9 LLTemplate      = "llc_func.ll.pytemplate"
     9LLTemplate      = "llc_func.pytemplate.ll"
    1010LLOutput        = "llc_func.ll"
     11FuncTemplate    = "ParabixGeneratedFuncs.pytemplate.h"
     12FuncOutput      = "ParabixGeneratedFuncs.h"
    1113
    12 FunctionList = ["add", "sub", "mult"]
     14FunctionList = ["add", "sub", "mult", "eq", "lt", "gt", "ult", "ugt"]
    1315
    1416def C(name):
     
    1921
    2022def OP(name):
    21     if (name == "mult"):
     23    if name == "mult":
    2224        return "mul"
     25    if name in ["eq", "ult", "ugt"]:
     26        return "icmp " + name
     27    if name in ["lt", "gt"]:
     28        return "icmp s" + name
     29
    2330    return name
    2431
     
    2734
    2835#configuring Jinja2
    29 env = Environment(loader=FileSystemLoader(['.', '../../gen']),
     36env = Environment(loader=FileSystemLoader(['.', 'gen/', '../../gen']),
    3037                  trim_blocks=True)
    3138
     
    4451                 params=dict(FunctionNames = FunctionNames))
    4552
     53def genFuncFile():
     54    fillTemplate(template=FuncTemplate, output=FuncOutput,
     55                 params=dict(HeaderComment = "AUTO GENERATED FILE",
     56                             FunctionNames = FunctionNames,
     57                             Implement = impl_data.getImplements()))
     58    # mv ParabixGeneratedFuncs.h ~/llvm_suit/llvm_git/lib/Target/X86/
     59
    4660if __name__ == '__main__':
    4761    genTestFile()
    4862    genLLFile()
     63    #genFuncFile()
    4964
Note: See TracChangeset for help on using the changeset viewer.