diff options
| author | Clement Courbet <courbet@google.com> | 2018-05-15 07:40:21 +0000 |
|---|---|---|
| committer | Clement Courbet <courbet@google.com> | 2018-05-15 07:40:21 +0000 |
| commit | 559d1e34df710a0c88dc775b014413c8f80804f7 (patch) | |
| tree | 8dfdec9fe097dc8b6613bc0c3c5eeb18fa493172 /llvm/tools/llvm-exegesis | |
| parent | 27d4ca2df9333ac38046628f7cae752b00077892 (diff) | |
| download | bcm5719-llvm-559d1e34df710a0c88dc775b014413c8f80804f7.tar.gz bcm5719-llvm-559d1e34df710a0c88dc775b014413c8f80804f7.zip | |
[llvm-exegesis] InMemoryAssembler: handle return-less targets (e.g. arm).
Summary: Arm does not have a ret code per se.
Reviewers: gchatelet
Subscribers: mgorny, javed.absar, kristof.beyls, tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D45672
llvm-svn: 332331
Diffstat (limited to 'llvm/tools/llvm-exegesis')
| -rw-r--r-- | llvm/tools/llvm-exegesis/lib/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | llvm/tools/llvm-exegesis/lib/InMemoryAssembler.cpp | 12 |
2 files changed, 11 insertions, 2 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/CMakeLists.txt b/llvm/tools/llvm-exegesis/lib/CMakeLists.txt index 5ace962fe59..a388ed2f628 100644 --- a/llvm/tools/llvm-exegesis/lib/CMakeLists.txt +++ b/llvm/tools/llvm-exegesis/lib/CMakeLists.txt @@ -19,6 +19,7 @@ llvm_map_components_to_libnames(libs CodeGen Core ExecutionEngine + GlobalISel MC MCJIT Object diff --git a/llvm/tools/llvm-exegesis/lib/InMemoryAssembler.cpp b/llvm/tools/llvm-exegesis/lib/InMemoryAssembler.cpp index 24568071de9..317a59d6e96 100644 --- a/llvm/tools/llvm-exegesis/lib/InMemoryAssembler.cpp +++ b/llvm/tools/llvm-exegesis/lib/InMemoryAssembler.cpp @@ -10,6 +10,8 @@ #include "InMemoryAssembler.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" +#include "llvm/CodeGen/GlobalISel/CallLowering.h" +#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h" @@ -139,9 +141,15 @@ static void fillMachineFunction(llvm::MachineFunction &MF, } } } - // Adding the Return Opcode. + // Insert the return code. const llvm::TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo(); - llvm::BuildMI(MBB, DL, TII->get(TII->getReturnOpcode())); + if (TII->getReturnOpcode() < TII->getNumOpcodes()) { + llvm::BuildMI(MBB, DL, TII->get(TII->getReturnOpcode())); + } else { + llvm::MachineIRBuilder MIB(MF); + MIB.setMBB(*MBB); + MF.getSubtarget().getCallLowering()->lowerReturn(MIB, nullptr, 0); + } } namespace { |

