打印LLVM::Type或者LLVM::Value的值
来源:互联网 发布:caffe linux cpu 安装 编辑:程序博客网 时间:2024/06/06 18:56
#include "llvm/ADT/STLExtras.h"#include "llvm/IR/Constants.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/Module.h"#include "llvm/IR/Type.h"#include "llvm/Support/Casting.h"#include "llvm/Support/raw_ostream.h"#include <memory>#include "iostream"using namespace llvm;/// Returns the string representation of a llvm::Value* or llvm::Type* template <typename T> static std::string Print(T* value_or_type) { std::string str; llvm::raw_string_ostream stream(str); value_or_type->print(stream); return str;}int main() { LLVMContext Context; // Create some module to put our function into it. std::unique_ptr<Module> Owner = make_unique<Module>("test", Context); Module *mod = Owner.get(); /* //param numBits the bit width of the constructed APInt //param str the string to be interpreted //param radix the radix to use for the conversion APInt(unsigned numBits, StringRef str, uint8_t radix); //ConstantInt int type constant */ ConstantInt* const_int32_one = ConstantInt::get(mod->getContext(), APInt(32, StringRef("1"), 10)); std::string result = Print(const_int32_one); std::cout << result << std::endl; return 0;}
0 0
- 打印LLVM::Type或者LLVM::Value的值
- LLVM
- LLVM
- llvm
- LLVM
- LLVM
- LLVM
- LLVM
- LLVM
- LLVM
- LLVM (4) 11.3 LLVM的代码表示:LLVM IR
- LLVM教程(一)-- LLVM的简介
- LLVM教程(二)-- LLVM的安装
- LLVM的源代码调试
- LLVM每日谈之六 LLVM的源码结构
- LLVM每日谈之九 谈LLVM的学习
- Apple LLVM compiler 4.2 与LLVM GCC的区别
- LLVM每日谈之十五 LLVM自带的examples
- Android 系列 4.3使用附件发送电子邮件
- iOS中的颜色
- 将PHP C++扩展从php5升级到php7
- Android Studio官方文档:如何构建简单的用户界面
- PkgUtils(用于获取版本名称和版本号)
- 打印LLVM::Type或者LLVM::Value的值
- 利用Redis实现限制一个用户只能在一个地点登陆
- Aerospike数据库实战(二) -- 哪种SSD产品更适合Aerospike (Intel DC s3500 SSD VS Fusion ioDrive PCIe )
- C程序设计语言- 结构-5.1----结构的基本知识、结构与函数、结构数组、指向结构的指针
- Android之TelephonyManager类的方法详解
- Linux 格式化分区 报错Could not stat --- No such file or directory 和 partprobe 命令
- Mybatis常见问题
- 从一个复数点积算法看NEON的汇编优化(NEON优化实例)
- 数据库连接池的实现及分析