llvm

Setting disassembly flavour to Intel in LLDB

大兔子大兔子 提交于 2019-12-03 03:47:06
问题 Is there a way to set the disassembly flavour like there is in GDB within LLDB so that it spits out Intel style assembly rather than AT&T style? set disassembly-flavor intel # GDB but for LLDB. 回答1: No, not yet. Intel format disassembly is a feature I'm sure will be implemented eventually, but I don't think anyone is working on it today. UPDATE : the ability to select the assembly style was added to the top of tree sources (v. http://lldb.llvm.org ) March 1st, 2013 with the -F or --flavor

How can I declare a global variable in LLVM?

試著忘記壹切 提交于 2019-12-03 03:23:23
I'd like to record some dynamic behaviors into some global variables. So I wrote a pass to instrument the code and insert some instructions to update the global variable. I tried to use the GlobalVariable constructor to define a global variable, but there are two problems. First, how can I DEFINE the global variables in the module containing main function? Second, how can I DECLARE those global variables in other modules? It's like "extern double someThing;". The target programs are written in C. SK-logic There is a tool which can answer this and many other questions about LLVM API: llc -march

How is clang able to steer C/C++ code optimization?

谁说我不能喝 提交于 2019-12-03 03:12:57
I was told that clang is a driver that works like gcc to do preprocessing, compilation and linkage work. During the compilation and linkage, as far as I know, it's actually llvm that does the optimization ( "-O1", "-O2", "-O3", "-Os", "-flto" ). But I just cannot understand how llvm is involved . It seems that compiling source code doesn't even need a static library such as libLLVMCore.a , instead for debian clang packages depends on another package called libllvm-3.4 (clang version is 3.4), which contains libLLVM-3.4.so(.1) , does clang use this shared library for optimization? I've checked

Is there BNF-like grammar to describe LLVM IR?

痞子三分冷 提交于 2019-12-03 03:10:28
I am wondering that whether there is a BNF-grammar to describe LLVM IR? like C BNF grammar describing C language, etc. There isn't a published BNF grammar, but there is a polygen grammer file which is partially maintained, and used for exactly the purpose of randomly generating inputs to use to test the LLVM IR parser and lexer. You can see the current version of the grammar here: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/llvm.grm?revision=112427&view=markup My parser for LLVM assembly language , written for a YACC-like parser generator, can serve as a BNF definition for the

isKindOfClass doesn't work as expected

99封情书 提交于 2019-12-03 03:04:46
i'm working on a iOS5+ project (xcode 4.4.1 SDK 5.1) i have this code inside a unit test: [_appDelegate application:nil didFinishLaunchingWithOptions:nil]; UITabBarController *tabBarController = (UITabBarController*)_appDelegate.window.rootViewController; NSArray *viewControllers = [tabBarController viewControllers]; UINavigationController *nc_1 = [viewControllers objectAtIndex:0]; UIViewController *vc_1 = nc_1.topViewController; STAssertTrue([vc_1 isKindOfClass:[ScheduleViewController class]]==YES, @"UITabBarController first tab should be a ScheduleViewController class"); If i run the test,

How to create a ConstantInt in LLVM?

匿名 (未验证) 提交于 2019-12-03 02:59:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm not sure how to create a ConstantInt in LLVM- I know the number I would like to create, but I'm unsure how I can make a ConstantInt representing that number; I can't seem to find the constructor I need in the documentation. I'm thinking it has to be along the lines of ConstantInt consVal = new ConstantInt(something here). I know I want it to be an int type, and I know my value... I just want to create a number! 回答1: Most things in LLVM are created through a static method call instead of directly using a constructor. One reason is that an

How to create a ConstantInt in LLVM?

青春壹個敷衍的年華 提交于 2019-12-03 02:58:26
I'm not sure how to create a ConstantInt in LLVM- I know the number I would like to create, but I'm unsure how I can make a ConstantInt representing that number; I can't seem to find the constructor I need in the documentation. I'm thinking it has to be along the lines of ConstantInt consVal = new ConstantInt(something here). I know I want it to be an int type, and I know my value... I just want to create a number! Most things in LLVM are created through a static method call instead of directly using a constructor. One reason is that an existing object can be returned instead of creating a new

Cmake and clang tooling linking error (outside of source tree)

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to compile the RecursiveASTVisitor example of Clang using a CMake file. Building the project goes well, however linking C++ executable fails with multiple undefined reference to LLVM and Clang libraries. I am building the example outside of the LLVM/Clang source file tree. Here is my CMakeLists.txt (I am using FindClang.cmake and FindLLVM.cmake from this project ): cmake_minimum_required(VERSION 2.8.4) project(ifcount) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) message(STATUS "CMAKE

How to install clang pre-built binaries ubuntu 12.04

匿名 (未验证) 提交于 2019-12-03 02:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am very new to linux, and don't know where I need to put Clang pre-built binaries http://llvm.org/releases/download.html#3.3 . I download it, unpack with mouse, and add path to /bin to my $PATH, and path to /lib to $LD_LIBRARY_PATH, and add *.conf with path to my /lib to /etc/ld.so.conf.d . I even reboot my notebook. ...but still cant build my simple program with Code::Blocks GCC (error: /home/aadgrand/tmp/LLVM-3.3/final/llvm.src/lib/Support/Signals.cpp - undefined reference to `dladdr'). Text of the test programm: #include <iostream>

Is it possible to compile LLVM libraries to android/ARM

匿名 (未验证) 提交于 2019-12-03 02:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm fascinated by the Pure algebraic/functional language . The Pure interpreter uses the LLVM JIT compiler as its backend. I would like to compile Pure so that it runs on Android(ARM). Pure has a dependency on the LLVM JIT. So I need to compile LLVM source for Pure to run. Is it possible to compile LLVM source for Android (ARM) devices? There really seems to be no information about this on the web. Maybe my search terms are wrong. Searching for Android LLVM does not bring up many good hits either. 回答1: It now seems possible, the NDK now