llvm

How to tell Clang to stop pretending to be other compilers?

偶尔善良 提交于 2019-11-28 03:20:23
问题 I've run into this issue in the past: LLVM defines __GNUC__, but it can't consume a program GCC can. I'm experiencing it again on Windows: LLVM defines _MSC_VER, but it can't consume the same program VC++ can. The aggravating thing (for me) is we have specialized code paths for LLVM Clang and Apple Clang (different defines due to different version schemes), and we have to fight with the tool to get it to use them. How do we tell Clang to stop pretending to be other compilers? Is there a

Literal @YES not working in iOS 5 / Xcode 4.4

偶尔善良 提交于 2019-11-28 03:18:28
问题 New Xcode 4.4 is out and it should support literals like @42 @"String" @23.0L @{ @"key" : obj } and @[obj1, obj2] and it should also support @YES and @NO , which isn't working when targeting latest iOS 5 (and prior). After compiling it show the error message: Unexpected type name 'BOOL': expected expression I know you can fix it by typing @(YES) and @(NO) . But I want to know the reason why it isn't working as expected. 回答1: The reason is Apple forgot the parentheses here: #define YES (BOOL)1

clang: how to list supported target architectures?

二次信任 提交于 2019-11-28 02:56:50
Currently I am interested in ARM in general and specifically iphone/android targets. But I just want to know more about clang, since it feels to play important role in the years to come. I tried clang -cc1 --help|grep -i list clang -cc1 --help|grep arch|grep -v search clang -cc1 --help|grep target -triple <value> Specify target triple (e.g. i686-apple-darwin9) I know clang has -triplet parameter, but how can I list all possible values for it? I found that clang is very different to gcc in respect to cross compiling, in GCC world you should have separate binary for everything, like PLATFORM

What exactly is LLVM?

淺唱寂寞╮ 提交于 2019-11-28 02:30:58
I keep hearing about LLVM all the time. It's in Perl, then it's in Haskell, then someone uses it in some other language? What is it? LiraNuna LLVM is a library that is used to construct, optimize and produce intermediate and/or binary machine code. LLVM can be used as a compiler framework, where you provide the "front end" (parser and lexer) and the "back end" (code that converts LLVM's representation to actual machine code). LLVM can also act as a JIT compiler - it has support for x86/x86_64 and PPC/PPC64 assembly generation with fast code optimizations aimed for compilation speed. If you're

Is there any way to use LLVM 3 in Xcode 4.1?

蹲街弑〆低调 提交于 2019-11-28 02:05:47
I wonder, since LLVM 3.0 is readily available and officially released, is there a way to compile with LLVM 3 when using Xcode 4.1. It would help alot since I used ARC and my app development turned out to be finished sooner than planned. So I don't have to wait until next Xcode 4.2 is released to upload my app to Apple review. Thanks You can easily compile with any compiler you want with Xcode; see http://mattrajca.com/post/8749868513/llvm-code-coverage-and-xcode-4 , for example. IIRC, you aren't allowed to submit an app that isn't using a compiler bundled with an official Xcode release, though

Is my book's discussion of lambda return types wrong?

落花浮王杯 提交于 2019-11-28 01:49:44
My book says this: Lambdas with function bodies that contain anything other than a single return statement that do not specify a return type return void. but this: auto f = []{ int i=0; i++; return std::string("foo"); }; std::cout << f() << std::endl; actually compiles and prints out "foo", but that lambda expr has more than just a single return statement so it should return void, because it does not manually specify "-> std::string" as a return type. What's going on here? I'm using Apple's compiler in the latest Xcode 4.6, based on Clang 3.2 it seems: clang --version Apple LLVM version 4.2

ollvm 新增字符串加密功能

牧云@^-^@ 提交于 2019-11-28 01:43:15
好久没弄ollvm了,可以继续了,今天给ollvm新增了一个pass,用来加密字符串,这个pass是从别的库里面扒出来的。 本文是基于在Windows 上使用VS2017编译出来的ollvm,在这个基础上来添加。 第一步: 寻找两个pass的代码 头文件 1 #ifndef _STRING_OBFUSCATION_H_ 2 #define _STRING_OBFUSCATION_H_ 3 4 5 // LLVM include 6 #include "llvm/Pass.h" 7 #include "llvm/IR/Function.h" 8 #include "llvm/IR/Instructions.h" 9 #include "llvm/ADT/Statistic.h" 10 #include "llvm/Transforms/IPO.h" 11 #include "llvm/IR/Module.h" 12 #include "llvm/Support/CommandLine.h" 13 #include "llvm/CryptoUtils.h" 14 15 // Namespace 16 using namespace llvm; 17 using namespace std; 18 19 namespace llvm { 20 Pass

XLA

久未见 提交于 2019-11-28 00:34:52
原 TensorFlow技术内幕(七):模型优化之XLA(上) 2018年06月13日 14:53:49 jony0917 阅读数 5513 版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。 本文链接: https://blog.csdn.net/gaofeipaopaotang/article/details/80679100 本章中我们分析一下TensorFlow的XLA(Accelerated Linear Algebra 加速线性代数)的内核实现。代码位置在tensorflow/compiler. XLA 在XLA技术之前,TensorFlow中计算图的执行是由runtime(运行时)代码驱动的:runtime负责加载计算图定义、创建计算图、计算图分区、计算图优化、分配设备、管理节点间的依赖并调度节点kernel的执行;计算图是数据部分,runtime是代码部分。在第五章session类的实现分析中,我们已经比较详细的分析了这个过程。在XLA出现之后,我们有了另一个选择,计算图现在可以直接被编译成目标平台的可执行代码,可以直接执行,不需要runtime代码的参与了。 本章我就来分析一下XLA是如何将tensorflow.GraphDef编译成可执行代码的。 目前XLA提供了AOT(提前编译)和JIT(即时编译)两种方式

Trouble disabling LLVM optimizations via pragma

有些话、适合烂在心里 提交于 2019-11-28 00:17:51
问题 I have a chunk of code that crashes unless I build with optimizations off. I'm building with LLVM compiler 2.0 I would like to turn off optimizations by wrapping the offending code with a #pragma compiler directive; or turn off optimizations for an entire file. I've been digging in the clang manual and code; but nothing jumps out at me. Does anyone know how to change the optimizations for a single CU (as opposed to for the entire app)? 回答1: You can set per-file compiler flags in Xcode. In

Where to find the optimization sequence for clang -OX?

独自空忆成欢 提交于 2019-11-28 00:10:38
Where can I find the sequence of optimizations used by clang according to -OX? clang executes the precisely same sequence of passes as opt -ON. So, you can do something like llvm-as < /dev/null | opt -O3 -disable-output -debug-pass=Arguments to derive the "full" set of passes which are run at O3. 来源: https://stackoverflow.com/questions/7796151/where-to-find-the-optimization-sequence-for-clang-ox