llvm-3.0

llvm: strategies to build JIT content incrementally

微笑、不失礼 提交于 2020-01-24 00:59:07
问题 I want my language backend to build functions and types incrementally but don't pollute the main module and context when functions and types fail to build successfully (due to problems with the user input). I ask an earlier question regarding this. One strategy i can see for this would be building everything in temp module and LLVMContext , migrating to main context only after success, but i am not sure if that is possible with the current API. For instance, i wouldn't know know to migrate

LLVM IR: How to call a function in another .ll file

我是研究僧i 提交于 2020-01-17 06:09:26
问题 I am writing LLVM IR code, can I call a function in another .ll file? For example: In a.ll file, there is a function foo(); Can I use this function in b.ll, like just call foo? If so, how can I include a.ll Thanks 回答1: You need to add declaration of function foo in the ll file in which you are calling it, then as usual convert link ll files to generate executable llvm-link a.ll b.ll -o a.out example a.ll declare i32 @foo(i32) define i32 @main() { start: %0 = call i32 @foo(i32 0) ret i32 %0 }

use and meaning of DW_AT_location

瘦欲@ 提交于 2020-01-16 05:26:32
问题 I wanted to know the use of the attribute DW_AT_location for debugging. It is one of the attributes specified by dwarf for debugging, but could not really understand what exactly it represents. And also when should this attribute be emitted when we compile a code. 回答1: From the DWARF 3 spec (http://dwarfstd.org/doc/Dwarf3.pdf): 2.16 Data Locations Any debugging information entry describing a data object, which includes variables, parameters, common blocks and the like, may have a DW_AT

LLVM String Value objects: How can I retrieve the String from a Value?

笑着哭i 提交于 2020-01-12 14:21:10
问题 When building the IR from an existing AST, my AST has some string values (at compile-time they are built from std::string ) and I want to set them safely as llvm::Value to use as a part of an expression. In this case, I don't need to bind the string at run-time, because string values are only meant to resolve stuff as variables, functions or classes at compile-time (the language doesn't support a native string type). Whats the best way to keep my string content as llvm::Value and still be

llvm: is it possible to merge validation and compilation in a single stage?

旧城冷巷雨未停 提交于 2019-12-12 02:49:08
问题 Generally speaking, when writing a llvm frontend, one will take an AST and first check that its semantics is well-defined. After this, one will take the AST and perform the IR build phase. I was wondering, how realistic is to perform directly the IR build phase onto the AST, and if errors are found during the build process, revert any partial changes to the module object? I assume something like this would be required: remove defined Types remove defined Globals anything else i'm missing? Any

Add LLVM to project using cmake

社会主义新天地 提交于 2019-12-11 02:07:59
问题 I'm trying to add LLVM to a cmake project, using cygwin as a compiler. I downloaded LLVM from cygwin's installer (just installed all of the llvm related packages). The files are there, however I cannot include LLVM in my project. I tried using the official guide for 3.5.2 (the version it installed) and my CMakeLists.txt looks like cmake_minimum_required(VERSION 3.2) project(Lang) find_package(LLVM REQUIRED CONFIG) message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") message(STATUS "Using

xcode - “attempt to use a deleted function” - what does that mean?

孤街醉人 提交于 2019-12-04 03:28:42
问题 I am writing a C++ library in Xcode 4.2 One of my classes won't compile with this error : "attempt to use a deleted function". There is no specific indication what function it's talking about. I don't want to post the class code here, but does anybody have any idea what this error means? It's nowhere to be found on Google... :( thanks a bunch Roey 回答1: In C++11 you can declare functions as deleted: struct Foo { Foo(const Foo &) = delete; }; Attempting to use such a function is an error. The

LLVM String Value objects: How can I retrieve the String from a Value?

给你一囗甜甜゛ 提交于 2019-12-04 02:19:26
When building the IR from an existing AST, my AST has some string values (at compile-time they are built from std::string ) and I want to set them safely as llvm::Value to use as a part of an expression. In this case, I don't need to bind the string at run-time, because string values are only meant to resolve stuff as variables, functions or classes at compile-time (the language doesn't support a native string type). Whats the best way to keep my string content as llvm::Value and still be able to retrieve it at later stages of compilation (when the nesting expressions are built)? More

xcode - “attempt to use a deleted function” - what does that mean?

拥有回忆 提交于 2019-12-01 19:06:42
I am writing a C++ library in Xcode 4.2 One of my classes won't compile with this error : "attempt to use a deleted function". There is no specific indication what function it's talking about. I don't want to post the class code here, but does anybody have any idea what this error means? It's nowhere to be found on Google... :( thanks a bunch Roey In C++11 you can declare functions as deleted: struct Foo { Foo(const Foo &) = delete; }; Attempting to use such a function is an error. The purpose of doing this is so that, in this example, copy construction of this type is not possible. This is a

Why is the -ObjC linker flag needed to link categories in static libraries? (LLVM)

隐身守侯 提交于 2019-11-30 08:57:47
Regarding this technical Q&A from Apple: http://developer.apple.com/library/mac/#qa/qa1490/_index.html I think the compiler could mark calls to methods defined in categories at compile-time (it knows that they were defined in a category and not the main class because the prototype was in an @interface Class (Category) section) - so it could build a table in the object files of "external category methods". Then the linker, after doing its normal linking, should be able to concatenate/merge and process the "external category methods" tables from all objects and look for matching symbols in