diff options
author | Colin LeMahieu <colinl@codeaurora.org> | 2015-06-04 21:16:16 +0000 |
---|---|---|
committer | Colin LeMahieu <colinl@codeaurora.org> | 2015-06-04 21:16:16 +0000 |
commit | fc52c11d803d3975f17d443f504344d80cef70ed (patch) | |
tree | cd88a6d3e0f2d0c81087f24e64dd20fd344524e9 /llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp | |
parent | b8f38668d5d735cef02adbef7958776bc5426f56 (diff) | |
download | bcm5719-llvm-fc52c11d803d3975f17d443f504344d80cef70ed.tar.gz bcm5719-llvm-fc52c11d803d3975f17d443f504344d80cef70ed.zip |
[Hexagon] Adding functionality for duplexing. Duplexing is a way to compress commonly used pairs of instructions in order to reduce code size. The test case duplex.ll normally would be 8 bytes, assign register to 0 and jump to link register. After duplexing this is only 4 bytes. This also tests the HexagonMCShuffler code path which is used to make sure duplexed instructions still follow slot requirements.
llvm-svn: 239095
Diffstat (limited to 'llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp b/llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp index 48113610c80..e9bb1006201 100644 --- a/llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp +++ b/llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp @@ -20,6 +20,7 @@ #include "HexagonTargetMachine.h" #include "MCTargetDesc/HexagonInstPrinter.h" #include "MCTargetDesc/HexagonMCInstrInfo.h" +#include "MCTargetDesc/HexagonMCShuffler.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" @@ -199,9 +200,13 @@ void HexagonAsmPrinter::EmitInstruction(const MachineInstr *MI) { HexagonLowerToMC(MI, MCB, *this); HexagonMCInstrInfo::padEndloop(MCB); } + // Examine the packet and convert pairs of instructions to duplex + // instructions when possible. + MCInst InstBundlePreDuplex = MCInst(MCB); + SmallVector<DuplexCandidate, 8> possibleDuplexes; + possibleDuplexes = HexagonMCInstrInfo::getDuplexPossibilties(*Subtarget->getInstrInfo(), MCB); + HexagonMCShuffle(*Subtarget->getInstrInfo(), *Subtarget, OutStreamer->getContext(), MCB, possibleDuplexes); EmitToStreamer(*OutStreamer, MCB); - - return; } extern "C" void LLVMInitializeHexagonAsmPrinter() { |