003 File Manager
Current Path:
/usr/src/contrib/llvm-project/llvm/lib/Target/ARC
usr
/
src
/
contrib
/
llvm-project
/
llvm
/
lib
/
Target
/
ARC
/
📁
..
📄
ARC.h
(1.04 KB)
📄
ARC.td
(707 B)
📄
ARCAsmPrinter.cpp
(2.25 KB)
📄
ARCBranchFinalize.cpp
(5.37 KB)
📄
ARCCallingConv.td
(1.7 KB)
📄
ARCExpandPseudos.cpp
(2.94 KB)
📄
ARCFrameLowering.cpp
(18.97 KB)
📄
ARCFrameLowering.h
(2.78 KB)
📄
ARCISelDAGToDAG.cpp
(6.16 KB)
📄
ARCISelLowering.cpp
(28.15 KB)
📄
ARCISelLowering.h
(4.09 KB)
📄
ARCInstrFormats.td
(26.21 KB)
📄
ARCInstrInfo.cpp
(14.94 KB)
📄
ARCInstrInfo.h
(4.15 KB)
📄
ARCInstrInfo.td
(34.68 KB)
📄
ARCMCInstLower.cpp
(3.67 KB)
📄
ARCMCInstLower.h
(1.29 KB)
📄
ARCMachineFunctionInfo.cpp
(464 B)
📄
ARCMachineFunctionInfo.h
(1.87 KB)
📄
ARCOptAddrMode.cpp
(16.16 KB)
📄
ARCRegisterInfo.cpp
(8 KB)
📄
ARCRegisterInfo.h
(1.78 KB)
📄
ARCRegisterInfo.td
(2.89 KB)
📄
ARCSubtarget.cpp
(1.02 KB)
📄
ARCSubtarget.h
(2.03 KB)
📄
ARCTargetMachine.cpp
(2.98 KB)
📄
ARCTargetMachine.h
(1.64 KB)
📄
ARCTargetStreamer.h
(726 B)
📄
ARCTargetTransformInfo.h
(1.92 KB)
📁
Disassembler
📁
MCTargetDesc
📁
TargetInfo
Editing: ARCExpandPseudos.cpp
//===- ARCExpandPseudosPass - ARC expand pseudo loads -----------*- C++ -*-===// // // 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 pass expands stores with large offsets into an appropriate sequence. //===----------------------------------------------------------------------===// #include "ARC.h" #include "ARCInstrInfo.h" #include "ARCRegisterInfo.h" #include "ARCSubtarget.h" #include "llvm/ADT/Statistic.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" using namespace llvm; #define DEBUG_TYPE "arc-expand-pseudos" namespace { class ARCExpandPseudos : public MachineFunctionPass { public: static char ID; ARCExpandPseudos() : MachineFunctionPass(ID) {} bool runOnMachineFunction(MachineFunction &Fn) override; StringRef getPassName() const override { return "ARC Expand Pseudos"; } private: void ExpandStore(MachineFunction &, MachineBasicBlock::iterator); const ARCInstrInfo *TII; }; char ARCExpandPseudos::ID = 0; } // end anonymous namespace static unsigned getMappedOp(unsigned PseudoOp) { switch (PseudoOp) { case ARC::ST_FAR: return ARC::ST_rs9; case ARC::STH_FAR: return ARC::STH_rs9; case ARC::STB_FAR: return ARC::STB_rs9; default: llvm_unreachable("Unhandled pseudo op."); } } void ARCExpandPseudos::ExpandStore(MachineFunction &MF, MachineBasicBlock::iterator SII) { MachineInstr &SI = *SII; unsigned AddrReg = MF.getRegInfo().createVirtualRegister(&ARC::GPR32RegClass); unsigned AddOpc = isUInt<6>(SI.getOperand(2).getImm()) ? ARC::ADD_rru6 : ARC::ADD_rrlimm; BuildMI(*SI.getParent(), SI, SI.getDebugLoc(), TII->get(AddOpc), AddrReg) .addReg(SI.getOperand(1).getReg()) .addImm(SI.getOperand(2).getImm()); BuildMI(*SI.getParent(), SI, SI.getDebugLoc(), TII->get(getMappedOp(SI.getOpcode()))) .addReg(SI.getOperand(0).getReg()) .addReg(AddrReg) .addImm(0); SI.eraseFromParent(); } bool ARCExpandPseudos::runOnMachineFunction(MachineFunction &MF) { const ARCSubtarget *STI = &MF.getSubtarget<ARCSubtarget>(); TII = STI->getInstrInfo(); bool ExpandedStore = false; for (auto &MBB : MF) { MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end(); while (MBBI != E) { MachineBasicBlock::iterator NMBBI = std::next(MBBI); switch (MBBI->getOpcode()) { case ARC::ST_FAR: case ARC::STH_FAR: case ARC::STB_FAR: ExpandStore(MF, MBBI); ExpandedStore = true; break; default: break; } MBBI = NMBBI; } } return ExpandedStore; } FunctionPass *llvm::createARCExpandPseudosPass() { return new ARCExpandPseudos(); }
Upload File
Create Folder