Fix for bad host code generation for CTarget and more cleanup
Sorry for the continued minor updates (hopefully this will be the last of them!)
This PR does two things:
- Only return a (non-
DummyHost
)CASTBuilder
in theExecutableCTarget
-- this fixes host-code being generated for targets it has no business in doing so, e.g., for theOpenCLTarget
- Change
get_function_definition
in theCASTBuilder
such that global temporaries are only included in the function definition for device code -- currently, it would place the same temporary in both host and device code leading to a compilation error -- to that end, I've included a test that checks for this. - Some more minor cleanup (6c7648ab, 2bc2dc14, 70dc2d63)
AFAIK, # 2 only affects CTarget
, ExecutableCTarget
and the ISPCTarget
, as all other targets define their own get_function_definition
-- and all of these should only define global temporaries once (at the first device program)
I think this is a reasonable update, but I'm just starting to feel more confident in my understanding of host-code generation, so please point out any better ways to do this or other issues!
Nick
Edited by Nick Curtis