llvm

LLVM 3.4 linker errors on VS 2012

◇◆丶佛笑我妖孽 提交于 2019-12-12 09:45:14
问题 I have built the LLVM 3.4 from source using Cmake. I referred to documentation for Getting Started with the LLVM System using Microsoft Visual Studio for the installation. I now want to use the LLVM in my own project. I have added the LLVM libraries in VS 2012 using the Properties -> C/C++ -> General . When I try to build my compiler, I get the following linker errors when I Build my project: 1>main.obj : error LNK2019: unresolved external symbol LLVMInitializeX86TargetInfo referenced in

Why does clang still need libgcc.a to compile my code?

ぐ巨炮叔叔 提交于 2019-12-12 08:23:42
问题 int main(int argc, char **argv) { return 0; } I cross compile (host= linux x86_64, target= linux aarch64) /path/to/clang --target=aarch64-linux-gnu -v main.cpp -o main -fuse-ld=lld -L./libs -lc -lc_nonshared -Xlinker -Map=a.map In the -L./libs folder I've put all the dependencies from the target. When I exclude libgcc.a this linker error happens ld.lld: error: unable to find library -lgcc I've added the -Map option to get information about the linked static libraries. In the map file I cannot

MIPS vs Intel x86 vs LLVM as the first assembly language to learn?

非 Y 不嫁゛ 提交于 2019-12-12 08:13:36
问题 Which assembly language should I learn as my first assembly language? MIPS (easier and often used for educational purposes), Intel x86 (omnipresent) or the portable assembly language behind the LLVM project? One advantage for the LLVM assembly is that I may attempt to use it as a learning exercise to write a simple compiler using LLVM as the backend in the future. 回答1: None of the above. x86 is the last assembly language you want to learn. MIPS is quite educational for a number of reasons,

Adding a function in LLVM (haskell bindings) when the number of parameters is not known at compile time

别等时光非礼了梦想. 提交于 2019-12-12 07:37:16
问题 Background : I have written a toy Lisp interpreter that I am trying to add LLVM JIT functionality to. For the moment, have imposed the following limitations: Only integer values are allowed in functions Variables may only reference formal parameters Given : compile :: [Value] -- List of Formal Parameters -> [Value] -- Body of function -> CodeGenModule(Function a)` Question : How do I generate a function where the number of parameters equals the length of the Formal Parameters list? 回答1: I don

Is any way to get llvm deference pointer value's raw type(i.e. pointer type)

跟風遠走 提交于 2019-12-12 04:48:41
问题 Maybe the title is somehow confused. but let me show you a example. void foo(int val) { // do something } int i = 27; int* pi = &i; foo(*pi); Here, if we compile it using clang, the type of *pi will be i32, but we know pi is pointer type. my question is we use Function::getgetFunctionParamType method, the result will be i32. but how do I use some wayst to get ' pi ' type, not ' *pi ' type? This problem has confused me some days. Update: I see some people confused this question. Alright, I

Almost naked iOS8.4 --> how to get a linker?

北慕城南 提交于 2019-12-12 04:41:53
问题 EDIT 2015-29-10. II. In fact -arch armv7 instead of -arch arm64 and without lowering optimization, worked perfectly. EDIT 2015-29-10. I. I tried to add export CFLAGS="-O1" export CXXFLAGS="-O1" before configure , and had the same error, with a different file missing this time : "/usr/local/cctools-arm64-port/bin/ld" -demangle -dynamic -arch arm64 -iphoneos_version_min 5.0.0 -syslibroot /usr/local/iPhoneOS8.4.sdk -o testcpp /var/tmp/testcpp-4f79ac.o -lstdc++ -lSystem ld: file not found: N?L I

Running LLVM passes on Windows 10 gives no output in terminal?

不羁岁月 提交于 2019-12-12 03:57:49
问题 I've the sample pass code from LLVM.org: #include "llvm/Pass.h" #include "llvm/IR/Function.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; namespace { struct Hello : public FunctionPass { static char ID; Hello() : FunctionPass(ID) {} bool runOnFunction(Function &F) override { errs() << "Hello: "; errs().write_escaped(F.getName()) << '\n'; return false; } }; // end of struct Hello } // end of anonymous namespace char Hello::ID = 0; static RegisterPass<Hello> X("hello", "Hello

Why AMD GCN uses non-zero NULL?

烂漫一生 提交于 2019-12-12 03:42:45
问题 This commit says: In amdgcn target, null pointers in global, constant, and generic address space take value 0 but null pointers in private and local address space take value -1. How do they use those two different values of NULL? 回答1: As to why : I don't know this for a fact, but local/private address space pointers are almost certainly just implemented as offsets/indices in a flat physical register file/memory area. There's no virtual memory-like address remapping, just a big array. You

Use a particular register for a variable in LLVM

旧城冷巷雨未停 提交于 2019-12-12 03:07:28
问题 I am writing an LLVM pass which modifies the LLVM bitcode. For one variable, I want it to use a register, say R15 on x86. How can I instruct LLVM to use this register when generating machine code? Can this be instructed at the bitcode level? 回答1: You can use inline assembler to model this requirement. There is no way to "tie" specific variable to register. 来源: https://stackoverflow.com/questions/9897726/use-a-particular-register-for-a-variable-in-llvm

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