[llvm] r274437 - [Hexagon] Create global std::map lazily.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 2 06:05:13 PDT 2016
Author: d0k
Date: Sat Jul 2 08:05:12 2016
New Revision: 274437
URL: http://llvm.org/viewvc/llvm-project?rev=274437&view=rev
Log:
[Hexagon] Create global std::map lazily.
This could of course be a simple binary search with no global state
involved at all if someone cares enough. Just don't make everyone
linking the hexagon backend pay for it on process startup and shutdown.
Modified:
llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp
Modified: llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp?rev=274437&r1=274436&r2=274437&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp Sat Jul 2 08:05:12 2016
@@ -80,9 +80,6 @@ static const std::pair<unsigned, unsigne
std::make_pair((unsigned)V4_SS2_storewi0, 4096),
std::make_pair((unsigned)V4_SS2_storewi1, 4352)};
-static std::map<unsigned, unsigned>
- subinstOpcodeMap(std::begin(opcodeData), std::end(opcodeData));
-
bool HexagonMCInstrInfo::isDuplexPairMatch(unsigned Ga, unsigned Gb) {
switch (Ga) {
case HexagonII::HSIG_None:
@@ -587,6 +584,9 @@ bool HexagonMCInstrInfo::isOrderedDuplex
unsigned MIaG = HexagonMCInstrInfo::getDuplexCandidateGroup(MIa),
MIbG = HexagonMCInstrInfo::getDuplexCandidateGroup(MIb);
+ static std::map<unsigned, unsigned> subinstOpcodeMap(std::begin(opcodeData),
+ std::end(opcodeData));
+
// If a duplex contains 2 insns in the same group, the insns must be
// ordered such that the numerically smaller opcode is in slot 1.
if ((MIaG != HexagonII::HSIG_None) && (MIaG == MIbG) && bisReversable) {
More information about the llvm-commits
mailing list