//===------- X86ExpandPseudo.cpp - Expand pseudo instructions -------------===// // // 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 contains a pass that expands pseudo instructions into target // instructions to allow proper scheduling, if-conversion, other late // optimizations, or simply the encoding of the instructions. // //===----------------------------------------------------------------------===// #include "X86.h" #include "X86FrameLowering.h" #include "X86InstrBuilder.h" #include "X86InstrInfo.h" #include "X86MachineFunctionInfo.h" #include "X86Subtarget.h" #include "llvm/CodeGen/LivePhysRegs.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/Passes.h" // For IDs of passes that are preserved. #include "llvm/IR/EHPersonalities.h" #include "llvm/IR/GlobalValue.h" #include "llvm/Target/TargetMachine.h" usingnamespacellvm; #define DEBUG_TYPE … #define X86_EXPAND_PSEUDO_NAME … namespace { class X86ExpandPseudo : public MachineFunctionPass { … }; char X86ExpandPseudo::ID = …; } // End anonymous namespace. INITIALIZE_PASS(…) void X86ExpandPseudo::expandICallBranchFunnel( MachineBasicBlock *MBB, MachineBasicBlock::iterator MBBI) { … } void X86ExpandPseudo::expandCALL_RVMARKER(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) { … } /// If \p MBBI is a pseudo instruction, this method expands /// it to the corresponding (sequence of) actual instruction(s). /// \returns true if \p MBBI has been expanded. bool X86ExpandPseudo::expandMI(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) { … } // This function creates additional block for storing varargs guarded // registers. It adds check for %al into entry block, to skip // GuardedRegsBlk if xmm registers should not be stored. // // EntryBlk[VAStartPseudoInstr] EntryBlk // | | . // | | . // | | GuardedRegsBlk // | => | . // | | . // | TailBlk // | | // | | // void X86ExpandPseudo::expandVastartSaveXmmRegs( MachineBasicBlock *EntryBlk, MachineBasicBlock::iterator VAStartPseudoInstr) const { … } /// Expand all pseudo instructions contained in \p MBB. /// \returns true if any expansion occurred for \p MBB. bool X86ExpandPseudo::expandMBB(MachineBasicBlock &MBB) { … } bool X86ExpandPseudo::expandPseudosWhichAffectControlFlow(MachineFunction &MF) { … } bool X86ExpandPseudo::runOnMachineFunction(MachineFunction &MF) { … } /// Returns an instance of the pseudo instruction expansion pass. FunctionPass *llvm::createX86ExpandPseudoPass() { … }