#include "X86.h"
#include "X86InstrFoldTables.h"
#include "X86InstrInfo.h"
#include "X86Subtarget.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineConstantPool.h"
usingnamespacellvm;
#define DEBUG_TYPE …
STATISTIC(NumInstChanges, "Number of instructions changes");
namespace {
class X86FixupVectorConstantsPass : public MachineFunctionPass { … };
}
char X86FixupVectorConstantsPass::ID = …;
INITIALIZE_PASS(…)
FunctionPass *llvm::createX86FixupVectorConstants() { … }
static Constant *getSplatValueAllowUndef(const ConstantVector *C) { … }
static std::optional<APInt> extractConstantBits(const Constant *C) { … }
static std::optional<APInt> extractConstantBits(const Constant *C,
unsigned NumBits) { … }
static std::optional<APInt> getSplatableConstant(const Constant *C,
unsigned SplatBitWidth) { … }
static Constant *rebuildConstant(LLVMContext &Ctx, Type *SclTy,
const APInt &Bits, unsigned NumSclBits) { … }
static Constant *rebuildSplatCst(const Constant *C, unsigned ,
unsigned , unsigned SplatBitWidth) { … }
static Constant *rebuildZeroUpperCst(const Constant *C, unsigned NumBits,
unsigned ,
unsigned ScalarBitWidth) { … }
static Constant *rebuildExtCst(const Constant *C, bool IsSExt,
unsigned NumBits, unsigned NumElts,
unsigned SrcEltBitWidth) { … }
static Constant *rebuildSExtCst(const Constant *C, unsigned NumBits,
unsigned NumElts, unsigned SrcEltBitWidth) { … }
static Constant *rebuildZExtCst(const Constant *C, unsigned NumBits,
unsigned NumElts, unsigned SrcEltBitWidth) { … }
bool X86FixupVectorConstantsPass::processInstruction(MachineFunction &MF,
MachineBasicBlock &MBB,
MachineInstr &MI) { … }
bool X86FixupVectorConstantsPass::runOnMachineFunction(MachineFunction &MF) { … }