【问题标题】:Create functions in llvm pass with arguments and return type of type uint32_t and long double在 llvm 中创建函数传递参数和返回类型 uint32_t 和 long double
【发布时间】:2017-03-05 19:50:39
【问题描述】:

有没有办法创建一个返回类型和参数为 uint32_t 和 long double 的函数? 例如,我们可以创建 int 类型的参数,如下所示:

 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 &amp;C, unsigned AS=0)

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

【问题讨论】:

    标签: llvm llvm-clang llvm-gcc


    【解决方案1】:

    在 LLVM IR 中,所有类型都以类型和位数表示。一旦它们被编译,它们就会丢失签名和未签名的信息。因此,一旦将 C 代码编译为 LLVM IR,像 uint32_t 这样的类型将变为 i32long double 将变为 x86_fp80,因为它是 80 位浮点格式。以下是有关types 的一些信息。我认为您可以将function 用于long double。至于uint32_t,可以使用this函数。

    【讨论】:

      猜你喜欢
      • 2020-09-21
      • 1970-01-01
      • 2013-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-17
      相关资源
      最近更新 更多