It there an equivalent to size_t in llvm

2019-04-24 21:06发布

Some system libraries like malloc strlen want or return size_t as parameter.

  • What is the right choice in LLVM IR to interact with these functions?
  • Is the selection the task for the compiler?
  • Does LLVM IR have a size_t type?

标签: c llvm size-t
2条回答
仙女界的扛把子
2楼-- · 2019-04-24 21:48

At the LLVM level, size_t doesn't exist. It is a construct for the benefit of the developer that is typedef'd to a native type. The native types have a fixed size for the target architecture and that is how the compiler represents them in LLVM bit code. So on x86, size_t might by viewed by the front end as unsigned long, which it then writes to LLVM as i32 (since LLVM assembly doesn't have an unsigned type).

查看更多
可以哭但决不认输i
3楼-- · 2019-04-24 21:50

You can use size_t in llvm, it is a valid type to be used as normal.

查看更多
登录 后发表回答