Lines Matching +full:target +full:- +full:module
1 // SPDX-License-Identifier: GPL-2.0
6 * http://llvm.org/svn/llvm-project/cfe/trunk/examples/clang-interpreter/main.cpp
19 #include "llvm/IR/Module.h"
29 #include "llvm/Target/TargetMachine.h"
30 #include "llvm/Target/TargetOptions.h"
34 #include "clang-c.h"
47 "-cc1", in createCompilerInvocation()
48 "-triple", "bpf-pc-linux", in createCompilerInvocation()
49 "-fsyntax-only", in createCompilerInvocation()
50 "-O2", in createCompilerInvocation()
51 "-nostdsysteminc", in createCompilerInvocation()
52 "-nobuiltininc", in createCompilerInvocation()
53 "-vectorize-loops", in createCompilerInvocation()
54 "-vectorize-slp", in createCompilerInvocation()
55 "-Wno-unused-value", in createCompilerInvocation()
56 "-Wno-pointer-sign", in createCompilerInvocation()
57 "-x", "c"}; in createCompilerInvocation()
66 FrontendOptions& Opts = CI->getFrontendOpts(); in createCompilerInvocation()
73 static std::unique_ptr<llvm::Module>
100 return std::unique_ptr<llvm::Module>(nullptr); in getModuleFromSource()
102 return Act->takeModule(); in getModuleFromSource()
105 std::unique_ptr<llvm::Module>
120 OverlayFS->pushOverlay(MemFS); in getModuleFromSource()
121 MemFS->addFile(Twine(Name), 0, llvm::MemoryBuffer::getMemBuffer(Content)); in getModuleFromSource()
126 std::unique_ptr<llvm::Module>
134 getBPFObjectFromModule(llvm::Module *Module) in getBPFObjectFromModule() argument
138 std::string TargetTriple("bpf-pc-linux"); in getBPFObjectFromModule()
140 const Target* Target = TargetRegistry::lookupTarget(TargetTriple, Error); in getBPFObjectFromModule() local
141 if (!Target) { in getBPFObjectFromModule()
148 Target->createTargetMachine(TargetTriple, in getBPFObjectFromModule()
152 Module->setDataLayout(TargetMachine->createDataLayout()); in getBPFObjectFromModule()
153 Module->setTargetTriple(TargetTriple); in getBPFObjectFromModule()
160 NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream in getBPFObjectFromModule()
174 PM.run(*Module); in getBPFObjectFromModule()
204 return -EINVAL; in perf_clang__compile_bpf()
209 return -EINVAL; in perf_clang__compile_bpf()
212 return -EINVAL; in perf_clang__compile_bpf()
214 size_t size = O->size_in_bytes(); in perf_clang__compile_bpf()
219 return -ENOMEM; in perf_clang__compile_bpf()
220 memcpy(buffer, O->data(), size); in perf_clang__compile_bpf()