[llvm] r214347 - [FastISel] Move the helper function isCommutativeIntrinsic into FastISel base class.

Juergen Ributzka juergen at apple.com
Wed Jul 30 15:04:28 PDT 2014


Author: ributzka
Date: Wed Jul 30 17:04:28 2014
New Revision: 214347

URL: http://llvm.org/viewvc/llvm-project?rev=214347&view=rev
Log:
[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.

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

Modified: llvm/trunk/include/llvm/CodeGen/FastISel.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FastISel.h?rev=214347&r1=214346&r2=214347&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/FastISel.h (original)
+++ llvm/trunk/include/llvm/CodeGen/FastISel.h Wed Jul 30 17:04:28 2014
@@ -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);
 

Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=214347&r1=214346&r2=214347&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Wed Jul 30 17:04:28 2014
@@ -2163,18 +2163,6 @@ bool X86FastISel::TryEmitSmallMemcpy(X86
   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()) {





More information about the llvm-commits mailing list