2017-03-05 29 views
1

是否有任何方法创建一个返回类型和参数为uint32_t和long double的函数? 例如,我们可以创建int类型的参数,如下所示:在llvm pass中创建函数,参数类型为uint32_t,返回类型为double double

std::vector<Type*>FuncTy_args; 
FuncTy_args.push_back(IntegerType::get(M.getContext(), 32)); 

在LLVM链路, http://llvm.org/docs/doxygen/html/classllvm_1_1Type.html。我只能看到

static PointerType * getInt32PtrTy (LLVMContext &C, unsigned AS=0)

static PointerType * getDoublePtrTy (LLVMContext &C, unsigned AS=0) 

回答

1

在LLVM IR,所有类型在类型和比特数来表示。一旦编译完成,就会丢失已签名和未签名的信息。因此,一旦将C代码编译为LLVM IR,类似于uint32_t的类型将变为i32long double将变为x86_fp80,因为它是80位浮动格式。这里有一些关于types的信息。我想你可以用这个function代替long double。至于uint32_t,可以使用this函数。

相关问题