X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FTarget%2FCostTable.h;h=2499f5c3189c9e8946a4d5b26903057a9891c963;hp=489435fb1c04c2f415dc77aa45c186273402330c;hb=1d1d5f60906cc89e0e46dbd51e85f622dc806a65;hpb=e60bc4e8b82e5ab94eb70bb21d94c431be9f257d;ds=sidebyside diff --git a/include/llvm/Target/CostTable.h b/include/llvm/Target/CostTable.h index 489435fb1c0..2499f5c3189 100644 --- a/include/llvm/Target/CostTable.h +++ b/include/llvm/Target/CostTable.h @@ -16,23 +16,22 @@ #define LLVM_TARGET_COSTTABLE_H_ #include "llvm/ADT/ArrayRef.h" +#include "llvm/CodeGen/MachineValueType.h" namespace llvm { /// Cost Table Entry -template struct CostTblEntry { int ISD; - TypeTy Type; + MVT::SimpleValueType Type; unsigned Cost; }; /// Find in cost table, TypeTy must be comparable to CompareTy by == -template -const CostTblEntry *CostTableLookup(ArrayRef> Tbl, - int ISD, CompareTy Ty) { +inline const CostTblEntry *CostTableLookup(ArrayRef Tbl, + int ISD, MVT Ty) { auto I = std::find_if(Tbl.begin(), Tbl.end(), - [=](const CostTblEntry &Entry) { + [=](const CostTblEntry &Entry) { return ISD == Entry.ISD && Ty == Entry.Type; }); if (I != Tbl.end()) return I; @@ -41,30 +40,21 @@ const CostTblEntry *CostTableLookup(ArrayRef> Tbl, return nullptr; } -/// Find in cost table, TypeTy must be comparable to CompareTy by == -template -const CostTblEntry *CostTableLookup(const CostTblEntry(&Tbl)[N], - int ISD, CompareTy Ty) { - return CostTableLookup(makeArrayRef(Tbl), ISD, Ty); -} - /// Type Conversion Cost Table -template struct TypeConversionCostTblEntry { int ISD; - TypeTy Dst; - TypeTy Src; + MVT::SimpleValueType Dst; + MVT::SimpleValueType Src; unsigned Cost; }; /// Find in type conversion cost table, TypeTy must be comparable to CompareTy /// by == -template -const TypeConversionCostTblEntry * -ConvertCostTableLookup(ArrayRef> Tbl, - int ISD, CompareTy Dst, CompareTy Src) { +inline const TypeConversionCostTblEntry * +ConvertCostTableLookup(ArrayRef Tbl, + int ISD, MVT Dst, MVT Src) { auto I = std::find_if(Tbl.begin(), Tbl.end(), - [=](const TypeConversionCostTblEntry &Entry) { + [=](const TypeConversionCostTblEntry &Entry) { return ISD == Entry.ISD && Src == Entry.Src && Dst == Entry.Dst; }); @@ -75,15 +65,6 @@ ConvertCostTableLookup(ArrayRef> Tbl, return nullptr; } -/// Find in type conversion cost table, TypeTy must be comparable to CompareTy -/// by == -template -const TypeConversionCostTblEntry * -ConvertCostTableLookup(const TypeConversionCostTblEntry(&Tbl)[N], - int ISD, CompareTy Dst, CompareTy Src) { - return ConvertCostTableLookup(makeArrayRef(Tbl), ISD, Dst, Src); -} - } // namespace llvm