【发布时间】:2015-11-20 13:05:26
【问题描述】:
我对 LLVM 中的并行循环感兴趣,我想在导入 pthread 函数时使用类型生成器。
Pthread_join 有一个相当简单的签名,但 Pthread_create 有签名:
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg);
目前我有:
FunctionType *pthreadJoinTy = TypeBuilder<int(int,void *,void*(void*) (void*),void*),false>::get(C);
M.getOrInsertFunction("pthread_create", pthreadCreateTy);
但是 LLVM 对我构建 pthreadCreateTy 的尝试并不满意。它吐出的三个构建错误是:
错误:“参数”声明为函数返回函数 (void*),void*),false>::get(c);
错误:模板参数的数量错误(1,应该是 2) (void*),void*),false>::get(c);
错误:为“模板类”提供 llvm::TypeBuilder 模板类 类型生成器 {};
此处使用的正确 TypeBuilder 代码是什么?
【问题讨论】:
标签: compiler-construction pthreads llvm compiler-optimization