From: Juergen Ributzka Date: Wed, 30 Jul 2014 22:04:28 +0000 (+0000) Subject: [FastISel] Move the helper function isCommutativeIntrinsic into FastISel base class. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=07731b34fb7482d18f9f2ff4e69a525b9cb58878;p=oota-llvm.git [FastISel] Move the helper function isCommutativeIntrinsic into FastISel base class. Move the helper function isCommutativeIntrinsic into the FastISel base class, so it can be used by more than just one backend. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214347 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/FastISel.h b/include/llvm/CodeGen/FastISel.h index 0d1b1dc0956..7af25db9047 100644 --- a/include/llvm/CodeGen/FastISel.h +++ b/include/llvm/CodeGen/FastISel.h @@ -20,6 +20,7 @@ #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/Target/TargetLowering.h" #include "llvm/IR/CallingConv.h" +#include "llvm/IR/IntrinsicInst.h" namespace llvm { @@ -30,7 +31,6 @@ class CallInst; class DataLayout; class FunctionLoweringInfo; class Instruction; -class IntrinsicInst; class LoadInst; class MVT; class MachineConstantPool; @@ -533,6 +533,18 @@ protected: bool LowerCallTo(const CallInst *CI, const char *SymName, unsigned NumArgs); bool LowerCallTo(CallLoweringInfo &CLI); + bool isCommutativeIntrinsic(IntrinsicInst const *II) { + switch (II->getIntrinsicID()) { + case Intrinsic::sadd_with_overflow: + case Intrinsic::uadd_with_overflow: + case Intrinsic::smul_with_overflow: + case Intrinsic::umul_with_overflow: + return true; + default: + return false; + } + } + private: bool SelectBinaryOp(const User *I, unsigned ISDOpcode); diff --git a/lib/Target/X86/X86FastISel.cpp b/lib/Target/X86/X86FastISel.cpp index 2d494b4aeeb..52e65670a50 100644 --- a/lib/Target/X86/X86FastISel.cpp +++ b/lib/Target/X86/X86FastISel.cpp @@ -2163,18 +2163,6 @@ bool X86FastISel::TryEmitSmallMemcpy(X86AddressMode DestAM, return true; } -static bool isCommutativeIntrinsic(IntrinsicInst const *II) { - switch (II->getIntrinsicID()) { - case Intrinsic::sadd_with_overflow: - case Intrinsic::uadd_with_overflow: - case Intrinsic::smul_with_overflow: - case Intrinsic::umul_with_overflow: - return true; - default: - return false; - } -} - bool X86FastISel::FastLowerIntrinsicCall(const IntrinsicInst *II) { // FIXME: Handle more intrinsics. switch (II->getIntrinsicID()) {