llvm

Install Ruby with Mountain Lion, Xcode 4.5, and RVM?

≡放荡痞女 提交于 2019-12-07 06:42:54
问题 rvm install 1.9.3 --with-gcc=clang (as suggested by Can't install Ruby under Lion with RVM – GCC issues) doesn't work because neither Mac OS X 10.8.2 (Mountain Lion) nor Xcode 4.5 comes with clang . Is it possible to compile Ruby with llvm ? According to Matthias Schmidt's "How to install Ruby 1.9.3 on Mac OS X with LLVM and rbenv", Ruby is now fully compatible with LLVM. But, I still get: error: C compiler cannot create executables UPDATE: Actually, I found clang here /Applications/Xcode.app

Create local string using LLVM

£可爱£侵袭症+ 提交于 2019-12-07 04:49:35
问题 I'm trying to create a local variable using LLVM to store strings, but my code is currently throwing a syntax error. lli: test2.ll:8:23: error: constant expression type mismatch %1 = load [6 x i8]* c"hello\00" My IR code that allocates and store the string: @.string = private constant [4 x i8] c"%s\0A\00" define void @main() { entry: %a = alloca [255 x i8] %0 = bitcast [255 x i8]* %a to i8* %1 = load [6 x i8]* c"hello\00" %2 = bitcast [6 x i8]* %1 to i8* %3 = tail call i8* @strncpy(i8* %0, i8

LLVM and visual studio .obj binary incompatibility

天涯浪子 提交于 2019-12-07 04:24:54
问题 Does anyone know if LLVM binary compatibility is planned for visual studio combiled .obj and static .lib files? Right now I can only link LLVM made .obj files with dynamic libs that loads a DLL at runtime (compiled from visual studio). While there probably is very small chances that binary compatibility will happen between the two compilers, does anybody know why it is so difficult achieving this between compilers for one platform? 回答1: As Neil already said, the compatibility includes stuff

Debug build of Clang built with MinGW on Windows 10 cannot be run

删除回忆录丶 提交于 2019-12-07 03:11:28
问题 I have built Clang with MinGW on Windows with the target triple x86_64-w64-windows-gnu. The executables clang.exe and clang++.exe work as expected if I build them in release mode (they compile programs without error), however when building in debug mode I cannot run them and get this error - "This app can't run on your PC". Other executables from the same build such as clang-check.exe do not display this error and run correctly. It seems as though this could be an issue with the file size as

Translating G-Machine source to LLVM IR

孤者浪人 提交于 2019-12-07 02:48:47
问题 I'm implementing a simple lazy functional language with LLVM as its backend in Haskell. I've read two books written by Simon Peyton Jones ("The implementation of functional programming languages", as well as "Implementing functional languages: the tutorial") and based on that I managed to implement the G-Machine compiler and interpreter. I'm now currently stuck on the problem of generating LLVM IR code from G-Machine instructions. The main problem is that G-Machine is a stack machine whereas

Undefined symbols for architecture x86_64: “std::terminate()”, when building kaleidoscope llvm

房东的猫 提交于 2019-12-07 02:46:26
I'm doing the kaleidoscope tutorial. I'm on step two. https://github.com/westymatt/creole But I get this error when building with clang++ clang++ -Wno-c++11-extensions -g -std=c++11 -I/usr/local/Cellar/llvm/3.6.1/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS src/lexer.cc src/parser.cc -L/usr/local/Cellar/llvm/3.6.1/lib/ -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMProfileData -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMX86Desc -lLLVMObject

Since when does Xcode no longer require forward method declarations and why?

╄→гoц情女王★ 提交于 2019-12-07 02:44:10
问题 I noticed that Xcode (or more precisely the Apple LLVM compiler?) does not longer require forward method declarations. In other words, the following code builds without warnings: @implementation Foo -(void) foo { [self bar]; } -(void) bar {} @end This used to throw a warning in -foo saying that Foo might not respond to -bar , right? Is the compiler smarter now or is this something else? I’m using Xcode 4.3.1 plus Apple LLVM compiler 3.1. 回答1: This has definitely changed, and it looks like

Force Clang to “perform math early” on constant values

蹲街弑〆低调 提交于 2019-12-07 02:28:53
问题 This is related to How to force const propagation through an inline function? Clang has an integrated assembler; and it does not use the system's assembler (which is often GNU AS (GAS)). Non-Clang performed the math early, and everything "just worked". I say "early" because @n.m. objected to describing it as "math performed by the preprocessor." But the idea is the value is known at compile time, and it should be evaluated early, like when the preprocessor evaluates a #if (X % 32 == 0) .

C ABI with LLVM

与世无争的帅哥 提交于 2019-12-06 19:47:47
问题 I've got a compiler written with LLVM and I'm looking to up my ABI compliance. For example, I've found it hard to actually find specification documents for C ABI on Windows x86 or Linux. And the ones I have found explain it in terms of RAX/EAX/etc, rather than IR terms that I can use. So far, I think I've figured that LLVM treats aggregates invisibly- that is, it considers their members as a distinct parameter each. So for example, on Windows x64, if I want to handle an aggregate like the

LLVM error accessing loopinfo in function pass

心不动则不痛 提交于 2019-12-06 19:42:35
I'm trying to get loop information from IR by writing a function pass. So I followed some examples and wrote like following. I'm not very familiar with writing passes and pass managers. #include <iostream> #include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Function.h" #include "llvm/BasicBlock.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Support/IRReader.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Pass.h" #include "llvm/PassManager.h" using