llvm

Incorrect result in LLVM Alias Analysis

我们两清 提交于 2019-12-24 02:16:08
问题 I want to check if the values a and b in the program alias. int main() { int *a,*b; a=(int *)malloc(sizeof(int)); b=(int *)malloc(sizeof(int)); *a=10; *b=8; return 0; } I use the below code for this (getAnalysisUsage method has been defined) AliasAnalysis::Location loc1=AliasAnalysis::Location(k1); //a AliasAnalysis::Location loc2=AliasAnalysis::Location(k2); //b AliasAnalysis::AliasResult ar=AA.alias(loc1,loc2); But I get ar=1 i.e May Alias result. Where am I going wrong? I have included

how to perform TargetLowering in a IR-trasformation pass?

橙三吉。 提交于 2019-12-24 01:54:42
问题 To provide TLS support to orcjit, I'm like to transforom llvm::Modules without TLS emulation to ones that emulateTLS and depend on a Runtime. Similar functionality is already implemented in TargetLowering::LowerToTLSEmulatedModel , however it does not operate on IR. So, how can i implement and perform this operation as an llvm::Pass ? 来源: https://stackoverflow.com/questions/42163796/how-to-perform-targetlowering-in-a-ir-trasformation-pass

Clang Cross Compiling for Windows Phone ARM target

扶醉桌前 提交于 2019-12-24 01:47:31
问题 I would like to compile a program written in C using Clang for 'Windows Phone' ARM target. Does anyone have experience with it? What is a better approach? 1) Building on a host running Windows 8 using Clang for Windows and MinGW. Does Clang for Windows / MinGW supports ARM by default? If not, I will need to re-build Clang and MinGW? 2) Building on a Linux/MAC host (where ARM target comes as default) and using Windows Phone toolchain (where can I get it?). Thanks in advance! 回答1: There is no

clang 4.0 fails to build clang 3.42 on ubuntu 17.04

烈酒焚心 提交于 2019-12-24 00:30:05
问题 I have posted my failures of building llvm 3.42 with gcc6.3 here and here. I am posting separately the failure of clang 4.0 to build llvm 3.42 from source as these are somewhat different developers communities. Here is the script I've used: svn co https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_342/final llvm svn co https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_342/final llvm/tools/clang svn co https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_342/final llvm/projects

LLVM 3.0 compiler error: cast of C pointer type to Objective-C pointer type 'id' requires a bridged cast

梦想与她 提交于 2019-12-23 23:47:00
问题 I am trying to compile old iPhone application project using new LLVM 3.0 compiler. I am getting this error: Automatic Reference Counting Issue: cast of C pointer type 'CGColorRef' (aka 'struct CGColor *') to Objective-C pointer type 'id' requires a bridged cast [4] for code: UIColor *color1, *color2, *color3, *color4; .... NSArray *colors = [NSArray arrayWithObjects:(id)color1.CGColor, color2.CGColor, color3.CGColor, nil]; This code compiles without problems in older LLVM GCC 4.2 compiler.

Append a copy of std::vector to the end of itself [duplicate]

拟墨画扇 提交于 2019-12-23 20:53:13
问题 This question already has answers here : Nice way to append a vector to itself (4 answers) Closed 5 years ago . I am trying to make a copy of a vector of string and append it to the end of its original vector, i.e. duplicating its contents. Example: Input : vector<string> s = {"abc", "def"} Output: vector<string> s = {"abc", "def", "abc", "def"} I was using the insert method, i.e. s.insert(s.end(), s.begin(), s.end()); However, this exhibits compiler-dependent results. In, LLVM clang, it gave

Link problems with libc++abi when linking against libc++ via cmake

吃可爱长大的小学妹 提交于 2019-12-23 20:24:40
问题 I'm trying to build a simple ("hello world") C++ program with LLVM/Clang 3.7.0 built from sources against the toolchain's libc++ , with the command line: clang++ -std=c++14 -stdlib=libc++ -fno-exceptions hello.cpp However, I get the following errors: /usr/bin/ld: warning: libc++abi.so.1, needed by /bulk/workbench/llvm/3.7.0 /toolchain4/bin/../lib/libc++.so, not found (try using -rpath or -rpath-link) /bulk/workbench/llvm/3.7.0/toolchain4/bin/../lib/libc++.so: undefined reference to `__cxa

LLVM MinGW installation on Vista?

非 Y 不嫁゛ 提交于 2019-12-23 20:02:02
问题 From llvm.org I've downloaded llvm-2.6-x86-mingw32.tar.bz2 into c:\llvm and llvm-gcc-4.2-2.6-x86-mingw32-tar.bz2 into c:\llvm-gcc as well as setup a desktop shortcut the following batch file in c:\llvm-gcc which attempts to setup an environment for compiling via the llvm-gcc command line too: @echo off color 0E echo Configuring LLVM environment... set LLVM_LIB_SEARCH_PATH=%~dp0lib set PATH=c:\llvm;%~dp0bin;%PATH% Unfortunately, this setup gives the following error when trying to compile a

学习编写编译器[关闭]

谁说胖子不能爱 提交于 2019-12-23 19:45:30
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 首选语言 :C / C ++,Java和Ruby。 我正在寻找一些有用的书籍/教程,以了解如何仅出于教育目的编写自己的编译器。 我最熟悉C / C ++,Java和Ruby,因此我更喜欢涉及这三种资源之一的资源,但是任何好的资源都是可以接受的。 #1楼 这是一个广阔的主题。 不要小看这一点。 并且不要低估我的观点,不要低估它。 我听说《 龙书》 是一个(“?”)学习的起点。 :)善于搜索,最终将成为您的生活。 构建自己的编程语言绝对是一个好练习! 但是要知道,最终它永远不会用于任何实际目的。 例外情况很少, 而且 相差 很 远。 #2楼 您可能想要研究Lex / Yacc(或Flex / Bison,无论您想称呼它们如何)。 Flex是一个词法分析器,它将分析和识别您语言的语义成分(“令牌”),而Bison将用于定义解析每个令牌时发生的情况。 对于可以编译为C的编译器或动态运行指令,这可能是但绝对不限于打印C代码。 该常见问题解答 应为您提供帮助, 本教程 看起来非常有用。 #3楼 我认为这是一个非常模糊的问题。 只是因为涉及的话题很深。 但是,编译器可以分解为两个独立的部分。 上半部分和下半部分。 上半部通常采用源语言并将其转换为中间表示,下半部负责平台特定的代码生成。 尽管如此

LLVM-5.0 Makefile undefined reference fail

我是研究僧i 提交于 2019-12-23 17:17:46
问题 Including the following statement in my code main_module->dump(); // main_module is of type llvm::Module* causes the following linker error: undefined reference to 'llvm::Module::dump() const' The dump method resides in /usr/lib/llvm-5.0/include/llvm/IR/Module.h I checked stack overflow (Using llvm::Function::dump(), linker gives "undefined reference to `llvm::Value::dump() const'"), and it seems we get this error when the linker isn't fed the libraries in correct order. However, I clearly