blob: c2b304f5e215c273136c3328bb2316920647969c [file] [log] [blame]
Clement Courbet0e69e2d2018-05-17 10:52:18 +00001//===-- Assembler.cpp -------------------------------------------*- C++ -*-===//
Clement Courbetac74acd2018-04-04 11:37:06 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Clement Courbetac74acd2018-04-04 11:37:06 +00006//
7//===----------------------------------------------------------------------===//
8
Clement Courbet0e69e2d2018-05-17 10:52:18 +00009#include "Assembler.h"
10
Clement Courbet9431b722019-09-27 12:56:24 +000011#include "SnippetRepetitor.h"
Clement Courbet6fd00e32018-06-20 11:54:35 +000012#include "Target.h"
Clement Courbet559d1e32018-05-15 07:40:21 +000013#include "llvm/CodeGen/GlobalISel/CallLowering.h"
14#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
Clement Courbetac74acd2018-04-04 11:37:06 +000015#include "llvm/CodeGen/MachineInstrBuilder.h"
16#include "llvm/CodeGen/MachineModuleInfo.h"
17#include "llvm/CodeGen/MachineRegisterInfo.h"
18#include "llvm/CodeGen/TargetInstrInfo.h"
19#include "llvm/CodeGen/TargetPassConfig.h"
Clement Courbet0e69e2d2018-05-17 10:52:18 +000020#include "llvm/CodeGen/TargetSubtargetInfo.h"
Clement Courbetac74acd2018-04-04 11:37:06 +000021#include "llvm/ExecutionEngine/SectionMemoryManager.h"
Clement Courbetac74acd2018-04-04 11:37:06 +000022#include "llvm/IR/LegacyPassManager.h"
Clement Courbet0e69e2d2018-05-17 10:52:18 +000023#include "llvm/MC/MCInstrInfo.h"
Clement Courbet04a9a0e2019-10-09 14:25:08 +000024#include "llvm/Support/Alignment.h"
Clement Courbet0e69e2d2018-05-17 10:52:18 +000025#include "llvm/Support/MemoryBuffer.h"
Clement Courbetac74acd2018-04-04 11:37:06 +000026
Fangrui Song32401af2018-10-22 17:10:47 +000027namespace llvm {
Clement Courbetac74acd2018-04-04 11:37:06 +000028namespace exegesis {
29
30static constexpr const char ModuleID[] = "ExegesisInfoTest";
31static constexpr const char FunctionID[] = "foo";
Clement Courbet04a9a0e2019-10-09 14:25:08 +000032static const Align kFunctionAlignment(4096);
Clement Courbetac74acd2018-04-04 11:37:06 +000033
Clement Courbet9431b722019-09-27 12:56:24 +000034// Fills the given basic block with register setup code, and returns true if
35// all registers could be setup correctly.
Clement Courbet50cdd562019-10-09 11:58:42 +000036static bool generateSnippetSetupCode(
37 const ExegesisTarget &ET, const MCSubtargetInfo *const MSI,
38 ArrayRef<RegisterValue> RegisterInitialValues, BasicBlockFiller &BBF) {
Clement Courbet9431b722019-09-27 12:56:24 +000039 bool IsSnippetSetupComplete = true;
Guillaume Chateletc96a97b2018-09-20 12:22:18 +000040 for (const RegisterValue &RV : RegisterInitialValues) {
Simon Pilgrimf652ef32018-09-18 15:38:16 +000041 // Load a constant in the register.
Guillaume Chateletc96a97b2018-09-20 12:22:18 +000042 const auto SetRegisterCode = ET.setRegTo(*MSI, RV.Register, RV.Value);
43 if (SetRegisterCode.empty())
44 IsSnippetSetupComplete = false;
Clement Courbet9431b722019-09-27 12:56:24 +000045 BBF.addInstructions(SetRegisterCode);
Simon Pilgrimf652ef32018-09-18 15:38:16 +000046 }
Clement Courbet9431b722019-09-27 12:56:24 +000047 return IsSnippetSetupComplete;
Clement Courbeta51efc22018-06-25 13:12:02 +000048}
49
Clement Courbetac74acd2018-04-04 11:37:06 +000050// Small utility function to add named passes.
Clement Courbet50cdd562019-10-09 11:58:42 +000051static bool addPass(PassManagerBase &PM, StringRef PassName,
52 TargetPassConfig &TPC) {
53 const PassRegistry *PR = PassRegistry::getPassRegistry();
54 const PassInfo *PI = PR->getPassInfo(PassName);
Clement Courbetac74acd2018-04-04 11:37:06 +000055 if (!PI) {
Clement Courbet50cdd562019-10-09 11:58:42 +000056 errs() << " run-pass " << PassName << " is not registered.\n";
Clement Courbetac74acd2018-04-04 11:37:06 +000057 return true;
58 }
59
60 if (!PI->getNormalCtor()) {
Clement Courbet50cdd562019-10-09 11:58:42 +000061 errs() << " cannot create pass: " << PI->getPassName() << "\n";
Clement Courbetac74acd2018-04-04 11:37:06 +000062 return true;
63 }
Clement Courbet50cdd562019-10-09 11:58:42 +000064 Pass *P = PI->getNormalCtor()();
Clement Courbetac74acd2018-04-04 11:37:06 +000065 std::string Banner = std::string("After ") + std::string(P->getPassName());
66 PM.add(P);
67 TPC.printAndVerify(Banner);
68
69 return false;
70}
71
Clement Courbet50cdd562019-10-09 11:58:42 +000072MachineFunction &createVoidVoidPtrMachineFunction(StringRef FunctionID,
73 Module *Module,
74 MachineModuleInfo *MMI) {
75 Type *const ReturnType = Type::getInt32Ty(Module->getContext());
76 Type *const MemParamType = PointerType::get(
77 Type::getInt8Ty(Module->getContext()), 0 /*default address space*/);
78 FunctionType *FunctionType =
79 FunctionType::get(ReturnType, {MemParamType}, false);
80 Function *const F = Function::Create(
81 FunctionType, GlobalValue::InternalLinkage, FunctionID, Module);
Clement Courbetac74acd2018-04-04 11:37:06 +000082 // Making sure we can create a MachineFunction out of this Function even if it
83 // contains no IR.
84 F->setIsMaterializable(true);
85 return MMI->getOrCreateMachineFunction(*F);
86}
87
Clement Courbet50cdd562019-10-09 11:58:42 +000088BasicBlockFiller::BasicBlockFiller(MachineFunction &MF, MachineBasicBlock *MBB,
89 const MCInstrInfo *MCII)
Clement Courbet9431b722019-09-27 12:56:24 +000090 : MF(MF), MBB(MBB), MCII(MCII) {}
91
Clement Courbet50cdd562019-10-09 11:58:42 +000092void BasicBlockFiller::addInstruction(const MCInst &Inst, const DebugLoc &DL) {
Clement Courbet9431b722019-09-27 12:56:24 +000093 const unsigned Opcode = Inst.getOpcode();
Clement Courbet50cdd562019-10-09 11:58:42 +000094 const MCInstrDesc &MCID = MCII->get(Opcode);
95 MachineInstrBuilder Builder = BuildMI(MBB, DL, MCID);
Clement Courbet9431b722019-09-27 12:56:24 +000096 for (unsigned OpIndex = 0, E = Inst.getNumOperands(); OpIndex < E;
97 ++OpIndex) {
Clement Courbet50cdd562019-10-09 11:58:42 +000098 const MCOperand &Op = Inst.getOperand(OpIndex);
Clement Courbet9431b722019-09-27 12:56:24 +000099 if (Op.isReg()) {
100 const bool IsDef = OpIndex < MCID.getNumDefs();
101 unsigned Flags = 0;
Clement Courbet50cdd562019-10-09 11:58:42 +0000102 const MCOperandInfo &OpInfo = MCID.operands().begin()[OpIndex];
Clement Courbet9431b722019-09-27 12:56:24 +0000103 if (IsDef && !OpInfo.isOptionalDef())
Clement Courbet50cdd562019-10-09 11:58:42 +0000104 Flags |= RegState::Define;
Clement Courbet9431b722019-09-27 12:56:24 +0000105 Builder.addReg(Op.getReg(), Flags);
106 } else if (Op.isImm()) {
107 Builder.addImm(Op.getImm());
108 } else if (!Op.isValid()) {
109 llvm_unreachable("Operand is not set");
110 } else {
111 llvm_unreachable("Not yet implemented");
Clement Courbetac74acd2018-04-04 11:37:06 +0000112 }
113 }
Clement Courbet9431b722019-09-27 12:56:24 +0000114}
115
Clement Courbet50cdd562019-10-09 11:58:42 +0000116void BasicBlockFiller::addInstructions(ArrayRef<MCInst> Insts,
117 const DebugLoc &DL) {
Clement Courbet9431b722019-09-27 12:56:24 +0000118 for (const MCInst &Inst : Insts)
119 addInstruction(Inst, DL);
120}
121
Clement Courbet50cdd562019-10-09 11:58:42 +0000122void BasicBlockFiller::addReturn(const DebugLoc &DL) {
Clement Courbet559d1e32018-05-15 07:40:21 +0000123 // Insert the return code.
Clement Courbet50cdd562019-10-09 11:58:42 +0000124 const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
Clement Courbet559d1e32018-05-15 07:40:21 +0000125 if (TII->getReturnOpcode() < TII->getNumOpcodes()) {
Clement Courbet50cdd562019-10-09 11:58:42 +0000126 BuildMI(MBB, DL, TII->get(TII->getReturnOpcode()));
Clement Courbet559d1e32018-05-15 07:40:21 +0000127 } else {
Clement Courbet50cdd562019-10-09 11:58:42 +0000128 MachineIRBuilder MIB(MF);
Clement Courbet559d1e32018-05-15 07:40:21 +0000129 MIB.setMBB(*MBB);
John Brawnc616a722018-10-10 13:03:23 +0000130 MF.getSubtarget().getCallLowering()->lowerReturn(MIB, nullptr, {});
Clement Courbet559d1e32018-05-15 07:40:21 +0000131 }
Clement Courbetac74acd2018-04-04 11:37:06 +0000132}
133
Clement Courbet50cdd562019-10-09 11:58:42 +0000134FunctionFiller::FunctionFiller(MachineFunction &MF,
Clement Courbet9431b722019-09-27 12:56:24 +0000135 std::vector<unsigned> RegistersSetUp)
136 : MF(MF), MCII(MF.getTarget().getMCInstrInfo()), Entry(addBasicBlock()),
137 RegistersSetUp(std::move(RegistersSetUp)) {}
138
139BasicBlockFiller FunctionFiller::addBasicBlock() {
Clement Courbet50cdd562019-10-09 11:58:42 +0000140 MachineBasicBlock *MBB = MF.CreateMachineBasicBlock();
Clement Courbet9431b722019-09-27 12:56:24 +0000141 MF.push_back(MBB);
142 return BasicBlockFiller(MF, MBB, MCII);
143}
144
145ArrayRef<unsigned> FunctionFiller::getRegistersSetUp() const {
146 return RegistersSetUp;
147}
148
Clement Courbet50cdd562019-10-09 11:58:42 +0000149static std::unique_ptr<Module>
150createModule(const std::unique_ptr<LLVMContext> &Context, const DataLayout DL) {
151 auto Mod = std::make_unique<Module>(ModuleID, *Context);
152 Mod->setDataLayout(DL);
153 return Mod;
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000154}
155
Clement Courbet50cdd562019-10-09 11:58:42 +0000156BitVector getFunctionReservedRegs(const TargetMachine &TM) {
157 std::unique_ptr<LLVMContext> Context = std::make_unique<LLVMContext>();
158 std::unique_ptr<Module> Module = createModule(Context, TM.createDataLayout());
Matthias Braun3d849f62018-11-05 23:49:13 +0000159 // TODO: This only works for targets implementing LLVMTargetMachine.
Yuanfang Chencc382cf2019-09-30 17:54:50 +0000160 const LLVMTargetMachine &LLVMTM = static_cast<const LLVMTargetMachine &>(TM);
Clement Courbet50cdd562019-10-09 11:58:42 +0000161 std::unique_ptr<MachineModuleInfoWrapperPass> MMIWP =
162 std::make_unique<MachineModuleInfoWrapperPass>(&LLVMTM);
163 MachineFunction &MF = createVoidVoidPtrMachineFunction(
Yuanfang Chencc382cf2019-09-30 17:54:50 +0000164 FunctionID, Module.get(), &MMIWP.get()->getMMI());
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000165 // Saving reserved registers for client.
166 return MF.getSubtarget().getRegisterInfo()->getReservedRegs(MF);
167}
168
Clement Courbet4860b982018-06-26 08:49:30 +0000169void assembleToStream(const ExegesisTarget &ET,
Clement Courbet50cdd562019-10-09 11:58:42 +0000170 std::unique_ptr<LLVMTargetMachine> TM,
171 ArrayRef<unsigned> LiveIns,
172 ArrayRef<RegisterValue> RegisterInitialValues,
173 const FillFunction &Fill, raw_pwrite_stream &AsmStream) {
Clement Courbet04a9a0e2019-10-09 14:25:08 +0000174 auto Context = std::make_unique<LLVMContext>();
Clement Courbet50cdd562019-10-09 11:58:42 +0000175 std::unique_ptr<Module> Module =
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000176 createModule(Context, TM->createDataLayout());
Clement Courbet04a9a0e2019-10-09 14:25:08 +0000177 auto MMIWP = std::make_unique<MachineModuleInfoWrapperPass>(TM.get());
Clement Courbet50cdd562019-10-09 11:58:42 +0000178 MachineFunction &MF = createVoidVoidPtrMachineFunction(
Yuanfang Chencc382cf2019-09-30 17:54:50 +0000179 FunctionID, Module.get(), &MMIWP.get()->getMMI());
Clement Courbet04a9a0e2019-10-09 14:25:08 +0000180 MF.ensureAlignment(kFunctionAlignment);
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000181
182 // We need to instruct the passes that we're done with SSA and virtual
183 // registers.
184 auto &Properties = MF.getProperties();
Clement Courbet50cdd562019-10-09 11:58:42 +0000185 Properties.set(MachineFunctionProperties::Property::NoVRegs);
186 Properties.reset(MachineFunctionProperties::Property::IsSSA);
187 Properties.set(MachineFunctionProperties::Property::NoPHIs);
Guillaume Chateletfb943542018-08-01 14:41:45 +0000188
189 for (const unsigned Reg : LiveIns)
190 MF.getRegInfo().addLiveIn(Reg);
191
Clement Courbet9431b722019-09-27 12:56:24 +0000192 std::vector<unsigned> RegistersSetUp;
193 for (const auto &InitValue : RegisterInitialValues) {
194 RegistersSetUp.push_back(InitValue.Register);
195 }
196 FunctionFiller Sink(MF, std::move(RegistersSetUp));
197 auto Entry = Sink.getEntry();
198 for (const unsigned Reg : LiveIns)
199 Entry.MBB->addLiveIn(Reg);
Guillaume Chateletc96a97b2018-09-20 12:22:18 +0000200
Clement Courbet9431b722019-09-27 12:56:24 +0000201 const bool IsSnippetSetupComplete = generateSnippetSetupCode(
202 ET, TM->getMCSubtargetInfo(), RegisterInitialValues, Entry);
Guillaume Chateletc96a97b2018-09-20 12:22:18 +0000203
Clement Courbeta51efc22018-06-25 13:12:02 +0000204 // If the snippet setup is not complete, we disable liveliness tracking. This
205 // means that we won't know what values are in the registers.
206 if (!IsSnippetSetupComplete)
Clement Courbet50cdd562019-10-09 11:58:42 +0000207 Properties.reset(MachineFunctionProperties::Property::TracksLiveness);
Clement Courbeta51efc22018-06-25 13:12:02 +0000208
Clement Courbet9431b722019-09-27 12:56:24 +0000209 Fill(Sink);
210
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000211 // prologue/epilogue pass needs the reserved registers to be frozen, this
212 // is usually done by the SelectionDAGISel pass.
213 MF.getRegInfo().freezeReservedRegs(MF);
214
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000215 // We create the pass manager, run the passes to populate AsmBuffer.
Clement Courbet50cdd562019-10-09 11:58:42 +0000216 MCContext &MCContext = MMIWP->getMMI().getContext();
217 legacy::PassManager PM;
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000218
Clement Courbet50cdd562019-10-09 11:58:42 +0000219 TargetLibraryInfoImpl TLII(Triple(Module->getTargetTriple()));
220 PM.add(new TargetLibraryInfoWrapperPass(TLII));
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000221
Clement Courbet50cdd562019-10-09 11:58:42 +0000222 TargetPassConfig *TPC = TM->createPassConfig(PM);
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000223 PM.add(TPC);
Yuanfang Chencc382cf2019-09-30 17:54:50 +0000224 PM.add(MMIWP.release());
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000225 TPC->printAndVerify("MachineFunctionGenerator::assemble");
Clement Courbet6fd00e32018-06-20 11:54:35 +0000226 // Add target-specific passes.
Clement Courbet4860b982018-06-26 08:49:30 +0000227 ET.addTargetSpecificPasses(PM);
228 TPC->printAndVerify("After ExegesisTarget::addTargetSpecificPasses");
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000229 // Adding the following passes:
Simon Atanasyancf1ba232019-10-11 20:26:08 +0000230 // - postrapseudos: expands pseudo return instructions used on some targets.
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000231 // - machineverifier: checks that the MachineFunction is well formed.
232 // - prologepilog: saves and restore callee saved registers.
Simon Atanasyancf1ba232019-10-11 20:26:08 +0000233 for (const char *PassName :
234 {"postrapseudos", "machineverifier", "prologepilog"})
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000235 if (addPass(PM, PassName, *TPC))
Clement Courbet50cdd562019-10-09 11:58:42 +0000236 report_fatal_error("Unable to add a mandatory pass");
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000237 TPC->setInitialized();
238
239 // AsmPrinter is responsible for generating the assembly into AsmBuffer.
Clement Courbet50cdd562019-10-09 11:58:42 +0000240 if (TM->addAsmPrinter(PM, AsmStream, nullptr, TargetMachine::CGFT_ObjectFile,
241 MCContext))
242 report_fatal_error("Cannot add AsmPrinter passes");
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000243
244 PM.run(*Module); // Run all the passes
245}
246
Clement Courbet50cdd562019-10-09 11:58:42 +0000247object::OwningBinary<object::ObjectFile>
248getObjectFromBuffer(StringRef InputData) {
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000249 // Storing the generated assembly into a MemoryBuffer that owns the memory.
Clement Courbet50cdd562019-10-09 11:58:42 +0000250 std::unique_ptr<MemoryBuffer> Buffer =
251 MemoryBuffer::getMemBufferCopy(InputData);
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000252 // Create the ObjectFile from the MemoryBuffer.
Clement Courbet50cdd562019-10-09 11:58:42 +0000253 std::unique_ptr<object::ObjectFile> Obj =
254 cantFail(object::ObjectFile::createObjectFile(Buffer->getMemBufferRef()));
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000255 // Returning both the MemoryBuffer and the ObjectFile.
Clement Courbet50cdd562019-10-09 11:58:42 +0000256 return object::OwningBinary<object::ObjectFile>(std::move(Obj),
257 std::move(Buffer));
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000258}
259
Clement Courbet50cdd562019-10-09 11:58:42 +0000260object::OwningBinary<object::ObjectFile> getObjectFromFile(StringRef Filename) {
261 return cantFail(object::ObjectFile::createObjectFile(Filename));
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000262}
263
Clement Courbetac74acd2018-04-04 11:37:06 +0000264namespace {
265
266// Implementation of this class relies on the fact that a single object with a
267// single function will be loaded into memory.
Clement Courbet50cdd562019-10-09 11:58:42 +0000268class TrackingSectionMemoryManager : public SectionMemoryManager {
Clement Courbetac74acd2018-04-04 11:37:06 +0000269public:
270 explicit TrackingSectionMemoryManager(uintptr_t *CodeSize)
271 : CodeSize(CodeSize) {}
272
273 uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
274 unsigned SectionID,
Clement Courbet50cdd562019-10-09 11:58:42 +0000275 StringRef SectionName) override {
Clement Courbetac74acd2018-04-04 11:37:06 +0000276 *CodeSize = Size;
Clement Courbet50cdd562019-10-09 11:58:42 +0000277 return SectionMemoryManager::allocateCodeSection(Size, Alignment, SectionID,
278 SectionName);
Clement Courbetac74acd2018-04-04 11:37:06 +0000279 }
280
281private:
282 uintptr_t *const CodeSize = nullptr;
283};
284
285} // namespace
286
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000287ExecutableFunction::ExecutableFunction(
Clement Courbet50cdd562019-10-09 11:58:42 +0000288 std::unique_ptr<LLVMTargetMachine> TM,
289 object::OwningBinary<object::ObjectFile> &&ObjectFileHolder)
290 : Context(std::make_unique<LLVMContext>()) {
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000291 assert(ObjectFileHolder.getBinary() && "cannot create object file");
Clement Courbetac74acd2018-04-04 11:37:06 +0000292 // Initializing the execution engine.
293 // We need to use the JIT EngineKind to be able to add an object file.
294 LLVMLinkInMCJIT();
295 uintptr_t CodeSize = 0;
296 std::string Error;
297 ExecEngine.reset(
Clement Courbet50cdd562019-10-09 11:58:42 +0000298 EngineBuilder(createModule(Context, TM->createDataLayout()))
Clement Courbetac74acd2018-04-04 11:37:06 +0000299 .setErrorStr(&Error)
Simon Pilgrim01e8c4e2018-04-18 14:22:33 +0000300 .setMCPU(TM->getTargetCPU())
Clement Courbet50cdd562019-10-09 11:58:42 +0000301 .setEngineKind(EngineKind::JIT)
Clement Courbetac74acd2018-04-04 11:37:06 +0000302 .setMCJITMemoryManager(
Jonas Devlieghere0eaee542019-08-15 15:54:37 +0000303 std::make_unique<TrackingSectionMemoryManager>(&CodeSize))
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000304 .create(TM.release()));
Clement Courbetac74acd2018-04-04 11:37:06 +0000305 if (!ExecEngine)
Clement Courbet50cdd562019-10-09 11:58:42 +0000306 report_fatal_error(Error);
Clement Courbetac74acd2018-04-04 11:37:06 +0000307 // Adding the generated object file containing the assembled function.
308 // The ExecutionEngine makes sure the object file is copied into an
309 // executable page.
Clement Courbet0e69e2d2018-05-17 10:52:18 +0000310 ExecEngine->addObjectFile(std::move(ObjectFileHolder));
311 // Fetching function bytes.
Clement Courbet04a9a0e2019-10-09 14:25:08 +0000312 const uint64_t FunctionAddress = ExecEngine->getFunctionAddress(FunctionID);
313 assert(isAligned(kFunctionAlignment, FunctionAddress) &&
314 "function is not properly aligned");
315 FunctionBytes =
316 StringRef(reinterpret_cast<const char *>(FunctionAddress), CodeSize);
Clement Courbetac74acd2018-04-04 11:37:06 +0000317}
318
319} // namespace exegesis
Fangrui Song32401af2018-10-22 17:10:47 +0000320} // namespace llvm