//===- AVRShift.cpp - Shift Expansion Pass --------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // /// \file /// Expand non-8-bit and non-16-bit shift instructions (shl, lshr, ashr) to /// inline loops, just like avr-gcc. This must be done in IR because otherwise /// the type legalizer will turn 32-bit shifts into (non-existing) library calls /// such as __ashlsi3. // //===----------------------------------------------------------------------===// #include "AVR.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/InstIterator.h" usingnamespacellvm; namespace { class AVRShiftExpand : public FunctionPass { … }; } // end of anonymous namespace char AVRShiftExpand::ID = …; INITIALIZE_PASS(…) Pass *llvm::createAVRShiftExpandPass() { … } bool AVRShiftExpand::runOnFunction(Function &F) { … } void AVRShiftExpand::expand(BinaryOperator *BI) { … }