[Beignet] [PATCH] Fix compile error when use llvm-3.1
Weng, Chuanbo
chuanbo.weng at intel.com
Fri May 3 00:57:30 PDT 2013
Ok. I'll modify and resend it.
-----Original Message-----
From: Zhigang Gong [mailto:zhigang.gong at linux.intel.com]
Sent: Friday, May 03, 2013 3:54 PM
To: Weng, Chuanbo
Cc: beignet at lists.freedesktop.org; Weng, Chuanbo
Subject: Re: [Beignet] [PATCH] Fix compile error when use llvm-3.1
Thanks for the patch, please see my comments as below:
On Fri, May 03, 2013 at 11:05:17PM +0800, Chuanbo Weng wrote:
> From: Chuanbo Weng <chuanbo.weng at intel.com>
>
> DataLayout.h only exist in llvm-3.2. InstVisitor.h is also contained
> in 'Support' directory even in llvm-3.1 and 3.0. argID and PAL is
> needed in llvm-3.1. After applying this patch, beignet can build
> successfully and all test cases can run successfully using llvm-3.1.
> ---
> backend/src/llvm/llvm_gen_backend.cpp | 13 +++++++++----
> backend/src/llvm/llvm_passes.cpp | 6 ++----
> 2 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/backend/src/llvm/llvm_gen_backend.cpp
> b/backend/src/llvm/llvm_gen_backend.cpp
> index 637e7be..e9e92e5 100644
> --- a/backend/src/llvm/llvm_gen_backend.cpp
> +++ b/backend/src/llvm/llvm_gen_backend.cpp
> @@ -102,17 +102,15 @@
> #if !defined(LLVM_VERSION_MAJOR) || (LLVM_VERSION_MINOR == 1)
> #include "llvm/Target/TargetData.h"
> #endif
> +#if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR == 2)
> #include "llvm/DataLayout.h"
> +#endif
> #include "llvm/Support/CallSite.h"
> #include "llvm/Support/CFG.h"
> #include "llvm/Support/ErrorHandling.h"
> #include "llvm/Support/FormattedStream.h"
> #include "llvm/Support/GetElementPtrTypeIterator.h"
> -#ifdef LLVM_32
> #include "llvm/Support/InstVisitor.h"
> -#else
> -#include "llvm/InstVisitor.h"
> -#endif
IIRC the header file InstVisitor.h is at llvm/InstVisitor.h for the 3.3svn version.
You may need to change it to as below:
#if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR <= 2) #include "llvm/Support/InstVisitor.h"
#else
#include "llvm/InstVisitor.h"
#endif
> #include "llvm/Support/MathExtras.h"
> #include "llvm/Support/TargetRegistry.h"
> #include "llvm/Support/Host.h"
> @@ -869,7 +867,13 @@ namespace gbe
> Function::arg_iterator I = F.arg_begin(), E = F.arg_end();
>
> // Insert a new register for each function argument
> +#if LLVM_VERSION_MINOR <= 1
> + const AttrListPtr &PAL = F.getAttributes();
> + uint32_t argID = 1; // Start at one actually
> + for (; I != E; ++I, ++argID) {
> +#else
> for (; I != E; ++I) {
> +#endif /* LLVM_VERSION_MINOR <= 1 */
> const std::string &argName = I->getName().str();
> Type *type = I->getType();
> GBE_ASSERTM(isScalarType(type) == true, @@ -882,6 +886,7 @@
> namespace gbe
> // By value structure
> #if LLVM_VERSION_MINOR <= 1
> if (PAL.paramHasAttr(argID, Attribute::ByVal)) {
> +
> + //if(PAL.getParamAttributes(argID).hasAttribute(Attributes::ByVal))
> + {
Why add one comment line here?
> #else
> if (I->hasByValAttr()) {
> #endif /* LLVM_VERSION_MINOR <= 1 */
> diff --git a/backend/src/llvm/llvm_passes.cpp
> b/backend/src/llvm/llvm_passes.cpp
> index 1a7a658..2cd2375 100644
> --- a/backend/src/llvm/llvm_passes.cpp
> +++ b/backend/src/llvm/llvm_passes.cpp
> @@ -61,17 +61,15 @@
> #if !defined(LLVM_VERSION_MAJOR) || (LLVM_VERSION_MINOR == 1)
> #include "llvm/Target/TargetData.h"
> #endif
> +#if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR == 2)
> #include "llvm/DataLayout.h"
> +#endif
> #include "llvm/Support/CallSite.h"
> #include "llvm/Support/CFG.h"
> #include "llvm/Support/ErrorHandling.h"
> #include "llvm/Support/FormattedStream.h"
> #include "llvm/Support/GetElementPtrTypeIterator.h"
> -#ifdef LLVM_32
> #include "llvm/Support/InstVisitor.h"
> -#else
> -#include "llvm/InstVisitor.h"
> -#endif
The same as my first comment.
> #include "llvm/Support/MathExtras.h"
> #include "llvm/Support/TargetRegistry.h"
> #include "llvm/Support/Host.h"
> --
> 1.7.9.5
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list