> -----Original Message----- > From: Song, Ruiling > Sent: Friday, February 27, 2015 3:11 PM > To: Gong, Zhigang; beignet@lists.freedesktop.org > Cc: Gong, Zhigang > Subject: RE: [Beignet] [PATCH] GBE: remove constant expression handling code > in gen writer pass. > > > ir::Register GenWriter::getConstantRegister(Constant *c, uint32_t > > elemID) { > > GBE_ASSERT(c != NULL); > > if(isa<GlobalValue>(c)) { > > @@ -1309,15 +1106,6 @@ error: > > return reg; > > } > > > What about put an assert check here? > GBE_ASSERT(!isa<ConstantExpr>(c)); > Other parts looks good to me. There is an assert in the coming newImmediate(), so I think we don’t need to add an extra assert here.
Thanks, Zhigang Gong. > > > - if(isa<ConstantExpr>(c)) { > > - // Check whether this is a constant drived from a pointer. > > - Constant *itC = c; > > - while(isa<ConstantExpr>(itC)) > > - itC = dyn_cast<ConstantExpr>(itC)->getOperand(0); > > - if (itC->getType()->isPointerTy()) > > - return getConstantPointerRegister(dyn_cast<ConstantExpr>(c), > > elemID); > > - } > > - > > const ir::ImmediateIndex immIndex = this->newImmediate(c, elemID); > > const ir::Immediate imm = ctx.getImmediate(immIndex); > > const ir::Register reg = ctx.reg(getFamily(imm.getType())); > > -- > > 1.9.1 > > > > _______________________________________________ > > Beignet mailing list > > Beignet@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/beignet _______________________________________________ Beignet mailing list Beignet@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/beignet