On 16 November 2012 18:17, James Molloy <[email protected]> wrote: > The attached patch implements a simple extra API function to retrieve an > Instruction* equivalent for a ConstantExpr. With this addition, dealing > with the constraints imposed by SPIR is actually possible without > horrible hackery...
A ConstantExpr *is* a Value, so the wrapper you did bypasses the hierarchy (possibly broken), but is also disconnected from the API, which means when either side change, you might forget to change this bridge and get away with it. Having said that, I don't think the consequences of forgetting to update this code is drastic (I can't see why it'd do anything other than assert at compile time), but since there is already a connection between ConstantExpr and Value, I think it's a cheap trick. Have you thought about adding constructors for the Instructions passing ConstantExpr references? That might be used automatically by the compiler as a casting match, which will be even neater. -- cheers, --renato http://systemcall.org/ _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
