AArch64PreLegalizerCombiner.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. //=== lib/CodeGen/GlobalISel/AArch64PreLegalizerCombiner.cpp --------------===//
  2. //
  3. // 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
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This pass does combining of machine instructions at the generic MI level,
  10. // before the legalizer.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #include "AArch64GlobalISelUtils.h"
  14. #include "AArch64TargetMachine.h"
  15. #include "llvm/CodeGen/GlobalISel/CSEInfo.h"
  16. #include "llvm/CodeGen/GlobalISel/Combiner.h"
  17. #include "llvm/CodeGen/GlobalISel/CombinerHelper.h"
  18. #include "llvm/CodeGen/GlobalISel/CombinerInfo.h"
  19. #include "llvm/CodeGen/GlobalISel/GISelKnownBits.h"
  20. #include "llvm/CodeGen/GlobalISel/MIPatternMatch.h"
  21. #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
  22. #include "llvm/CodeGen/MachineDominators.h"
  23. #include "llvm/CodeGen/MachineFunction.h"
  24. #include "llvm/CodeGen/MachineFunctionPass.h"
  25. #include "llvm/CodeGen/MachineRegisterInfo.h"
  26. #include "llvm/CodeGen/TargetPassConfig.h"
  27. #include "llvm/IR/Instructions.h"
  28. #include "llvm/Support/Debug.h"
  29. #define DEBUG_TYPE "aarch64-prelegalizer-combiner"
  30. using namespace llvm;
  31. using namespace MIPatternMatch;
  32. /// Return true if a G_FCONSTANT instruction is known to be better-represented
  33. /// as a G_CONSTANT.
  34. static bool matchFConstantToConstant(MachineInstr &MI,
  35. MachineRegisterInfo &MRI) {
  36. assert(MI.getOpcode() == TargetOpcode::G_FCONSTANT);
  37. Register DstReg = MI.getOperand(0).getReg();
  38. const unsigned DstSize = MRI.getType(DstReg).getSizeInBits();
  39. if (DstSize != 32 && DstSize != 64)
  40. return false;
  41. // When we're storing a value, it doesn't matter what register bank it's on.
  42. // Since not all floating point constants can be materialized using a fmov,
  43. // it makes more sense to just use a GPR.
  44. return all_of(MRI.use_nodbg_instructions(DstReg),
  45. [](const MachineInstr &Use) { return Use.mayStore(); });
  46. }
  47. /// Change a G_FCONSTANT into a G_CONSTANT.
  48. static void applyFConstantToConstant(MachineInstr &MI) {
  49. assert(MI.getOpcode() == TargetOpcode::G_FCONSTANT);
  50. MachineIRBuilder MIB(MI);
  51. const APFloat &ImmValAPF = MI.getOperand(1).getFPImm()->getValueAPF();
  52. MIB.buildConstant(MI.getOperand(0).getReg(), ImmValAPF.bitcastToAPInt());
  53. MI.eraseFromParent();
  54. }
  55. /// Try to match a G_ICMP of a G_TRUNC with zero, in which the truncated bits
  56. /// are sign bits. In this case, we can transform the G_ICMP to directly compare
  57. /// the wide value with a zero.
  58. static bool matchICmpRedundantTrunc(MachineInstr &MI, MachineRegisterInfo &MRI,
  59. GISelKnownBits *KB, Register &MatchInfo) {
  60. assert(MI.getOpcode() == TargetOpcode::G_ICMP && KB);
  61. auto Pred = (CmpInst::Predicate)MI.getOperand(1).getPredicate();
  62. if (!ICmpInst::isEquality(Pred))
  63. return false;
  64. Register LHS = MI.getOperand(2).getReg();
  65. LLT LHSTy = MRI.getType(LHS);
  66. if (!LHSTy.isScalar())
  67. return false;
  68. Register RHS = MI.getOperand(3).getReg();
  69. Register WideReg;
  70. if (!mi_match(LHS, MRI, m_GTrunc(m_Reg(WideReg))) ||
  71. !mi_match(RHS, MRI, m_SpecificICst(0)))
  72. return false;
  73. LLT WideTy = MRI.getType(WideReg);
  74. if (KB->computeNumSignBits(WideReg) <=
  75. WideTy.getSizeInBits() - LHSTy.getSizeInBits())
  76. return false;
  77. MatchInfo = WideReg;
  78. return true;
  79. }
  80. static bool applyICmpRedundantTrunc(MachineInstr &MI, MachineRegisterInfo &MRI,
  81. MachineIRBuilder &Builder,
  82. GISelChangeObserver &Observer,
  83. Register &WideReg) {
  84. assert(MI.getOpcode() == TargetOpcode::G_ICMP);
  85. LLT WideTy = MRI.getType(WideReg);
  86. // We're going to directly use the wide register as the LHS, and then use an
  87. // equivalent size zero for RHS.
  88. Builder.setInstrAndDebugLoc(MI);
  89. auto WideZero = Builder.buildConstant(WideTy, 0);
  90. Observer.changingInstr(MI);
  91. MI.getOperand(2).setReg(WideReg);
  92. MI.getOperand(3).setReg(WideZero.getReg(0));
  93. Observer.changedInstr(MI);
  94. return true;
  95. }
  96. /// \returns true if it is possible to fold a constant into a G_GLOBAL_VALUE.
  97. ///
  98. /// e.g.
  99. ///
  100. /// %g = G_GLOBAL_VALUE @x -> %g = G_GLOBAL_VALUE @x + cst
  101. static bool matchFoldGlobalOffset(MachineInstr &MI, MachineRegisterInfo &MRI,
  102. std::pair<uint64_t, uint64_t> &MatchInfo) {
  103. assert(MI.getOpcode() == TargetOpcode::G_GLOBAL_VALUE);
  104. MachineFunction &MF = *MI.getMF();
  105. auto &GlobalOp = MI.getOperand(1);
  106. auto *GV = GlobalOp.getGlobal();
  107. if (GV->isThreadLocal())
  108. return false;
  109. // Don't allow anything that could represent offsets etc.
  110. if (MF.getSubtarget<AArch64Subtarget>().ClassifyGlobalReference(
  111. GV, MF.getTarget()) != AArch64II::MO_NO_FLAG)
  112. return false;
  113. // Look for a G_GLOBAL_VALUE only used by G_PTR_ADDs against constants:
  114. //
  115. // %g = G_GLOBAL_VALUE @x
  116. // %ptr1 = G_PTR_ADD %g, cst1
  117. // %ptr2 = G_PTR_ADD %g, cst2
  118. // ...
  119. // %ptrN = G_PTR_ADD %g, cstN
  120. //
  121. // Identify the *smallest* constant. We want to be able to form this:
  122. //
  123. // %offset_g = G_GLOBAL_VALUE @x + min_cst
  124. // %g = G_PTR_ADD %offset_g, -min_cst
  125. // %ptr1 = G_PTR_ADD %g, cst1
  126. // ...
  127. Register Dst = MI.getOperand(0).getReg();
  128. uint64_t MinOffset = -1ull;
  129. for (auto &UseInstr : MRI.use_nodbg_instructions(Dst)) {
  130. if (UseInstr.getOpcode() != TargetOpcode::G_PTR_ADD)
  131. return false;
  132. auto Cst = getIConstantVRegValWithLookThrough(
  133. UseInstr.getOperand(2).getReg(), MRI);
  134. if (!Cst)
  135. return false;
  136. MinOffset = std::min(MinOffset, Cst->Value.getZExtValue());
  137. }
  138. // Require that the new offset is larger than the existing one to avoid
  139. // infinite loops.
  140. uint64_t CurrOffset = GlobalOp.getOffset();
  141. uint64_t NewOffset = MinOffset + CurrOffset;
  142. if (NewOffset <= CurrOffset)
  143. return false;
  144. // Check whether folding this offset is legal. It must not go out of bounds of
  145. // the referenced object to avoid violating the code model, and must be
  146. // smaller than 2^20 because this is the largest offset expressible in all
  147. // object formats. (The IMAGE_REL_ARM64_PAGEBASE_REL21 relocation in COFF
  148. // stores an immediate signed 21 bit offset.)
  149. //
  150. // This check also prevents us from folding negative offsets, which will end
  151. // up being treated in the same way as large positive ones. They could also
  152. // cause code model violations, and aren't really common enough to matter.
  153. if (NewOffset >= (1 << 20))
  154. return false;
  155. Type *T = GV->getValueType();
  156. if (!T->isSized() ||
  157. NewOffset > GV->getParent()->getDataLayout().getTypeAllocSize(T))
  158. return false;
  159. MatchInfo = std::make_pair(NewOffset, MinOffset);
  160. return true;
  161. }
  162. static bool applyFoldGlobalOffset(MachineInstr &MI, MachineRegisterInfo &MRI,
  163. MachineIRBuilder &B,
  164. GISelChangeObserver &Observer,
  165. std::pair<uint64_t, uint64_t> &MatchInfo) {
  166. // Change:
  167. //
  168. // %g = G_GLOBAL_VALUE @x
  169. // %ptr1 = G_PTR_ADD %g, cst1
  170. // %ptr2 = G_PTR_ADD %g, cst2
  171. // ...
  172. // %ptrN = G_PTR_ADD %g, cstN
  173. //
  174. // To:
  175. //
  176. // %offset_g = G_GLOBAL_VALUE @x + min_cst
  177. // %g = G_PTR_ADD %offset_g, -min_cst
  178. // %ptr1 = G_PTR_ADD %g, cst1
  179. // ...
  180. // %ptrN = G_PTR_ADD %g, cstN
  181. //
  182. // Then, the original G_PTR_ADDs should be folded later on so that they look
  183. // like this:
  184. //
  185. // %ptrN = G_PTR_ADD %offset_g, cstN - min_cst
  186. uint64_t Offset, MinOffset;
  187. std::tie(Offset, MinOffset) = MatchInfo;
  188. B.setInstrAndDebugLoc(MI);
  189. Observer.changingInstr(MI);
  190. auto &GlobalOp = MI.getOperand(1);
  191. auto *GV = GlobalOp.getGlobal();
  192. GlobalOp.ChangeToGA(GV, Offset, GlobalOp.getTargetFlags());
  193. Register Dst = MI.getOperand(0).getReg();
  194. Register NewGVDst = MRI.cloneVirtualRegister(Dst);
  195. MI.getOperand(0).setReg(NewGVDst);
  196. Observer.changedInstr(MI);
  197. B.buildPtrAdd(
  198. Dst, NewGVDst,
  199. B.buildConstant(LLT::scalar(64), -static_cast<int64_t>(MinOffset)));
  200. return true;
  201. }
  202. static bool tryToSimplifyUADDO(MachineInstr &MI, MachineIRBuilder &B,
  203. CombinerHelper &Helper,
  204. GISelChangeObserver &Observer) {
  205. // Try simplify G_UADDO with 8 or 16 bit operands to wide G_ADD and TBNZ if
  206. // result is only used in the no-overflow case. It is restricted to cases
  207. // where we know that the high-bits of the operands are 0. If there's an
  208. // overflow, then the the 9th or 17th bit must be set, which can be checked
  209. // using TBNZ.
  210. //
  211. // Change (for UADDOs on 8 and 16 bits):
  212. //
  213. // %z0 = G_ASSERT_ZEXT _
  214. // %op0 = G_TRUNC %z0
  215. // %z1 = G_ASSERT_ZEXT _
  216. // %op1 = G_TRUNC %z1
  217. // %val, %cond = G_UADDO %op0, %op1
  218. // G_BRCOND %cond, %error.bb
  219. //
  220. // error.bb:
  221. // (no successors and no uses of %val)
  222. //
  223. // To:
  224. //
  225. // %z0 = G_ASSERT_ZEXT _
  226. // %z1 = G_ASSERT_ZEXT _
  227. // %add = G_ADD %z0, %z1
  228. // %val = G_TRUNC %add
  229. // %bit = G_AND %add, 1 << scalar-size-in-bits(%op1)
  230. // %cond = G_ICMP NE, %bit, 0
  231. // G_BRCOND %cond, %error.bb
  232. auto &MRI = *B.getMRI();
  233. MachineOperand *DefOp0 = MRI.getOneDef(MI.getOperand(2).getReg());
  234. MachineOperand *DefOp1 = MRI.getOneDef(MI.getOperand(3).getReg());
  235. Register Op0Wide;
  236. Register Op1Wide;
  237. if (!mi_match(DefOp0->getParent(), MRI, m_GTrunc(m_Reg(Op0Wide))) ||
  238. !mi_match(DefOp1->getParent(), MRI, m_GTrunc(m_Reg(Op1Wide))))
  239. return false;
  240. LLT WideTy0 = MRI.getType(Op0Wide);
  241. LLT WideTy1 = MRI.getType(Op1Wide);
  242. Register ResVal = MI.getOperand(0).getReg();
  243. LLT OpTy = MRI.getType(ResVal);
  244. MachineInstr *Op0WideDef = MRI.getVRegDef(Op0Wide);
  245. MachineInstr *Op1WideDef = MRI.getVRegDef(Op1Wide);
  246. unsigned OpTySize = OpTy.getScalarSizeInBits();
  247. // First check that the G_TRUNC feeding the G_UADDO are no-ops, because the
  248. // inputs have been zero-extended.
  249. if (Op0WideDef->getOpcode() != TargetOpcode::G_ASSERT_ZEXT ||
  250. Op1WideDef->getOpcode() != TargetOpcode::G_ASSERT_ZEXT ||
  251. OpTySize != Op0WideDef->getOperand(2).getImm() ||
  252. OpTySize != Op1WideDef->getOperand(2).getImm())
  253. return false;
  254. // Only scalar UADDO with either 8 or 16 bit operands are handled.
  255. if (!WideTy0.isScalar() || !WideTy1.isScalar() || WideTy0 != WideTy1 ||
  256. OpTySize >= WideTy0.getScalarSizeInBits() ||
  257. (OpTySize != 8 && OpTySize != 16))
  258. return false;
  259. // The overflow-status result must be used by a branch only.
  260. Register ResStatus = MI.getOperand(1).getReg();
  261. if (!MRI.hasOneNonDBGUse(ResStatus))
  262. return false;
  263. MachineInstr *CondUser = &*MRI.use_instr_nodbg_begin(ResStatus);
  264. if (CondUser->getOpcode() != TargetOpcode::G_BRCOND)
  265. return false;
  266. // Make sure the computed result is only used in the no-overflow blocks.
  267. MachineBasicBlock *CurrentMBB = MI.getParent();
  268. MachineBasicBlock *FailMBB = CondUser->getOperand(1).getMBB();
  269. if (!FailMBB->succ_empty() || CondUser->getParent() != CurrentMBB)
  270. return false;
  271. if (any_of(MRI.use_nodbg_instructions(ResVal),
  272. [&MI, FailMBB, CurrentMBB](MachineInstr &I) {
  273. return &MI != &I &&
  274. (I.getParent() == FailMBB || I.getParent() == CurrentMBB);
  275. }))
  276. return false;
  277. // Remove G_ADDO.
  278. B.setInstrAndDebugLoc(*MI.getNextNode());
  279. MI.eraseFromParent();
  280. // Emit wide add.
  281. Register AddDst = MRI.cloneVirtualRegister(Op0Wide);
  282. B.buildInstr(TargetOpcode::G_ADD, {AddDst}, {Op0Wide, Op1Wide});
  283. // Emit check of the 9th or 17th bit and update users (the branch). This will
  284. // later be folded to TBNZ.
  285. Register CondBit = MRI.cloneVirtualRegister(Op0Wide);
  286. B.buildAnd(
  287. CondBit, AddDst,
  288. B.buildConstant(LLT::scalar(32), OpTySize == 8 ? 1 << 8 : 1 << 16));
  289. B.buildICmp(CmpInst::ICMP_NE, ResStatus, CondBit,
  290. B.buildConstant(LLT::scalar(32), 0));
  291. // Update ZEXts users of the result value. Because all uses are in the
  292. // no-overflow case, we know that the top bits are 0 and we can ignore ZExts.
  293. B.buildZExtOrTrunc(ResVal, AddDst);
  294. for (MachineOperand &U : make_early_inc_range(MRI.use_operands(ResVal))) {
  295. Register WideReg;
  296. if (mi_match(U.getParent(), MRI, m_GZExt(m_Reg(WideReg)))) {
  297. auto OldR = U.getParent()->getOperand(0).getReg();
  298. Observer.erasingInstr(*U.getParent());
  299. U.getParent()->eraseFromParent();
  300. Helper.replaceRegWith(MRI, OldR, AddDst);
  301. }
  302. }
  303. return true;
  304. }
  305. class AArch64PreLegalizerCombinerHelperState {
  306. protected:
  307. CombinerHelper &Helper;
  308. public:
  309. AArch64PreLegalizerCombinerHelperState(CombinerHelper &Helper)
  310. : Helper(Helper) {}
  311. };
  312. #define AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_DEPS
  313. #include "AArch64GenPreLegalizeGICombiner.inc"
  314. #undef AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_DEPS
  315. namespace {
  316. #define AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_H
  317. #include "AArch64GenPreLegalizeGICombiner.inc"
  318. #undef AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_H
  319. class AArch64PreLegalizerCombinerInfo : public CombinerInfo {
  320. GISelKnownBits *KB;
  321. MachineDominatorTree *MDT;
  322. AArch64GenPreLegalizerCombinerHelperRuleConfig GeneratedRuleCfg;
  323. public:
  324. AArch64PreLegalizerCombinerInfo(bool EnableOpt, bool OptSize, bool MinSize,
  325. GISelKnownBits *KB, MachineDominatorTree *MDT)
  326. : CombinerInfo(/*AllowIllegalOps*/ true, /*ShouldLegalizeIllegal*/ false,
  327. /*LegalizerInfo*/ nullptr, EnableOpt, OptSize, MinSize),
  328. KB(KB), MDT(MDT) {
  329. if (!GeneratedRuleCfg.parseCommandLineOption())
  330. report_fatal_error("Invalid rule identifier");
  331. }
  332. bool combine(GISelChangeObserver &Observer, MachineInstr &MI,
  333. MachineIRBuilder &B) const override;
  334. };
  335. bool AArch64PreLegalizerCombinerInfo::combine(GISelChangeObserver &Observer,
  336. MachineInstr &MI,
  337. MachineIRBuilder &B) const {
  338. const auto *LI = MI.getMF()->getSubtarget().getLegalizerInfo();
  339. CombinerHelper Helper(Observer, B, /* IsPreLegalize*/ true, KB, MDT, LI);
  340. AArch64GenPreLegalizerCombinerHelper Generated(GeneratedRuleCfg, Helper);
  341. if (Generated.tryCombineAll(Observer, MI, B))
  342. return true;
  343. unsigned Opc = MI.getOpcode();
  344. switch (Opc) {
  345. case TargetOpcode::G_CONCAT_VECTORS:
  346. return Helper.tryCombineConcatVectors(MI);
  347. case TargetOpcode::G_SHUFFLE_VECTOR:
  348. return Helper.tryCombineShuffleVector(MI);
  349. case TargetOpcode::G_UADDO:
  350. return tryToSimplifyUADDO(MI, B, Helper, Observer);
  351. case TargetOpcode::G_MEMCPY_INLINE:
  352. return Helper.tryEmitMemcpyInline(MI);
  353. case TargetOpcode::G_MEMCPY:
  354. case TargetOpcode::G_MEMMOVE:
  355. case TargetOpcode::G_MEMSET: {
  356. // If we're at -O0 set a maxlen of 32 to inline, otherwise let the other
  357. // heuristics decide.
  358. unsigned MaxLen = EnableOpt ? 0 : 32;
  359. // Try to inline memcpy type calls if optimizations are enabled.
  360. if (Helper.tryCombineMemCpyFamily(MI, MaxLen))
  361. return true;
  362. if (Opc == TargetOpcode::G_MEMSET)
  363. return llvm::AArch64GISelUtils::tryEmitBZero(MI, B, EnableMinSize);
  364. return false;
  365. }
  366. }
  367. return false;
  368. }
  369. #define AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_CPP
  370. #include "AArch64GenPreLegalizeGICombiner.inc"
  371. #undef AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_CPP
  372. // Pass boilerplate
  373. // ================
  374. class AArch64PreLegalizerCombiner : public MachineFunctionPass {
  375. public:
  376. static char ID;
  377. AArch64PreLegalizerCombiner();
  378. StringRef getPassName() const override { return "AArch64PreLegalizerCombiner"; }
  379. bool runOnMachineFunction(MachineFunction &MF) override;
  380. void getAnalysisUsage(AnalysisUsage &AU) const override;
  381. };
  382. } // end anonymous namespace
  383. void AArch64PreLegalizerCombiner::getAnalysisUsage(AnalysisUsage &AU) const {
  384. AU.addRequired<TargetPassConfig>();
  385. AU.setPreservesCFG();
  386. getSelectionDAGFallbackAnalysisUsage(AU);
  387. AU.addRequired<GISelKnownBitsAnalysis>();
  388. AU.addPreserved<GISelKnownBitsAnalysis>();
  389. AU.addRequired<MachineDominatorTree>();
  390. AU.addPreserved<MachineDominatorTree>();
  391. AU.addRequired<GISelCSEAnalysisWrapperPass>();
  392. AU.addPreserved<GISelCSEAnalysisWrapperPass>();
  393. MachineFunctionPass::getAnalysisUsage(AU);
  394. }
  395. AArch64PreLegalizerCombiner::AArch64PreLegalizerCombiner()
  396. : MachineFunctionPass(ID) {
  397. initializeAArch64PreLegalizerCombinerPass(*PassRegistry::getPassRegistry());
  398. }
  399. bool AArch64PreLegalizerCombiner::runOnMachineFunction(MachineFunction &MF) {
  400. if (MF.getProperties().hasProperty(
  401. MachineFunctionProperties::Property::FailedISel))
  402. return false;
  403. auto &TPC = getAnalysis<TargetPassConfig>();
  404. // Enable CSE.
  405. GISelCSEAnalysisWrapper &Wrapper =
  406. getAnalysis<GISelCSEAnalysisWrapperPass>().getCSEWrapper();
  407. auto *CSEInfo = &Wrapper.get(TPC.getCSEConfig());
  408. const Function &F = MF.getFunction();
  409. bool EnableOpt =
  410. MF.getTarget().getOptLevel() != CodeGenOpt::None && !skipFunction(F);
  411. GISelKnownBits *KB = &getAnalysis<GISelKnownBitsAnalysis>().get(MF);
  412. MachineDominatorTree *MDT = &getAnalysis<MachineDominatorTree>();
  413. AArch64PreLegalizerCombinerInfo PCInfo(EnableOpt, F.hasOptSize(),
  414. F.hasMinSize(), KB, MDT);
  415. Combiner C(PCInfo, &TPC);
  416. return C.combineMachineInstrs(MF, CSEInfo);
  417. }
  418. char AArch64PreLegalizerCombiner::ID = 0;
  419. INITIALIZE_PASS_BEGIN(AArch64PreLegalizerCombiner, DEBUG_TYPE,
  420. "Combine AArch64 machine instrs before legalization",
  421. false, false)
  422. INITIALIZE_PASS_DEPENDENCY(TargetPassConfig)
  423. INITIALIZE_PASS_DEPENDENCY(GISelKnownBitsAnalysis)
  424. INITIALIZE_PASS_DEPENDENCY(GISelCSEAnalysisWrapperPass)
  425. INITIALIZE_PASS_END(AArch64PreLegalizerCombiner, DEBUG_TYPE,
  426. "Combine AArch64 machine instrs before legalization", false,
  427. false)
  428. namespace llvm {
  429. FunctionPass *createAArch64PreLegalizerCombiner() {
  430. return new AArch64PreLegalizerCombiner();
  431. }
  432. } // end namespace llvm