aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/Parallelize.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-09-01 16:49:38 +0000
committerChris Lattner <sabre@nondot.org>2003-09-01 16:49:38 +0000
commit09a670587a770ccf64207c933d95bc62bb56ffcf (patch)
treeed236acdde8e58322319942ca36823c3a314e36e /lib/Transforms/IPO/Parallelize.cpp
parent60a3518cf90d0acec861d9efbdc0f44652da6acf (diff)
If "These should be used only by the auto-parallelization pass", we might as
well put them INTO the auto-par pass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8288 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/Parallelize.cpp')
-rw-r--r--lib/Transforms/IPO/Parallelize.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/Parallelize.cpp b/lib/Transforms/IPO/Parallelize.cpp
index 2c063d1964..562a263e29 100644
--- a/lib/Transforms/IPO/Parallelize.cpp
+++ b/lib/Transforms/IPO/Parallelize.cpp
@@ -31,7 +31,6 @@
//
//===----------------------------------------------------------------------===//
-#include "Cilkifier.h"
#include "llvm/Transforms/Utils/DemoteRegToStack.h"
#include "llvm/Analysis/PgmDependenceGraph.h"
#include "llvm/Analysis/Dominators.h"
@@ -87,6 +86,37 @@ bool CheckDominance(Function& func,
//----------------------------------------------------------------------------
+// Global constants used in marking Cilk functions and function calls.
+//----------------------------------------------------------------------------
+
+static const char * const CilkSuffix = ".llvm2cilk";
+static const char * const DummySyncFuncName = "__sync.llvm2cilk";
+
+//----------------------------------------------------------------------------
+// Routines to identify Cilk functions, calls to Cilk functions, and syncs.
+//----------------------------------------------------------------------------
+
+static bool isCilk(const Function& F) {
+ return (F.getName().rfind(CilkSuffix) ==
+ F.getName().size() - std::strlen(CilkSuffix));
+}
+
+static bool isCilkMain(const Function& F) {
+ return F.getName() == "main" + std::string(CilkSuffix);
+}
+
+
+static bool isCilk(const CallInst& CI) {
+ return CI.getCalledFunction() && isCilk(*CI.getCalledFunction());
+}
+
+static bool isSync(const CallInst& CI) {
+ return CI.getCalledFunction() &&
+ CI.getCalledFunction()->getName() == DummySyncFuncName;
+}
+
+
+//----------------------------------------------------------------------------
// class Cilkifier
//
// Code generation pass that transforms code to identify where Cilk keywords