//===-- SparcISelDAGToDAG.cpp - A dag to dag inst selector for Sparc ------===// // // 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 // //===----------------------------------------------------------------------===// // // This file defines an instruction selector for the SPARC target. // //===----------------------------------------------------------------------===// #include "SparcTargetMachine.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/IR/Intrinsics.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" usingnamespacellvm; #define DEBUG_TYPE … #define PASS_NAME … //===----------------------------------------------------------------------===// // Instruction Selector Implementation //===----------------------------------------------------------------------===// //===--------------------------------------------------------------------===// /// SparcDAGToDAGISel - SPARC specific code to select SPARC machine /// instructions for SelectionDAG operations. /// namespace { class SparcDAGToDAGISel : public SelectionDAGISel { … }; class SparcDAGToDAGISelLegacy : public SelectionDAGISelLegacy { … }; } // end anonymous namespace char SparcDAGToDAGISelLegacy::ID = …; INITIALIZE_PASS(…) SDNode* SparcDAGToDAGISel::getGlobalBaseReg() { … } bool SparcDAGToDAGISel::SelectADDRri(SDValue Addr, SDValue &Base, SDValue &Offset) { … } bool SparcDAGToDAGISel::SelectADDRrr(SDValue Addr, SDValue &R1, SDValue &R2) { … } // Re-assemble i64 arguments split up in SelectionDAGBuilder's // visitInlineAsm / GetRegistersForValue functions. // // Note: This function was copied from, and is essentially identical // to ARMISelDAGToDAG::SelectInlineAsm. It is very unfortunate that // such hacking-up is necessary; a rethink of how inline asm operands // are handled may be in order to make doing this more sane. // // TODO: fix inline asm support so I can simply tell it that 'i64' // inputs to asm need to be allocated to the IntPair register type, // and have that work. Then, delete this function. bool SparcDAGToDAGISel::tryInlineAsm(SDNode *N){ … } void SparcDAGToDAGISel::Select(SDNode *N) { … } /// SelectInlineAsmMemoryOperand - Implement addressing mode selection for /// inline asm expressions. bool SparcDAGToDAGISel::SelectInlineAsmMemoryOperand( const SDValue &Op, InlineAsm::ConstraintCode ConstraintID, std::vector<SDValue> &OutOps) { … } /// createSparcISelDag - This pass converts a legalized DAG into a /// SPARC-specific DAG, ready for instruction scheduling. /// FunctionPass *llvm::createSparcISelDag(SparcTargetMachine &TM) { … }