[FastISel] Move the helper function isCommutativeIntrinsic into FastISel base class.
authorJuergen Ributzka <juergen@apple.com>
Wed, 30 Jul 2014 22:04:28 +0000 (22:04 +0000)
committerJuergen Ributzka <juergen@apple.com>
Wed, 30 Jul 2014 22:04:28 +0000 (22:04 +0000)
Move the helper function isCommutativeIntrinsic into the FastISel base class,
so it can be used by more than just one backend.

llvm-svn: 214347

llvm/include/llvm/CodeGen/FastISel.h
llvm/lib/Target/X86/X86FastISel.cpp

index 0d1b1dc..7af25db 100644 (file)
@@ -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);
 
index 2d494b4..52e6567 100644 (file)
@@ -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()) {