llvm

LLVM 7.0 does not provide specific Platform Toolset on Visual Studio 2015

懵懂的女人 提交于 2019-12-01 11:50:52
问题 I've just installed the LLVM 7.0.0 for Windows (64-bit) released few hours ago. With the new version, all the platform toolsets provided by the previous release (6.0.1) for Visual Studio 2015 (named " LLVM-vs2014 ", " LLVM-vs2014_xp " and " LLVM-vs2010 ") are not available anymore. I've seen a new extension named LLVM Compiler Toolchain in the Visual Studio Marketplace, but it is not available for Visual Studio 2015. Do you know the reasons of this lack? 回答1: The Visual Studio extension

LLVM JIT-compiled program cannot find external functions

北战南征 提交于 2019-12-01 09:21:41
My program which JIT compiles a LLVM IR module and calls a function foo defined therein fails at runtime if foo uses an externally-defined function: LLVM ERROR: Program used external function 'glutInit' which could not be resolved! My program: // foo1.cpp #include <GL/glut.h> extern "C" void foo() { glutInit(0,0); } // foo2.cpp #include <iostream> #include <fstream> #include <string> #include <llvm/Support/raw_ostream.h> #include <llvm/LLVMContext.h> #include <llvm/Support/TargetSelect.h> #include <llvm/Support/IRReader.h> #include <llvm/ExecutionEngine/ExecutionEngine.h> #include <llvm

How do you change the display format of floats & doubles in Xcode debug window?

醉酒当歌 提交于 2019-12-01 08:56:18
问题 Im debugging C in Xcode and setting breakpoints in functions to examine the value of various doubles. Xcode insists on displaying them using scientific notation, which is a real pain. I need to see a decimal representation. The right click "View Value" menu option of Decimal , does weird things. Anyone have any idea how to get this to play nice short of printf'n everything I want to see?? 回答1: Check out the LLDB Variable Formatting documentation, specifically the Type Format section near the

Building and using a pass for LLVM 3.8 on OSX

笑着哭i 提交于 2019-12-01 07:44:04
I'm trying to build and apply a pass on OSX using llvm 3.8. I installed llvm 3.8 using brew with this formula: $brew install llvm38 Inside the pass I have the following: static RegisterPass<SwiftPass> X("pass", "My Pass"); My Makefile to build the pass looks like this: LIB_NAME = pass$(SUFIX) LDFLAGS = $(shell $(LLVM_PATH)llvm-config --ldflags) CXXFLAGS = -g -Wall -fno-rtti -fPIC -std=c++11 -shared -dynamiclib $(shell $(LLVM_PATH)llvm-config --cxxflags --system-libs --libs core executionengine interpreter mc support nativecodegen) COMPILER = clang++ all: $(LIB_NAME) $(LIB_NAME): $(OBJ) $

LLVM JIT-compiled program cannot find external functions

女生的网名这么多〃 提交于 2019-12-01 07:06:02
问题 My program which JIT compiles a LLVM IR module and calls a function foo defined therein fails at runtime if foo uses an externally-defined function: LLVM ERROR: Program used external function 'glutInit' which could not be resolved! My program: // foo1.cpp #include <GL/glut.h> extern "C" void foo() { glutInit(0,0); } // foo2.cpp #include <iostream> #include <fstream> #include <string> #include <llvm/Support/raw_ostream.h> #include <llvm/LLVMContext.h> #include <llvm/Support/TargetSelect.h>

Use LLVM in a cmake build

时光总嘲笑我的痴心妄想 提交于 2019-12-01 06:30:53
问题 I'm trying to build my own project that use LLVM. I downloaded the source code and the precompiled package on the official web site (last version). http://releases.llvm.org/download.html I downloaded : LLVM source code Clang for Windows (64-bit) FYI, I don't build LLVM... only want to use it ! I followed the instruction here : http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project in the section : "Embedding LLVM in your project" So, I added this code : find_package(LLVM REQUIRED

What is proper LLVM header guard style?

扶醉桌前 提交于 2019-12-01 06:12:11
In clang tidy, the check [llvm-header-guard] looks for LLVM style header guards, but I can't find any examples of proper LLVM header guard style, specifically the structure of the name given to the define, the coding standards pages does not mention anything. Looking at the unit tests: https://github.com/llvm-mirror/clang-tools-extra/blob/master/unittests/clang-tidy/LLVMModuleTest.cpp it seems to accept a few variations on the commonly used patterns. For a file named include/llvm/ADT/foo.h the convention seems to be: #ifndef LLVM_ADT_FOO_H #define LLVM_ADT_FOO_H //... #endif // LLVM_ADT_FOO_H

Execute LLVM IR code generated from Rust/Python source code

和自甴很熟 提交于 2019-12-01 06:06:45
When I generate LLVM IR Code from C++, I can use the console command clang++ -emit-llvm –S test.cpp to get a test.ll file which is the LLVM IR I want. To get an executable these are the steps to follow: llvm-as test.ll -> gives me the test.bc file. llc test.bc --o test.s -> gives me the test.s file. clang++ test.s -o test.native -> gives me a native file that i can execute. For C++ this works just fine. In theory, should the same steps apply when I write Rust or Python Code? I take my Rust code and get the LLVM IR by typing rustc test.rs --emit llvm-ir . This gives me the test.ll file again.

Trouble linking against LLVM with project including Flex and Bison

十年热恋 提交于 2019-12-01 05:43:17
I've been working through a tutorial on writing compilers with Flex, Bison, and LLVM (http://gnuu.org/2009/09/18/writing-your-own-toy-compiler/), and attempting to compile the final binary fails with many of the following "undefined reference" errors: g++ -o parser `llvm-config --libs core jit native --cxxflags --ldflags` *.cpp /tmp/ccl0CSyi.o: In function `NBinaryOperator::codeGen(CodeGenContext&)': codegen.cpp:(.text+0x2ce): undefined reference to `llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value*, llvm::Value*, llvm::Twine const&, llvm::BasicBlock*)' /tmp/ccl0CSyi.o:

How to add a Metadata String to an LLVM module with the C++ API?

坚强是说给别人听的谎言 提交于 2019-12-01 05:37:20
I'm trying to add a metadata string to my LLVM module. The stripped down version of what I'm trying is #include <llvm/LLVMContext.h> #include <llvm/Module.h> #include <llvm/Metadata.h> using namespace llvm; int main() { Module* module = new Module("test", getGlobalContext()); MDString::get(module->getContext(), "test"); module->dump(); } I can compile and run it: Desktop% g++ llvm.cc -o llvm `llvm-config --cppflags --ldflags --libs all` Desktop% ./llvm ; ModuleID = 'test' But as one can see, the metadata does not show up. Can I somehow add the string to the module? The module itself only seems