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"
25 #include "llvm/Target/TargetMachine.h"
26 #include "llvm/Target/TargetOptions.h"
30 #include "clang-c.h"
43 "-cc1", in createCompilerInvocation()
44 "-triple", "bpf-pc-linux", in createCompilerInvocation()
45 "-fsyntax-only", in createCompilerInvocation()
46 "-ferror-limit", "19", in createCompilerInvocation()
47 "-fmessage-length", "127", in createCompilerInvocation()
48 "-O2", in createCompilerInvocation()
49 "-nostdsysteminc", in createCompilerInvocation()
50 "-nobuiltininc", in createCompilerInvocation()
51 "-vectorize-loops", in createCompilerInvocation()
52 "-vectorize-slp", in createCompilerInvocation()
53 "-Wno-unused-value", in createCompilerInvocation()
54 "-Wno-pointer-sign", in createCompilerInvocation()
55 "-x", "c"}; in createCompilerInvocation()
60 FrontendOptions& Opts = CI->getFrontendOpts(); in createCompilerInvocation()
67 static std::unique_ptr<llvm::Module>
94 return std::unique_ptr<llvm::Module>(nullptr); in getModuleFromSource()
96 return Act->takeModule(); in getModuleFromSource()
99 std::unique_ptr<llvm::Module>
114 OverlayFS->pushOverlay(MemFS); in getModuleFromSource()
115 MemFS->addFile(Twine(Name), 0, llvm::MemoryBuffer::getMemBuffer(Content)); in getModuleFromSource()
120 std::unique_ptr<llvm::Module>
128 getBPFObjectFromModule(llvm::Module *Module) in getBPFObjectFromModule() argument
132 std::string TargetTriple("bpf-pc-linux"); in getBPFObjectFromModule()
134 const Target* Target = TargetRegistry::lookupTarget(TargetTriple, Error); in getBPFObjectFromModule() local
135 if (!Target) { in getBPFObjectFromModule()
142 Target->createTargetMachine(TargetTriple, in getBPFObjectFromModule()
146 Module->setDataLayout(TargetMachine->createDataLayout()); in getBPFObjectFromModule()
147 Module->setTargetTriple(TargetTriple); in getBPFObjectFromModule()
155 NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, in getBPFObjectFromModule()
158 NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, nullptr, in getBPFObjectFromModule()
165 PM.run(*Module); in getBPFObjectFromModule()
195 return -EINVAL; in perf_clang__compile_bpf()
200 return -EINVAL; in perf_clang__compile_bpf()
203 return -EINVAL; in perf_clang__compile_bpf()
205 size_t size = O->size_in_bytes(); in perf_clang__compile_bpf()
210 return -ENOMEM; in perf_clang__compile_bpf()
211 memcpy(buffer, O->data(), size); in perf_clang__compile_bpf()