[Beignet] [PATCH 1/3] GBE: fix multiple files compilation bugs.
He Junyan
junyan.he at inbox.com
Fri Sep 12 01:39:19 PDT 2014
The patchset is OK
On 五, 2014-09-12 at 14:33 +0800, Zhigang Gong wrote:
> If we want to link multiple files together, and one kernel
> function need refer other kernel functions in other files,
> we must not set those functions as linked once attribute.
>
> Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
> ---
> backend/src/backend/gen_program.cpp | 4 +++-
> backend/src/llvm/llvm_to_gen.cpp | 5 +++--
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/backend/src/backend/gen_program.cpp b/backend/src/backend/gen_program.cpp
> index 3e16fd6..5324587 100644
> --- a/backend/src/backend/gen_program.cpp
> +++ b/backend/src/backend/gen_program.cpp
> @@ -56,6 +56,7 @@
> #include "backend/gen_reg_allocation.hpp"
> #include "ir/unit.hpp"
> #include "llvm/llvm_to_gen.hpp"
> +#include "llvm/llvm_gen_backend.hpp"
>
> #include <clang/CodeGen/CodeGenAction.h>
>
> @@ -371,9 +372,10 @@ namespace gbe {
> }
>
> for (llvm::Module::iterator I = src->begin(), E = src->end(); I != E; ++I) {
> + llvm::Function *F = llvm::dyn_cast<llvm::Function>(I);
> + if (F && isKernelFunction(*F)) continue;
> I->setLinkage(llvm::GlobalValue::LinkOnceAnyLinkage);
> }
> -
> llvm::Module* dst = (llvm::Module*)((GenProgram*)dst_program)->module;
> llvm::Linker::LinkModules( dst,
> src,
> diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp
> index 755793e..3cb0e5b 100644
> --- a/backend/src/llvm/llvm_to_gen.cpp
> +++ b/backend/src/llvm/llvm_to_gen.cpp
> @@ -86,10 +86,11 @@ namespace gbe
> FPM.add(new DataLayout(DL));
> #endif
>
> + // XXX remove the verifier pass to workaround a non-fatal error.
> #if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >=5
> - FPM.add(createVerifierPass(true));
> + //FPM.add(createVerifierPass(true));
> #else
> - FPM.add(createVerifierPass());
> + //FPM.add(createVerifierPass());
> #endif
> FPM.add(new TargetLibraryInfo(*libraryInfo));
> FPM.add(createTypeBasedAliasAnalysisPass());
More information about the Beignet
mailing list