Allow TableGen to generate static functions to perform GCC/MS builtin name to
target specific intrinsic ID mapping.
Details
- Reviewers
rnk
Diff Detail
- Repository
- rL LLVM
Event Timeline
This patch would allows backend to make use of the builtin-to-intrinsic mapping function if requested. In the case no builtin names are associated with intrinsics, the builtin-to-instrinsic table is not emitted to avoid warnings about zero-length arrays.
The use case is a module which contains function calls a particular backend would like to lower into intrinsic calls. Enabling the builtin-to-intrinsics map would allow to automate a little bit that process.
I mean an example target-specific builtin that you need to map.
Sorry, I misunderstood your question.
My use case is related to languages where there are a lot of functions which can be lowered into intrinsics calls by backends. For instance in OpenCL there are a set of functions that allow to query the property of the NDRange. For instance the size_t get_global_size(uint x) function allows to get the number of work items along the x dimension:
size_t foo() { return get_global_size(1); }
This is the code generated by clang:
define i64 @foo() local_unnamed_addr #0 { entry: %call = tail call i64 @get_global_size(i32 1) #2 ret i64 %call }
Backend for architectures supporting this kind of languages often exposes intrinsics to access those informations, hence I would like to use the builtin-to-intrinsic map to rewrite the call to get_global_size to the call to a target-specify intrinsic before starting the final code generation.
In my case, the backend I'm working on is not upstream, so I cannot give you an example only using upstream code.
Quentin/Reid could you please commit this one if there are no objections? (I do not have commits rights).