llvm

Every time I upgrade Xcode, I get linker errors with brew installed GCC

*爱你&永不变心* 提交于 2020-01-03 16:06:33
问题 So, I upgraded to Mavericks as well as the newest version of Xcode (5.02), and — as expected, was unable to compile any new Ruby gems which include C extensions. This happens specifically with my own project, NMatrix, which includes C and C++ code. I reinstalled the command line tools for Xcode. Then I upgraded homebrew. Then I uninstalled rbenv, ruby-build, and my custom GCC versions (except for 4.7, which was installed manually rather than through brew). Next, I used brew to install gcc48

llvm exceptions - RaiseException “?:Unknown signal”

独自空忆成欢 提交于 2020-01-03 12:32:34
问题 I'm trying to get exceptions working with llvm for a very simple example, that I can later build on but i'm running into some real difficulties and i'm not sure why. I got clang to give me the following llir code, that I am passing into the MCJIT ; llvm-as c++exn.ll && llvm-ld -native c++exn.bc -lstdc++.6 && ./a.out %"class.std::ios_base::Init" = type { i8 } %"class.std::basic_ostream" = type { i32 (...)**, %"class.std::basic_ios" } %"class.std::basic_ios" = type { %"class.std::ios_base", %

llvm exceptions - RaiseException “?:Unknown signal”

假装没事ソ 提交于 2020-01-03 12:32:07
问题 I'm trying to get exceptions working with llvm for a very simple example, that I can later build on but i'm running into some real difficulties and i'm not sure why. I got clang to give me the following llir code, that I am passing into the MCJIT ; llvm-as c++exn.ll && llvm-ld -native c++exn.bc -lstdc++.6 && ./a.out %"class.std::ios_base::Init" = type { i8 } %"class.std::basic_ostream" = type { i32 (...)**, %"class.std::basic_ios" } %"class.std::basic_ios" = type { %"class.std::ios_base", %

Find loops in LLVM bytecode

牧云@^-^@ 提交于 2020-01-03 12:31:27
问题 I want to find simple loops in LLVM bytecode, and extract the basic information of the loop. For example: for (i=0; i<1000; i++) sum += i; I want to extract the bound [0, 1000), the loop variable "i" and the loop body (sum += i). What should I do? I read the LLVM API document, and find some useful classes like "Loop", "LoopInfo". But I do not know how to use them in detail. Could you please give me some help? A detailed usage may be more helpful. 回答1: If you do not want to use the pass

Binding against LLVM 3.8.4 no getGlobalContext

廉价感情. 提交于 2020-01-03 09:00:16
问题 I am attempting to follow the https://github.com/lsegal/my_toy_compiler, but even though it has been updated for LLVM 3.8.0, I am unable to get it to compile using LLVM 3.8.4 from brew with --with-clang --with-lld --with-jit --with-python . Specifically I get the following error, use of undeclared identifier 'getGlobalContext' . Additionally the symbol getGlobalContext does not appear in the /usr/local/opt/llvm/include/llvm/IR/LLVMContext.h or indeed anywhere in the /usr/local/opt/llvm

Automatically unrolling and outputting for C/C++ code

余生长醉 提交于 2020-01-03 08:34:18
问题 I'm doing an experiment and the first step is to unroll a loop (from C/C++) a dozen of times (ex: 10, 50, etc) and output the C/C++ unrolled code. Is there any tool that I can use to automatize such unrolling? In other words, what I need is: C/C++ source/loop --->> TOOL (Unroll by X) ----> Unrolled C/C++ source/loop 回答1: Our source-to-source transformation engine, the DMS Software Reengineering Toolkit, with its C++17 front end can be used to do this. DMS can accept explicit source-to-source

PIC Backend: 16-bit registers / return type

此生再无相见时 提交于 2020-01-03 02:59:08
问题 I started writing an LLVM Backend for 16-bit PIC microcontrollers (PIC24, dsPIC30/33). After copying and renaming stuff from Lanai, removing much, adding some and making the backend known to clang I can translate short foo(void) { return 6*7; } to mov #0x2A, W0 ret which is precisely what I wanted. The DataLayout is set to "e-m:e-p:16:16-i16:16-a:0:16-n16-S16" and the registers are defined as def GPR : RegisterClass<"PIC", [i16], 16, (sequence "W%u", 0, 15)>; and added as addRegisterClass(MVT

How to convert a genericValue to Value in LLVM?

非 Y 不嫁゛ 提交于 2020-01-02 18:16:44
问题 I'm working in interpreter. I have the address of a variable in memory and I managed to get the real value form it and put it in a genericValue using LoadValueFromMemory function. Now I need to create a StoreInst and want to put this value got in a Value object to use it in the StoreInst. Any idea? 回答1: To answer the question in the title, GenericValue is just a type-agnostic container for some value. To create an LLVM Value from it, you need to create a Constant of the appropriate type, and

failing to parse C++ using llvm and clang

五迷三道 提交于 2020-01-02 07:05:55
问题 I'm writing a little tool with llvm to parse C and C++ code, but I can't seem to get it to successfully parse C++ at all. I'm probably missing something obvious. This is what I have so far: #include <iostream> #include "llvm/Support/Host.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/raw_ostream.h" #include "clang/Basic/DiagnosticOptions.h" #include "clang/Frontend

How to build LLVM source code on Eclipse?

流过昼夜 提交于 2020-01-01 16:30:32
问题 I am trying to add a new pass to the llvm compiler infrastructure. I have been able to build LLVM-2.9 using make.But I wants to build using Eclipse so that I can trace the code. I imported llvm source files to c++ project with LinuxGcc tool chain and CDT internal builder(Eclipse with CDT-7.0).But it gives some errors. Is this is a right way to build llvm using eclipse?. Please suggest me steps involved to build llvm source using Eclipse. Note: Platform ubuntu. 回答1: You can use cmake -G