[Beignet] [PATCH] [PATCH]Fix compile errors for CLANG compiler
Lv, Meng
meng.lv at intel.com
Thu Aug 7 17:58:07 PDT 2014
HI, the vector would also have problem, in the following function "sel.READ64(tmpAddr, dst, valueNum, bti.bti[0]);", we need pass down the data pointer "dst" to READ64 function. The data in vector may not be continuous.
,
-----Original Message-----
From: Zou, Nanhai
Sent: Thursday, August 07, 2014 3:59 PM
To: Zou, Nanhai; Song, Ruiling; Lv, Meng; beignet at lists.freedesktop.org
Cc: Lv, Meng
Subject: RE: [Beignet] [PATCH] [PATCH]Fix compile errors for CLANG compiler
The previous patch was wrong.
With static_cast, constructor of each elements in dst was bypassed.
This will leave random initial value in GenRegister.
So please use std::vector
Thanks
Zou Nanhai
-----Original Message-----
From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Zou, Nanhai
Sent: Thursday, August 07, 2014 3:40 PM
To: Song, Ruiling; Lv, Meng; beignet at lists.freedesktop.org
Cc: Lv, Meng
Subject: Re: [Beignet] [PATCH] [PATCH]Fix compile errors for CLANG compiler
Replace those with something like
vector<GenRegister> dst[valueNum];
would be better.
Thanks
Zou Nanhai
-----Original Message-----
From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Song, Ruiling
Sent: Thursday, August 07, 2014 3:30 PM
To: Lv, Meng; beignet at lists.freedesktop.org
Cc: Lv, Meng
Subject: Re: [Beignet] [PATCH] [PATCH]Fix compile errors for CLANG compiler
The patch LGTM.
Ruiling
-----Original Message-----
From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Lv Meng
Sent: Wednesday, August 06, 2014 10:31 AM
To: beignet at lists.freedesktop.org
Cc: Lv, Meng
Subject: [Beignet] [PATCH] [PATCH]Fix compile errors for CLANG compiler
this patch would fix variable length array of non-POD element type error for CLANG compiler.
Signed-off-by: Lv Meng <meng.lv at intel.com>
---
backend/src/backend/gen_insn_selection.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
index 090f897..39f5141 100644
--- a/backend/src/backend/gen_insn_selection.cpp
+++ b/backend/src/backend/gen_insn_selection.cpp
@@ -2799,7 +2799,7 @@ namespace gbe
/* XXX support scalar only right now. */
GBE_ASSERT(valueNum == 1);
GBE_ASSERT(bti.count == 1);
- GenRegister dst[valueNum];
+ GenRegister *dst = static_cast<GenRegister
+ *>(alloca(sizeof(GenRegister) * valueNum));
GenRegister tmpAddr = getRelativeAddress(sel, addr, insn.getAddressSpace(), bti.bti[0]);
for ( uint32_t dstID = 0; dstID < valueNum; ++dstID)
dst[dstID] = sel.selReg(insn.getValue(dstID), ir::TYPE_U64); @@ -2999,7 +2999,7 @@ namespace gbe
/* XXX support scalar only right now. */
GBE_ASSERT(valueNum == 1);
addr = GenRegister::retype(addr, GEN_TYPE_UD);
- GenRegister src[valueNum];
+ GenRegister *src = static_cast<GenRegister
+ *>(alloca(sizeof(GenRegister) * valueNum));
for (uint32_t valueID = 0; valueID < valueNum; ++valueID)
src[valueID] = sel.selReg(insn.getValue(valueID), ir::TYPE_U64); @@ -3710,11 +3710,10 @@ namespace gbe
{
using namespace ir;
GenRegister msgPayloads[4];
- GenRegister dst[insn.getDstNum()];
uint32_t srcNum = insn.getSrcNum();
uint32_t valueID = 0;
uint32_t msgLen = 0;
-
+ GenRegister *dst = static_cast<GenRegister
+ *>(alloca(sizeof(GenRegister) * insn.getDstNum()));
for (valueID = 0; valueID < insn.getDstNum(); ++valueID)
dst[valueID] = sel.selReg(insn.getDst(valueID), insn.getDstType());
--
1.8.3.2
_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet
_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet
_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list