diff options
author | Chris Lattner <sabre@nondot.org> | 2003-09-01 16:49:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-09-01 16:49:38 +0000 |
commit | d4a1af7d491e2a6726d5af0b71e61ea957df284d (patch) | |
tree | 57170d1d77ffdef16594b0cefbaf6efdf76c6f44 | |
parent | 685dc1ea98038e062ba6e1f5c7cea8226b81f71d (diff) | |
download | bcm5719-llvm-d4a1af7d491e2a6726d5af0b71e61ea957df284d.tar.gz bcm5719-llvm-d4a1af7d491e2a6726d5af0b71e61ea957df284d.zip |
If "These should be used only by the auto-parallelization pass", we might as
well put them INTO the auto-par pass.
llvm-svn: 8288
-rw-r--r-- | llvm/lib/Transforms/IPO/Parallelize.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/Parallelize.cpp b/llvm/lib/Transforms/IPO/Parallelize.cpp index 2c063d19643..562a263e29a 100644 --- a/llvm/lib/Transforms/IPO/Parallelize.cpp +++ b/llvm/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 |