Skip to content
Snippets Groups Projects
Commit 1e46b1ad authored by Kalle Raiskila's avatar Kalle Raiskila
Browse files

Remove llvm-ld. Clean up pthread and basic drivers not to use it anymore.

parent 7d77cc73
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ...@@ -17,7 +17,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
For third-party software distributed with pocl, see the following file:
* tools/llvm-ld/LICENSE.TXT
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
SUBDIRS = include lib scripts tools/llvm-ld examples tests SUBDIRS = include lib scripts examples tests
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
......
...@@ -693,9 +693,6 @@ if test x"$prefix" = xNONE; then ...@@ -693,9 +693,6 @@ if test x"$prefix" = xNONE; then
fi fi
fi fi
AC_DEFINE_UNQUOTED([LLVM_LD], ["pocl-llvm-ld"],[LLVM linker binary])
AC_SUBST([LLVM_LD], [pocl-llvm-ld])
# Checks for libraries. # Checks for libraries.
# Checks for header files. # Checks for header files.
...@@ -830,7 +827,6 @@ AC_CONFIG_FILES([Makefile ...@@ -830,7 +827,6 @@ AC_CONFIG_FILES([Makefile
tests/tce/fp16/Makefile tests/tce/fp16/Makefile
tests/cell/Makefile tests/cell/Makefile
tests/cell/hello/Makefile tests/cell/hello/Makefile
tools/llvm-ld/Makefile
]) ])
AC_OUTPUT AC_OUTPUT
......
...@@ -158,24 +158,9 @@ pocl_basic_run ...@@ -158,24 +158,9 @@ pocl_basic_run
{ {
char *llvm_ld; char *llvm_ld;
error = snprintf (bytecode, POCL_FILENAME_LENGTH, error = snprintf (bytecode, POCL_FILENAME_LENGTH,
"%s/linked.bc", tmpdir); "%s/%s", tmpdir, POCL_PARALLEL_BC_FILENAME);
assert (error >= 0); assert (error >= 0);
if (getenv("POCL_BUILDING") != NULL)
llvm_ld = BUILDDIR "/tools/llvm-ld/pocl-llvm-ld";
else if (access(PKGLIBEXECDIR "/pocl-llvm-ld", X_OK) == 0)
llvm_ld = PKGLIBEXECDIR "/pocl-llvm-ld";
else
llvm_ld = "pocl-llvm-ld";
error = snprintf (command, COMMAND_LENGTH,
"%s --disable-opt -link-as-library -o %s %s/%s",
llvm_ld, bytecode, tmpdir, POCL_PARALLEL_BC_FILENAME);
assert (error >= 0);
error = system(command);
assert (error == 0);
error = snprintf (assembly, POCL_FILENAME_LENGTH, error = snprintf (assembly, POCL_FILENAME_LENGTH,
"%s/parallel.s", "%s/parallel.s",
tmpdir); tmpdir);
......
...@@ -484,24 +484,9 @@ pocl_pthread_run ...@@ -484,24 +484,9 @@ pocl_pthread_run
{ {
char *llvm_ld; char *llvm_ld;
error = snprintf (bytecode, POCL_FILENAME_LENGTH, error = snprintf (bytecode, POCL_FILENAME_LENGTH,
"%s/linked.bc", tmpdir); "%s/%s", tmpdir, POCL_PARALLEL_BC_FILENAME);
assert (error >= 0); assert (error >= 0);
if (getenv("POCL_BUILDING") != NULL)
llvm_ld = BUILDDIR "/tools/llvm-ld/pocl-llvm-ld";
else if (access(PKGLIBEXECDIR "/pocl-llvm-ld", X_OK) == 0)
llvm_ld = PKGLIBEXECDIR "/pocl-llvm-ld";
else
llvm_ld = "pocl-llvm-ld";
error = snprintf (command, COMMAND_LENGTH,
"%s --disable-opt -link-as-library -o %s %s/%s",
llvm_ld, bytecode, tmpdir, POCL_PARALLEL_BC_FILENAME);
assert (error >= 0);
error = system(command);
assert (error == 0);
error = snprintf (assembly, POCL_FILENAME_LENGTH, error = snprintf (assembly, POCL_FILENAME_LENGTH,
"%s/parallel.s", "%s/parallel.s",
tmpdir); tmpdir);
......
==============================================================================
LLVM Release License
==============================================================================
University of Illinois/NCSA
Open Source License
Copyright (c) 2003-2012 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:
LLVM Team
University of Illinois at Urbana-Champaign
http://llvm.org
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
pkglibexec_PROGRAMS = pocl-llvm-ld
pocl_llvm_ld_SOURCES = llvm-ld.cpp Optimize.cpp
pocl_llvm_ld_LDFLAGS = `@LLVM_CONFIG@ --ldflags`
pocl_llvm_ld_LDADD = -lLLVM-${LLVM_VERSION}
pocl_llvm_ld_CXXFLAGS = `@LLVM_CONFIG@ --cxxflags`
//===- Optimize.cpp - Optimize a complete program -------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements all optimization of the linked module for llvm-ld.
//
//===----------------------------------------------------------------------===//
#include "config.h"
#if defined(LLVM_3_2) || defined(LLVM_3_1)
#include "llvm/Module.h"
#else
#include "llvm/IR/Module.h"
#endif
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/PassNameParser.h"
#include "llvm/Support/PluginLoader.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
#include "llvm/Transforms/Scalar.h"
#ifdef LLVM_3_1
#include "llvm/Target/TargetData.h"
#else
#if defined(LLVM_3_2)
#include "llvm/DataLayout.h"
#else
#include "llvm/IR/DataLayout.h"
#endif
#endif
using namespace llvm;
// Pass Name Options as generated by the PassNameParser
static cl::list<const PassInfo*, bool, PassNameParser>
OptimizationList(cl::desc("Optimizations available:"));
//Don't verify at the end
static cl::opt<bool> DontVerify("disable-verify", cl::ReallyHidden);
static cl::opt<bool> DisableInline("disable-inlining",
cl::desc("Do not run the inliner pass"));
static cl::opt<bool>
DisableOptimizations("disable-opt",
cl::desc("Do not run any optimization passes"));
static cl::opt<bool> DisableInternalize("disable-internalize",
cl::desc("Do not mark all symbols as internal"));
static cl::opt<bool> VerifyEach("verify-each",
cl::desc("Verify intermediate results of all passes"));
static cl::alias ExportDynamic("export-dynamic",
cl::aliasopt(DisableInternalize),
cl::desc("Alias for -disable-internalize"));
static cl::opt<bool> Strip("strip-all",
cl::desc("Strip all symbol info from executable"));
static cl::alias A0("s", cl::desc("Alias for --strip-all"),
cl::aliasopt(Strip));
static cl::opt<bool> StripDebug("strip-debug",
cl::desc("Strip debugger symbol info from executable"));
static cl::alias A1("S", cl::desc("Alias for --strip-debug"),
cl::aliasopt(StripDebug));
// A utility function that adds a pass to the pass manager but will also add
// a verifier pass after if we're supposed to verify.
static inline void addPass(PassManager &PM, Pass *P) {
// Add the pass to the pass manager...
PM.add(P);
// If we are verifying all of the intermediate steps, add the verifier...
if (VerifyEach)
PM.add(createVerifierPass());
}
namespace llvm {
/// Optimize - Perform link time optimizations. This will run the scalar
/// optimizations, any loaded plugin-optimization modules, and then the
/// inter-procedural optimizations if applicable.
void Optimize(Module *M) {
// Instantiate the pass manager to organize the passes.
PassManager Passes;
// If we're verifying, start off with a verification pass.
if (VerifyEach)
Passes.add(createVerifierPass());
// Add an appropriate TargetData instance for this module...
#ifdef LLVM_3_1
addPass(Passes, new TargetData(M));
#else
addPass(Passes, new DataLayout(M));
#endif
if (!DisableOptimizations)
PassManagerBuilder().populateLTOPassManager(Passes, !DisableInternalize,
!DisableInline);
// If the -s or -S command line options were specified, strip the symbols out
// of the resulting program to make it smaller. -s and -S are GNU ld options
// that we are supporting; they alias -strip-all and -strip-debug.
if (Strip || StripDebug)
addPass(Passes, createStripSymbolsPass(StripDebug && !Strip));
// Create a new optimization pass for each one specified on the command line
std::auto_ptr<TargetMachine> target;
for (unsigned i = 0; i < OptimizationList.size(); ++i) {
const PassInfo *Opt = OptimizationList[i];
if (Opt->getNormalCtor())
addPass(Passes, Opt->getNormalCtor()());
else
errs() << "llvm-ld: cannot create pass: " << Opt->getPassName()
<< "\n";
}
// The user's passes may leave cruft around. Clean up after them them but
// only if we haven't got DisableOptimizations set
if (!DisableOptimizations) {
addPass(Passes, createInstructionCombiningPass());
addPass(Passes, createCFGSimplificationPass());
addPass(Passes, createAggressiveDCEPass());
addPass(Passes, createGlobalDCEPass());
}
// Make sure everything is still good.
if (!DontVerify)
Passes.add(createVerifierPass());
// Run our queue of passes all at once now, efficiently.
Passes.run(*M);
}
}
This diff is collapsed.
This folder contains the unmodified sources to llvm-ld as it was published in
LLVM, release 3.1.
See http://llvm.org for more info.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment