Changeset 3906


Ignore:
Timestamp:
Jul 6, 2014, 10:20:08 AM (5 years ago)
Author:
linmengl
Message:

add a table of LLVM builtin vector types

Location:
parabix-LLVM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • parabix-LLVM/MachineValueType.h.pytemplate

    r3904 r3906  
    146146    bool isParabixVector() const {
    147147      return (SimpleTy == MVT::v32i1 || SimpleTy == MVT::v64i1);
     148    }
     149
     150    bool isParabixValue() const {
     151      return ${isParabixValue};
    148152    }
    149153
  • parabix-LLVM/mkValueTypes.py

    r3905 r3906  
    1010import shutil
    1111
     12
     13# LLVM builtin simple value type. From llvm master branch.
     14BultinSVT = ['Other', 'i1', 'i8', 'i16', 'i32', 'i64', 'i128',
     15             'f16', 'f32', 'f64', 'f80', 'f128', 'ppcf128',
     16             'v2i1', 'v4i1', 'v8i1', 'v16i1', 'v32i1', 'v64i1',
     17             'v1i8', 'v2i8', 'v4i8', 'v8i8', 'v16i8', 'v32i8',
     18             'v1i16', 'v2i16', 'v4i16', 'v8i16', 'v16i16', 'v32i16',
     19             'v1i32', 'v2i32', 'v4i32', 'v8i32', 'v16i32',
     20             'v1i64', 'v2i64', 'v4i64', 'v8i64', 'v16i64',
     21             'v2f16', 'v4f16', 'v8f16', 'v1f32', 'v2f32', 'v4f32', 'v8f32',
     22             'v16f32', 'v1f64', 'v2f64', 'v4f64', 'v8f64',
     23             'x86mmx', 'Glue', 'isVoid', 'Untyped']
    1224
    1325def calculateTypeData(maxwidth, minvecwidth=32):
     
    242254
    243255
     256def make_isParabixValue(VectorSizeMap):
     257    """
     258    (SimpleTy == MVT::v16i8 || SimpleTy == MVT::v16i16 || ...)
     259    """
     260    res = '('
     261    for bitwidth in sorted(VectorSizeMap.keys()):
     262        for tpname in VectorSizeMap[bitwidth]:
     263            if tpname in BultinSVT:
     264                continue
     265            res += "SimpleTy == MVT::{0} || ".format(tpname)
     266    #remove trailing " || "
     267    res = res[:-4] + ")"
     268    return res
     269
     270
    244271def makeMachineValueType_h(maxwidth, minwidth=32):
    245272    f = open('MachineValueType.h.pytemplate')
     
    247274    f.close()
    248275    (VTmap, VectorSizeMap, VectorFieldSizeMap) = calculateTypeData(maxwidth, minwidth)
     276    VTmap['isParabixValue'] = make_isParabixValue(VectorSizeMap)
    249277    VTmap['isXXXBitFunctions'] = make_isXXXBitFunctions(VectorSizeMap)
    250278    VTmap['getVectorElementType'] = make_getVectorElementType(VectorFieldSizeMap)
Note: See TracChangeset for help on using the changeset viewer.