mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-14 23:29:51 +00:00
[ARM] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 313823
This commit is contained in:
parent
f0d32a3057
commit
b8390011ca
@ -1,4 +1,4 @@
|
||||
//===-- llvm/lib/Target/ARM/ARMCallLowering.cpp - Call lowering -----------===//
|
||||
//===- llvm/lib/Target/ARM/ARMCallLowering.cpp - Call lowering ------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -6,23 +6,47 @@
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
//
|
||||
/// \file
|
||||
/// This file implements the lowering of LLVM calls to machine code calls for
|
||||
/// GlobalISel.
|
||||
///
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "ARMCallLowering.h"
|
||||
|
||||
#include "ARMBaseInstrInfo.h"
|
||||
#include "ARMISelLowering.h"
|
||||
#include "ARMSubtarget.h"
|
||||
|
||||
#include "Utils/ARMBaseInfo.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/CodeGen/Analysis.h"
|
||||
#include "llvm/CodeGen/CallingConvLower.h"
|
||||
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
|
||||
#include "llvm/CodeGen/GlobalISel/Utils.h"
|
||||
#include "llvm/CodeGen/LowLevelType.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/MachineValueType.h"
|
||||
#include "llvm/CodeGen/ValueTypes.h"
|
||||
#include "llvm/IR/Attributes.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/LowLevelTypeImpl.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -59,12 +83,13 @@ static bool isSupportedType(const DataLayout &DL, const ARMTargetLowering &TLI,
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
/// Helper class for values going out through an ABI boundary (used for handling
|
||||
/// function return values and call parameters).
|
||||
struct OutgoingValueHandler : public CallLowering::ValueHandler {
|
||||
OutgoingValueHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI,
|
||||
MachineInstrBuilder &MIB, CCAssignFn *AssignFn)
|
||||
: ValueHandler(MIRBuilder, MRI, AssignFn), MIB(MIB), StackSize(0) {}
|
||||
: ValueHandler(MIRBuilder, MRI, AssignFn), MIB(MIB) {}
|
||||
|
||||
unsigned getStackAddress(uint64_t Size, int64_t Offset,
|
||||
MachinePointerInfo &MPO) override {
|
||||
@ -153,9 +178,10 @@ struct OutgoingValueHandler : public CallLowering::ValueHandler {
|
||||
}
|
||||
|
||||
MachineInstrBuilder &MIB;
|
||||
uint64_t StackSize;
|
||||
uint64_t StackSize = 0;
|
||||
};
|
||||
} // End anonymous namespace.
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
void ARMCallLowering::splitToValueTypes(
|
||||
const ArgInfo &OrigArg, SmallVectorImpl<ArgInfo> &SplitArgs,
|
||||
@ -259,6 +285,7 @@ bool ARMCallLowering::lowerReturn(MachineIRBuilder &MIRBuilder,
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
/// Helper class for values coming in through an ABI boundary (used for handling
|
||||
/// formal arguments and call return values).
|
||||
struct IncomingValueHandler : public CallLowering::ValueHandler {
|
||||
@ -371,7 +398,8 @@ struct FormalArgHandler : public IncomingValueHandler {
|
||||
MIRBuilder.getMBB().addLiveIn(PhysReg);
|
||||
}
|
||||
};
|
||||
} // End anonymous namespace
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
bool ARMCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
|
||||
const Function &F,
|
||||
@ -429,6 +457,7 @@ bool ARMCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
struct CallReturnHandler : public IncomingValueHandler {
|
||||
CallReturnHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI,
|
||||
MachineInstrBuilder MIB, CCAssignFn *AssignFn)
|
||||
@ -440,7 +469,8 @@ struct CallReturnHandler : public IncomingValueHandler {
|
||||
|
||||
MachineInstrBuilder MIB;
|
||||
};
|
||||
} // End anonymous namespace.
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
bool ARMCallLowering::lowerCall(MachineIRBuilder &MIRBuilder,
|
||||
CallingConv::ID CallConv,
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/lib/Target/ARM/ARMCallLowering.h - Call lowering -------------===//
|
||||
//===- llvm/lib/Target/ARM/ARMCallLowering.h - Call lowering ----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -6,23 +6,28 @@
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
//
|
||||
/// \file
|
||||
/// This file describes how to lower LLVM calls to machine code calls.
|
||||
///
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIB_TARGET_ARM_ARMCALLLOWERING
|
||||
#define LLVM_LIB_TARGET_ARM_ARMCALLLOWERING
|
||||
#ifndef LLVM_LIB_TARGET_ARM_ARMCALLLOWERING_H
|
||||
#define LLVM_LIB_TARGET_ARM_ARMCALLLOWERING_H
|
||||
|
||||
#include "llvm/CodeGen/CallingConvLower.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/CodeGen/GlobalISel/CallLowering.h"
|
||||
#include "llvm/CodeGen/ValueTypes.h"
|
||||
#include "llvm/IR/CallingConv.h"
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class ARMTargetLowering;
|
||||
class MachineFunction;
|
||||
class MachineInstrBuilder;
|
||||
class MachineIRBuilder;
|
||||
class Value;
|
||||
|
||||
class ARMCallLowering : public CallLowering {
|
||||
public:
|
||||
@ -42,7 +47,7 @@ private:
|
||||
bool lowerReturnVal(MachineIRBuilder &MIRBuilder, const Value *Val,
|
||||
unsigned VReg, MachineInstrBuilder &Ret) const;
|
||||
|
||||
typedef std::function<void(unsigned Reg, uint64_t Offset)> SplitArgTy;
|
||||
using SplitArgTy = std::function<void(unsigned Reg, uint64_t Offset)>;
|
||||
|
||||
/// Split an argument into one or more arguments that the CC lowering can cope
|
||||
/// with (e.g. replace pointers with integers).
|
||||
@ -51,5 +56,7 @@ private:
|
||||
MachineFunction &MF,
|
||||
const SplitArgTy &PerformArgSplit) const;
|
||||
};
|
||||
} // End of namespace llvm
|
||||
#endif
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_LIB_TARGET_ARM_ARMCALLLOWERING_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- ARMConstantIslandPass.cpp - ARM constant islands ------------------===//
|
||||
//===- ARMConstantIslandPass.cpp - ARM constant islands -------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -20,6 +20,7 @@
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMBaseInfo.h"
|
||||
#include "Thumb2InstrInfo.h"
|
||||
#include "Utils/ARMBaseInfo.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
@ -37,6 +38,7 @@
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/MC/MCInstrDesc.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
@ -48,7 +50,6 @@
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <new>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -107,7 +108,7 @@ namespace {
|
||||
/// previous iteration by inserting unconditional branches.
|
||||
SmallSet<MachineBasicBlock*, 4> NewWaterList;
|
||||
|
||||
typedef std::vector<MachineBasicBlock*>::iterator water_iterator;
|
||||
using water_iterator = std::vector<MachineBasicBlock *>::iterator;
|
||||
|
||||
/// CPUser - One user of a constant pool, keeping the machine instruction
|
||||
/// pointer, the constant pool being referenced, and the max displacement
|
||||
@ -128,12 +129,11 @@ namespace {
|
||||
unsigned MaxDisp;
|
||||
bool NegOk;
|
||||
bool IsSoImm;
|
||||
bool KnownAlignment;
|
||||
bool KnownAlignment = false;
|
||||
|
||||
CPUser(MachineInstr *mi, MachineInstr *cpemi, unsigned maxdisp,
|
||||
bool neg, bool soimm)
|
||||
: MI(mi), CPEMI(cpemi), MaxDisp(maxdisp), NegOk(neg), IsSoImm(soimm),
|
||||
KnownAlignment(false) {
|
||||
: MI(mi), CPEMI(cpemi), MaxDisp(maxdisp), NegOk(neg), IsSoImm(soimm) {
|
||||
HighWaterMark = CPEMI->getParent();
|
||||
}
|
||||
|
||||
@ -195,11 +195,9 @@ namespace {
|
||||
};
|
||||
|
||||
/// ImmBranches - Keep track of all the immediate branch instructions.
|
||||
///
|
||||
std::vector<ImmBranch> ImmBranches;
|
||||
|
||||
/// PushPopMIs - Keep track of all the Thumb push / pop instructions.
|
||||
///
|
||||
SmallVector<MachineInstr*, 4> PushPopMIs;
|
||||
|
||||
/// T2JumpTables - Keep track of all the Thumb2 jumptable instructions.
|
||||
@ -290,10 +288,10 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
char ARMConstantIslands::ID = 0;
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
char ARMConstantIslands::ID = 0;
|
||||
|
||||
/// verify - check BBOffsets, BBSizes, alignment of islands
|
||||
void ARMConstantIslands::verify() {
|
||||
#ifndef NDEBUG
|
||||
@ -629,9 +627,9 @@ bool ARMConstantIslands::BBHasFallthrough(MachineBasicBlock *MBB) {
|
||||
|
||||
/// findConstPoolEntry - Given the constpool index and CONSTPOOL_ENTRY MI,
|
||||
/// look up the corresponding CPEntry.
|
||||
ARMConstantIslands::CPEntry
|
||||
*ARMConstantIslands::findConstPoolEntry(unsigned CPI,
|
||||
const MachineInstr *CPEMI) {
|
||||
ARMConstantIslands::CPEntry *
|
||||
ARMConstantIslands::findConstPoolEntry(unsigned CPI,
|
||||
const MachineInstr *CPEMI) {
|
||||
std::vector<CPEntry> &CPEs = CPEntries[CPI];
|
||||
// Number of entries per constpool index should be small, just do a
|
||||
// linear search.
|
||||
@ -1126,7 +1124,6 @@ void ARMConstantIslands::adjustBBOffsetsAfter(MachineBasicBlock *BB) {
|
||||
/// and instruction CPEMI, and decrement its refcount. If the refcount
|
||||
/// becomes 0 remove the entry and instruction. Returns true if we removed
|
||||
/// the entry, false if we didn't.
|
||||
|
||||
bool ARMConstantIslands::decrementCPEReferenceCount(unsigned CPI,
|
||||
MachineInstr *CPEMI) {
|
||||
// Find the old entry. Eliminate it if it is no longer used.
|
||||
@ -1154,8 +1151,7 @@ unsigned ARMConstantIslands::getCombinedIndex(const MachineInstr *CPEMI) {
|
||||
/// 0 = no existing entry found
|
||||
/// 1 = entry found, and there were no code insertions or deletions
|
||||
/// 2 = entry found, and there were code insertions or deletions
|
||||
int ARMConstantIslands::findInRangeCPEntry(CPUser& U, unsigned UserOffset)
|
||||
{
|
||||
int ARMConstantIslands::findInRangeCPEntry(CPUser& U, unsigned UserOffset) {
|
||||
MachineInstr *UserMI = U.MI;
|
||||
MachineInstr *CPEMI = U.CPEMI;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- ARMConstantPoolValue.cpp - ARM constantpool value -----------------===//
|
||||
//===- ARMConstantPoolValue.cpp - ARM constantpool value ------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -13,7 +13,6 @@
|
||||
|
||||
#include "ARMConstantPoolValue.h"
|
||||
#include "llvm/ADT/FoldingSet.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/IR/Constant.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- ARMConstantPoolValue.h - ARM constantpool value ---------*- C++ -*-===//
|
||||
//===- ARMConstantPoolValue.h - ARM constantpool value ----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -14,8 +14,9 @@
|
||||
#ifndef LLVM_LIB_TARGET_ARM_ARMCONSTANTPOOLVALUE_H
|
||||
#define LLVM_LIB_TARGET_ARM_ARMCONSTANTPOOLVALUE_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/CodeGen/MachineConstantPool.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include <string>
|
||||
@ -29,6 +30,8 @@ class GlobalValue;
|
||||
class GlobalVariable;
|
||||
class LLVMContext;
|
||||
class MachineBasicBlock;
|
||||
class raw_ostream;
|
||||
class Type;
|
||||
|
||||
namespace ARMCP {
|
||||
|
||||
@ -174,7 +177,8 @@ public:
|
||||
const GlobalValue *getGV() const;
|
||||
const BlockAddress *getBlockAddress() const;
|
||||
|
||||
typedef SmallPtrSet<const GlobalVariable *, 1>::iterator promoted_iterator;
|
||||
using promoted_iterator = SmallPtrSet<const GlobalVariable *, 1>::iterator;
|
||||
|
||||
iterator_range<promoted_iterator> promotedGlobals() {
|
||||
return iterator_range<promoted_iterator>(GVars.begin(), GVars.end());
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- ARMFastISel.cpp - ARM FastISel implementation ---------------------===//
|
||||
//===- ARMFastISel.cpp - ARM FastISel implementation ----------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -23,17 +23,19 @@
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMAddressingModes.h"
|
||||
#include "MCTargetDesc/ARMBaseInfo.h"
|
||||
#include "Utils/ARMBaseInfo.h"
|
||||
#include "llvm/ADT/APFloat.h"
|
||||
#include "llvm/ADT/APInt.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/CodeGen/CallingConvLower.h"
|
||||
#include "llvm/CodeGen/FastISel.h"
|
||||
#include "llvm/CodeGen/FunctionLoweringInfo.h"
|
||||
#include "llvm/CodeGen/ISDOpcodes.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineConstantPool.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||
@ -58,6 +60,7 @@
|
||||
#include "llvm/IR/Instruction.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Operator.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
@ -72,7 +75,9 @@
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetLowering.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetOpcodes.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
@ -82,7 +87,7 @@ using namespace llvm;
|
||||
namespace {
|
||||
|
||||
// All possible address modes, plus some.
|
||||
typedef struct Address {
|
||||
struct Address {
|
||||
enum {
|
||||
RegBase,
|
||||
FrameIndexBase
|
||||
@ -99,7 +104,7 @@ namespace {
|
||||
Address() {
|
||||
Base.Reg = 0;
|
||||
}
|
||||
} Address;
|
||||
};
|
||||
|
||||
class ARMFastISel final : public FastISel {
|
||||
/// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
|
||||
@ -2890,13 +2895,11 @@ bool ARMFastISel::fastSelectInstruction(const Instruction *I) {
|
||||
return false;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
// This table describes sign- and zero-extend instructions which can be
|
||||
// folded into a preceding load. All of these extends have an immediate
|
||||
// (sometimes a mask and sometimes a shift) that's applied after
|
||||
// extension.
|
||||
const struct FoldableLoadExtendsStruct {
|
||||
static const struct FoldableLoadExtendsStruct {
|
||||
uint16_t Opc[2]; // ARM, Thumb.
|
||||
uint8_t ExpectedImm;
|
||||
uint8_t isZExt : 1;
|
||||
@ -2909,8 +2912,6 @@ const struct FoldableLoadExtendsStruct {
|
||||
{ { ARM::UXTB, ARM::t2UXTB }, 0, 1, MVT::i8 }
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
/// \brief The specified machine instr operand is a vreg, and that
|
||||
/// vreg is being provided by the specified load instruction. If possible,
|
||||
/// try to fold the load as an operand to the instruction, returning true if
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- ARMFrameLowering.cpp - ARM Frame Information ----------------------===//
|
||||
//===- ARMFrameLowering.cpp - ARM Frame Information -----------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -19,6 +19,7 @@
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMAddressingModes.h"
|
||||
#include "MCTargetDesc/ARMBaseInfo.h"
|
||||
#include "Utils/ARMBaseInfo.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
@ -39,6 +40,7 @@
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/MC/MCInstrDesc.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
@ -49,6 +51,7 @@
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetOpcodes.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
@ -953,7 +956,8 @@ void ARMFrameLowering::emitPushInst(MachineBasicBlock &MBB,
|
||||
|
||||
DebugLoc DL;
|
||||
|
||||
typedef std::pair<unsigned, bool> RegAndKill;
|
||||
using RegAndKill = std::pair<unsigned, bool>;
|
||||
|
||||
SmallVector<RegAndKill, 4> Regs;
|
||||
unsigned i = CSI.size();
|
||||
while (i != 0) {
|
||||
@ -1525,7 +1529,6 @@ static unsigned estimateRSStackSizeLimit(MachineFunction &MF,
|
||||
// In functions that realign the stack, it can be an advantage to spill the
|
||||
// callee-saved vector registers after realigning the stack. The vst1 and vld1
|
||||
// instructions take alignment hints that can improve performance.
|
||||
//
|
||||
static void
|
||||
checkNumAlignedDPRCS2Regs(MachineFunction &MF, BitVector &SavedRegs) {
|
||||
MF.getInfo<ARMFunctionInfo>()->setNumAlignedDPRCS2Regs(0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
//==-- ARMTargetFrameLowering.h - Define frame lowering for ARM --*- C++ -*-==//
|
||||
//===- ARMTargetFrameLowering.h - Define frame lowering for ARM -*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -6,18 +6,19 @@
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
|
||||
#define LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
|
||||
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/Target/TargetFrameLowering.h"
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
class ARMSubtarget;
|
||||
|
||||
class ARMSubtarget;
|
||||
class CalleeSavedInfo;
|
||||
class MachineFunction;
|
||||
|
||||
class ARMFrameLowering : public TargetFrameLowering {
|
||||
protected:
|
||||
@ -62,7 +63,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void emitPushInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||
const std::vector<CalleeSavedInfo> &CSI, unsigned StmOpc,
|
||||
unsigned StrOpc, bool NoGap,
|
||||
@ -80,6 +81,6 @@ public:
|
||||
MachineBasicBlock::iterator MI) const override;
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- ARMISelLowering.cpp - ARM DAG Lowering Implementation -------------===//
|
||||
//===- ARMISelLowering.cpp - ARM DAG Lowering Implementation --------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -24,6 +24,7 @@
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMAddressingModes.h"
|
||||
#include "MCTargetDesc/ARMBaseInfo.h"
|
||||
#include "Utils/ARMBaseInfo.h"
|
||||
#include "llvm/ADT/APFloat.h"
|
||||
#include "llvm/ADT/APInt.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
@ -94,8 +95,12 @@
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetLowering.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetOpcodes.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
@ -1638,7 +1643,6 @@ SDValue ARMTargetLowering::LowerCallResult(
|
||||
const SmallVectorImpl<ISD::InputArg> &Ins, const SDLoc &dl,
|
||||
SelectionDAG &DAG, SmallVectorImpl<SDValue> &InVals, bool isThisReturn,
|
||||
SDValue ThisVal) const {
|
||||
|
||||
// Assign locations to each value returned by this call.
|
||||
SmallVector<CCValAssign, 16> RVLocs;
|
||||
CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(), RVLocs,
|
||||
@ -1736,7 +1740,6 @@ void ARMTargetLowering::PassF64ArgInRegs(const SDLoc &dl, SelectionDAG &DAG,
|
||||
SDValue &StackPtr,
|
||||
SmallVectorImpl<SDValue> &MemOpChains,
|
||||
ISD::ArgFlagsTy Flags) const {
|
||||
|
||||
SDValue fmrrd = DAG.getNode(ARMISD::VMOVRRD, dl,
|
||||
DAG.getVTList(MVT::i32, MVT::i32), Arg);
|
||||
unsigned id = Subtarget->isLittle() ? 0 : 1;
|
||||
@ -2444,7 +2447,6 @@ ARMTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
|
||||
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||
const SmallVectorImpl<SDValue> &OutVals,
|
||||
const SDLoc &dl, SelectionDAG &DAG) const {
|
||||
|
||||
// CCValAssign - represent the assignment of the return value to a location.
|
||||
SmallVector<CCValAssign, 16> RVLocs;
|
||||
|
||||
@ -3694,7 +3696,6 @@ SDValue ARMTargetLowering::LowerFormalArguments(
|
||||
DAG.getIntPtrConstant(1, dl));
|
||||
} else
|
||||
ArgValue = GetF64FormalArgument(VA, ArgLocs[++i], Chain, DAG, dl);
|
||||
|
||||
} else {
|
||||
const TargetRegisterClass *RC;
|
||||
|
||||
@ -3737,7 +3738,6 @@ SDValue ARMTargetLowering::LowerFormalArguments(
|
||||
}
|
||||
|
||||
InVals.push_back(ArgValue);
|
||||
|
||||
} else { // VA.isRegLoc()
|
||||
// sanity check
|
||||
assert(VA.isMemLoc());
|
||||
@ -4023,7 +4023,7 @@ SDValue ARMTargetLowering::LowerUnsignedALUO(SDValue Op,
|
||||
// Convert the carry flag into a boolean value.
|
||||
Overflow = ConvertCarryFlagToBooleanCarry(Value.getValue(1), VT, DAG);
|
||||
break;
|
||||
case ISD::USUBO: {
|
||||
case ISD::USUBO:
|
||||
Value = DAG.getNode(ARMISD::SUBC, dl, VTs, LHS, RHS);
|
||||
// Convert the carry flag into a boolean value.
|
||||
Overflow = ConvertCarryFlagToBooleanCarry(Value.getValue(1), VT, DAG);
|
||||
@ -4033,7 +4033,6 @@ SDValue ARMTargetLowering::LowerUnsignedALUO(SDValue Op,
|
||||
DAG.getConstant(1, dl, MVT::i32), Overflow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return DAG.getNode(ISD::MERGE_VALUES, dl, VTs, Value, Overflow);
|
||||
}
|
||||
@ -4999,7 +4998,6 @@ SDValue ARMTargetLowering::LowerShiftRightParts(SDValue Op,
|
||||
SDValue Lo = DAG.getNode(ARMISD::CMOV, dl, VT, LoSmallShift, LoBigShift,
|
||||
ARMcc, CCR, CmpLo);
|
||||
|
||||
|
||||
SDValue HiSmallShift = DAG.getNode(Opc, dl, VT, ShOpHi, ShAmt);
|
||||
SDValue HiBigShift = Opc == ISD::SRA
|
||||
? DAG.getNode(Opc, dl, VT, ShOpHi,
|
||||
@ -5434,7 +5432,6 @@ static SDValue LowerVSETCC(SDValue Op, SelectionDAG &DAG) {
|
||||
|
||||
// Detect VTST (Vector Test Bits) = icmp ne (and (op0, op1), zero).
|
||||
if (Opc == ARMISD::VCEQ) {
|
||||
|
||||
SDValue AndOp;
|
||||
if (ISD::isBuildVectorAllZeros(Op1.getNode()))
|
||||
AndOp = Op0;
|
||||
@ -9711,7 +9708,6 @@ static SDValue findMUL_LOHI(SDValue V) {
|
||||
static SDValue AddCombineTo64BitSMLAL16(SDNode *AddcNode, SDNode *AddeNode,
|
||||
TargetLowering::DAGCombinerInfo &DCI,
|
||||
const ARMSubtarget *Subtarget) {
|
||||
|
||||
if (Subtarget->isThumb()) {
|
||||
if (!Subtarget->hasDSP())
|
||||
return SDValue();
|
||||
@ -9957,7 +9953,6 @@ static SDValue AddCombineTo64bitUMAAL(SDNode *AddeNode,
|
||||
AddeNode->getOperand(1).getNode() == UmlalNode) ||
|
||||
(AddeNode->getOperand(0).getNode() == UmlalNode &&
|
||||
isNullConstant(AddeNode->getOperand(1)))) {
|
||||
|
||||
SelectionDAG &DAG = DCI.DAG;
|
||||
SDValue Ops[] = { UmlalNode->getOperand(0), UmlalNode->getOperand(1),
|
||||
UmlalNode->getOperand(2), AddHi };
|
||||
@ -10016,7 +10011,7 @@ static SDValue PerformAddcSubcCombine(SDNode *N,
|
||||
SDValue RHS = N->getOperand(1);
|
||||
if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(RHS)) {
|
||||
int32_t imm = C->getSExtValue();
|
||||
if (imm < 0 && imm > INT_MIN) {
|
||||
if (imm < 0 && imm > std::numeric_limits<int>::min()) {
|
||||
SDLoc DL(N);
|
||||
RHS = DAG.getConstant(-imm, DL, MVT::i32);
|
||||
unsigned Opcode = (N->getOpcode() == ARMISD::ADDC) ? ARMISD::SUBC
|
||||
@ -10240,7 +10235,6 @@ static SDValue PerformMULCombine(SDNode *N,
|
||||
MVT::i32)));
|
||||
Res = DAG.getNode(ISD::SUB, DL, VT,
|
||||
DAG.getConstant(0, DL, MVT::i32), Res);
|
||||
|
||||
} else
|
||||
return SDValue();
|
||||
}
|
||||
@ -12408,7 +12402,6 @@ int ARMTargetLowering::getScalingFactorCost(const DataLayout &DL,
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static bool isLegalT1AddressImmediate(int64_t V, EVT VT) {
|
||||
if (V < 0)
|
||||
return false;
|
||||
@ -13024,7 +13017,8 @@ ARMTargetLowering::getSingleConstraintMatchWeight(
|
||||
return weight;
|
||||
}
|
||||
|
||||
typedef std::pair<unsigned, const TargetRegisterClass*> RCPair;
|
||||
using RCPair = std::pair<unsigned, const TargetRegisterClass *>;
|
||||
|
||||
RCPair ARMTargetLowering::getRegForInlineAsmConstraint(
|
||||
const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const {
|
||||
if (Constraint.size() == 1) {
|
||||
@ -13826,7 +13820,7 @@ Value *ARMTargetLowering::emitStoreConditional(IRBuilder<> &Builder, Value *Val,
|
||||
Value *Lo = Builder.CreateTrunc(Val, Int32Ty, "lo");
|
||||
Value *Hi = Builder.CreateTrunc(Builder.CreateLShr(Val, 32), Int32Ty, "hi");
|
||||
if (!Subtarget->isLittle())
|
||||
std::swap (Lo, Hi);
|
||||
std::swap(Lo, Hi);
|
||||
Addr = Builder.CreateBitCast(Addr, Type::getInt8PtrTy(M->getContext()));
|
||||
return Builder.CreateCall(Strex, {Lo, Hi, Addr});
|
||||
}
|
||||
@ -13948,7 +13942,6 @@ bool ARMTargetLowering::lowerInterleavedLoad(
|
||||
DenseMap<ShuffleVectorInst *, SmallVector<Value *, 4>> SubVecs;
|
||||
|
||||
for (unsigned LoadCount = 0; LoadCount < NumLoads; ++LoadCount) {
|
||||
|
||||
// If we're generating more than one load, compute the base address of
|
||||
// subsequent loads as an offset from the previous.
|
||||
if (LoadCount > 0)
|
||||
@ -14089,7 +14082,6 @@ bool ARMTargetLowering::lowerInterleavedStore(StoreInst *SI,
|
||||
Intrinsic::arm_neon_vst4};
|
||||
|
||||
for (unsigned StoreCount = 0; StoreCount < NumStores; ++StoreCount) {
|
||||
|
||||
// If we generating more than one store, we compute the base address of
|
||||
// subsequent stores as an offset from the previous.
|
||||
if (StoreCount > 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- ARMISelLowering.h - ARM DAG Lowering Interface ----------*- C++ -*-===//
|
||||
//===- ARMISelLowering.h - ARM DAG Lowering Interface -----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -19,12 +19,14 @@
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/CodeGen/CallingConvLower.h"
|
||||
#include "llvm/CodeGen/ISDOpcodes.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineValueType.h"
|
||||
#include "llvm/CodeGen/SelectionDAG.h"
|
||||
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
||||
#include "llvm/CodeGen/ValueTypes.h"
|
||||
#include "llvm/IR/Attributes.h"
|
||||
#include "llvm/IR/CallingConv.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
@ -34,7 +36,19 @@
|
||||
namespace llvm {
|
||||
|
||||
class ARMSubtarget;
|
||||
class DataLayout;
|
||||
class FastISel;
|
||||
class FunctionLoweringInfo;
|
||||
class GlobalValue;
|
||||
class InstrItineraryData;
|
||||
class Instruction;
|
||||
class MachineBasicBlock;
|
||||
class MachineInstr;
|
||||
class SelectionDAG;
|
||||
class TargetLibraryInfo;
|
||||
class TargetMachine;
|
||||
class TargetRegisterInfo;
|
||||
class VectorType;
|
||||
|
||||
namespace ARMISD {
|
||||
|
||||
@ -264,7 +278,6 @@ class InstrItineraryData;
|
||||
|
||||
/// ReplaceNodeResults - Replace the results of node with an illegal result
|
||||
/// type with new values built out of custom code.
|
||||
///
|
||||
void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results,
|
||||
SelectionDAG &DAG) const override;
|
||||
|
||||
@ -571,7 +584,6 @@ class InstrItineraryData;
|
||||
const InstrItineraryData *Itins;
|
||||
|
||||
/// ARMPCLabelIndex - Keep track of the number of ARM PC labels created.
|
||||
///
|
||||
unsigned ARMPCLabelIndex;
|
||||
|
||||
// TODO: remove this, and have shouldInsertFencesForAtomic do the proper
|
||||
@ -585,7 +597,7 @@ class InstrItineraryData;
|
||||
void addQRTypeForNEON(MVT VT);
|
||||
std::pair<SDValue, SDValue> getARMXALUOOp(SDValue Op, SelectionDAG &DAG, SDValue &ARMcc) const;
|
||||
|
||||
typedef SmallVector<std::pair<unsigned, SDValue>, 8> RegsToPassVector;
|
||||
using RegsToPassVector = SmallVector<std::pair<unsigned, SDValue>, 8>;
|
||||
|
||||
void PassF64ArgInRegs(const SDLoc &dl, SelectionDAG &DAG, SDValue Chain,
|
||||
SDValue &Arg, RegsToPassVector &RegsToPass,
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- ARMLoadStoreOptimizer.cpp - ARM load / store opt. pass ------------===//
|
||||
//===- ARMLoadStoreOptimizer.cpp - ARM load / store opt. pass -------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -19,31 +19,53 @@
|
||||
#include "ARMMachineFunctionInfo.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMAddressingModes.h"
|
||||
#include "ThumbRegisterInfo.h"
|
||||
#include "MCTargetDesc/ARMBaseInfo.h"
|
||||
#include "Utils/ARMBaseInfo.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/CodeGen/LivePhysRegs.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/RegisterClassInfo.h"
|
||||
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/MC/MCInstrDesc.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetFrameLowering.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetLowering.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "arm-ldst-opt"
|
||||
@ -72,11 +94,11 @@ AssumeMisalignedLoadStores("arm-assume-misaligned-load-store", cl::Hidden,
|
||||
#define ARM_LOAD_STORE_OPT_NAME "ARM load / store optimization pass"
|
||||
|
||||
namespace {
|
||||
|
||||
/// Post- register allocation pass the combine load / store instructions to
|
||||
/// form ldm / stm instructions.
|
||||
struct ARMLoadStoreOpt : public MachineFunctionPass {
|
||||
static char ID;
|
||||
ARMLoadStoreOpt() : MachineFunctionPass(ID) {}
|
||||
|
||||
const MachineFunction *MF;
|
||||
const TargetInstrInfo *TII;
|
||||
@ -91,6 +113,8 @@ namespace {
|
||||
bool RegClassInfoValid;
|
||||
bool isThumb1, isThumb2;
|
||||
|
||||
ARMLoadStoreOpt() : MachineFunctionPass(ID) {}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &Fn) override;
|
||||
|
||||
MachineFunctionProperties getRequiredProperties() const override {
|
||||
@ -107,25 +131,31 @@ namespace {
|
||||
MachineInstr *MI;
|
||||
int Offset; ///< Load/Store offset.
|
||||
unsigned Position; ///< Position as counted from end of basic block.
|
||||
|
||||
MemOpQueueEntry(MachineInstr &MI, int Offset, unsigned Position)
|
||||
: MI(&MI), Offset(Offset), Position(Position) {}
|
||||
};
|
||||
typedef SmallVector<MemOpQueueEntry,8> MemOpQueue;
|
||||
using MemOpQueue = SmallVector<MemOpQueueEntry, 8>;
|
||||
|
||||
/// A set of MachineInstrs that fulfill (nearly all) conditions to get
|
||||
/// merged into a LDM/STM.
|
||||
struct MergeCandidate {
|
||||
/// List of instructions ordered by load/store offset.
|
||||
SmallVector<MachineInstr*, 4> Instrs;
|
||||
|
||||
/// Index in Instrs of the instruction being latest in the schedule.
|
||||
unsigned LatestMIIdx;
|
||||
|
||||
/// Index in Instrs of the instruction being earliest in the schedule.
|
||||
unsigned EarliestMIIdx;
|
||||
|
||||
/// Index into the basic block where the merged instruction will be
|
||||
/// inserted. (See MemOpQueueEntry.Position)
|
||||
unsigned InsertPos;
|
||||
|
||||
/// Whether the instructions can be merged into a ldm/stm instruction.
|
||||
bool CanMergeToLSMulti;
|
||||
|
||||
/// Whether the instructions can be merged into a ldrd/strd instruction.
|
||||
bool CanMergeToLSDouble;
|
||||
};
|
||||
@ -161,8 +191,10 @@ namespace {
|
||||
bool MergeReturnIntoLDM(MachineBasicBlock &MBB);
|
||||
bool CombineMovBx(MachineBasicBlock &MBB);
|
||||
};
|
||||
char ARMLoadStoreOpt::ID = 0;
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
char ARMLoadStoreOpt::ID = 0;
|
||||
|
||||
INITIALIZE_PASS(ARMLoadStoreOpt, "arm-ldst-opt", ARM_LOAD_STORE_OPT_NAME, false,
|
||||
false)
|
||||
@ -482,7 +514,6 @@ void ARMLoadStoreOpt::UpdateBaseRegUses(MachineBasicBlock &MBB,
|
||||
MO.setImm(Offset);
|
||||
else
|
||||
InsertSub = true;
|
||||
|
||||
} else if ((Opc == ARM::tSUBi8 || Opc == ARM::tADDi8) &&
|
||||
!definesCPSR(*MBBI)) {
|
||||
// SUBS/ADDS using this register, with a dead def of the CPSR.
|
||||
@ -502,12 +533,10 @@ void ARMLoadStoreOpt::UpdateBaseRegUses(MachineBasicBlock &MBB,
|
||||
} else {
|
||||
InsertSub = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
// Can't update the instruction.
|
||||
InsertSub = true;
|
||||
}
|
||||
|
||||
} else if (definesCPSR(*MBBI) || MBBI->isCall() || MBBI->isBranch()) {
|
||||
// Since SUBS sets the condition flags, we can't place the base reset
|
||||
// after an instruction that has a live CPSR def.
|
||||
@ -775,7 +804,6 @@ MachineInstr *ARMLoadStoreOpt::CreateLoadStoreMulti(
|
||||
// Insert a sub instruction after the newly formed instruction to reset.
|
||||
if (!BaseKill)
|
||||
UpdateBaseRegUses(MBB, InsertBefore, DL, Base, NumRegs, Pred, PredReg);
|
||||
|
||||
} else {
|
||||
// No writeback, simply build the MachineInstr.
|
||||
MIB = BuildMI(MBB, InsertBefore, DL, TII->get(Opcode));
|
||||
@ -853,7 +881,8 @@ MachineInstr *ARMLoadStoreOpt::MergeOpsUpdate(const MergeCandidate &Cand) {
|
||||
}
|
||||
|
||||
// Attempt the merge.
|
||||
typedef MachineBasicBlock::iterator iterator;
|
||||
using iterator = MachineBasicBlock::iterator;
|
||||
|
||||
MachineInstr *LatestMI = Cand.Instrs[Cand.LatestMIIdx];
|
||||
iterator InsertBefore = std::next(iterator(LatestMI));
|
||||
MachineBasicBlock &MBB = *LatestMI->getParent();
|
||||
@ -970,7 +999,8 @@ void ARMLoadStoreOpt::FormCandidates(const MemOpQueue &MemOps) {
|
||||
int Offset = MemOps[SIndex].Offset;
|
||||
const MachineOperand &PMO = getLoadStoreRegOp(*MI);
|
||||
unsigned PReg = PMO.getReg();
|
||||
unsigned PRegNum = PMO.isUndef() ? UINT_MAX : TRI->getEncodingValue(PReg);
|
||||
unsigned PRegNum = PMO.isUndef() ? std::numeric_limits<unsigned>::max()
|
||||
: TRI->getEncodingValue(PReg);
|
||||
unsigned Latest = SIndex;
|
||||
unsigned Earliest = SIndex;
|
||||
unsigned Count = 1;
|
||||
@ -1008,7 +1038,8 @@ void ARMLoadStoreOpt::FormCandidates(const MemOpQueue &MemOps) {
|
||||
break;
|
||||
|
||||
// See if the current load/store may be part of a multi load/store.
|
||||
unsigned RegNum = MO.isUndef() ? UINT_MAX : TRI->getEncodingValue(Reg);
|
||||
unsigned RegNum = MO.isUndef() ? std::numeric_limits<unsigned>::max()
|
||||
: TRI->getEncodingValue(Reg);
|
||||
bool PartOfLSMulti = CanMergeToLSMulti;
|
||||
if (PartOfLSMulti) {
|
||||
// Register numbers must be in ascending order.
|
||||
@ -1785,7 +1816,6 @@ bool ARMLoadStoreOpt::LoadStoreMultipleOpti(MachineBasicBlock &MBB) {
|
||||
MergeBaseCandidates.push_back(&*MBBI);
|
||||
}
|
||||
|
||||
|
||||
// If we are here then the chain is broken; Extract candidates for a merge.
|
||||
if (MemOps.size() > 0) {
|
||||
FormCandidates(MemOps);
|
||||
@ -1945,11 +1975,11 @@ bool ARMLoadStoreOpt::runOnMachineFunction(MachineFunction &Fn) {
|
||||
"ARM pre- register allocation load / store optimization pass"
|
||||
|
||||
namespace {
|
||||
|
||||
/// Pre- register allocation pass that move load / stores from consecutive
|
||||
/// locations close to make it more likely they will be combined later.
|
||||
struct ARMPreAllocLoadStoreOpt : public MachineFunctionPass{
|
||||
static char ID;
|
||||
ARMPreAllocLoadStoreOpt() : MachineFunctionPass(ID) {}
|
||||
|
||||
AliasAnalysis *AA;
|
||||
const DataLayout *TD;
|
||||
@ -1959,13 +1989,15 @@ namespace {
|
||||
MachineRegisterInfo *MRI;
|
||||
MachineFunction *MF;
|
||||
|
||||
ARMPreAllocLoadStoreOpt() : MachineFunctionPass(ID) {}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &Fn) override;
|
||||
|
||||
StringRef getPassName() const override {
|
||||
return ARM_PREALLOC_LOAD_STORE_OPT_NAME;
|
||||
}
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
AU.addRequired<AAResultsWrapperPass>();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
}
|
||||
@ -1983,8 +2015,10 @@ namespace {
|
||||
DenseMap<MachineInstr*, unsigned> &MI2LocMap);
|
||||
bool RescheduleLoadStoreInstrs(MachineBasicBlock *MBB);
|
||||
};
|
||||
char ARMPreAllocLoadStoreOpt::ID = 0;
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
char ARMPreAllocLoadStoreOpt::ID = 0;
|
||||
|
||||
INITIALIZE_PASS(ARMPreAllocLoadStoreOpt, "arm-prera-ldst-opt",
|
||||
ARM_PREALLOC_LOAD_STORE_OPT_NAME, false, false)
|
||||
@ -2293,8 +2327,8 @@ ARMPreAllocLoadStoreOpt::RescheduleLoadStoreInstrs(MachineBasicBlock *MBB) {
|
||||
bool RetVal = false;
|
||||
|
||||
DenseMap<MachineInstr*, unsigned> MI2LocMap;
|
||||
DenseMap<unsigned, SmallVector<MachineInstr*, 4> > Base2LdsMap;
|
||||
DenseMap<unsigned, SmallVector<MachineInstr*, 4> > Base2StsMap;
|
||||
DenseMap<unsigned, SmallVector<MachineInstr *, 4>> Base2LdsMap;
|
||||
DenseMap<unsigned, SmallVector<MachineInstr *, 4>> Base2StsMap;
|
||||
SmallVector<unsigned, 4> LdBases;
|
||||
SmallVector<unsigned, 4> StBases;
|
||||
|
||||
@ -2326,7 +2360,7 @@ ARMPreAllocLoadStoreOpt::RescheduleLoadStoreInstrs(MachineBasicBlock *MBB) {
|
||||
|
||||
bool StopHere = false;
|
||||
if (isLd) {
|
||||
DenseMap<unsigned, SmallVector<MachineInstr*, 4> >::iterator BI =
|
||||
DenseMap<unsigned, SmallVector<MachineInstr *, 4>>::iterator BI =
|
||||
Base2LdsMap.find(Base);
|
||||
if (BI != Base2LdsMap.end()) {
|
||||
for (unsigned i = 0, e = BI->second.size(); i != e; ++i) {
|
||||
@ -2342,7 +2376,7 @@ ARMPreAllocLoadStoreOpt::RescheduleLoadStoreInstrs(MachineBasicBlock *MBB) {
|
||||
LdBases.push_back(Base);
|
||||
}
|
||||
} else {
|
||||
DenseMap<unsigned, SmallVector<MachineInstr*, 4> >::iterator BI =
|
||||
DenseMap<unsigned, SmallVector<MachineInstr *, 4>>::iterator BI =
|
||||
Base2StsMap.find(Base);
|
||||
if (BI != Base2StsMap.end()) {
|
||||
for (unsigned i = 0, e = BI->second.size(); i != e; ++i) {
|
||||
@ -2394,7 +2428,6 @@ ARMPreAllocLoadStoreOpt::RescheduleLoadStoreInstrs(MachineBasicBlock *MBB) {
|
||||
return RetVal;
|
||||
}
|
||||
|
||||
|
||||
/// Returns an instance of the load / store optimization pass.
|
||||
FunctionPass *llvm::createARMLoadStoreOptimizationPass(bool PreAlloc) {
|
||||
if (PreAlloc)
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- ARMTargetTransformInfo.cpp - ARM specific TTI ---------------------===//
|
||||
//===- ARMTargetTransformInfo.cpp - ARM specific TTI ----------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -8,9 +8,30 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "ARMTargetTransformInfo.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMAddressingModes.h"
|
||||
#include "llvm/ADT/APInt.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
#include "llvm/CodeGen/ISDOpcodes.h"
|
||||
#include "llvm/CodeGen/MachineValueType.h"
|
||||
#include "llvm/CodeGen/ValueTypes.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Instruction.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/MC/SubtargetFeature.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Target/CostTable.h"
|
||||
#include "llvm/Target/TargetLowering.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "armtti"
|
||||
@ -65,7 +86,6 @@ int ARMTTIImpl::getIntImmCost(const APInt &Imm, Type *Ty) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
// Constants smaller than 256 fit in the immediate field of
|
||||
// Thumb1 instructions so we return a zero cost and 1 otherwise.
|
||||
int ARMTTIImpl::getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx,
|
||||
@ -109,7 +129,6 @@ int ARMTTIImpl::getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm,
|
||||
return getIntImmCost(Imm, Ty);
|
||||
}
|
||||
|
||||
|
||||
int ARMTTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
|
||||
const Instruction *I) {
|
||||
int ISD = TLI->InstructionOpcodeToISD(Opcode);
|
||||
@ -331,7 +350,6 @@ int ARMTTIImpl::getVectorInstrCost(unsigned Opcode, Type *ValTy,
|
||||
|
||||
int ARMTTIImpl::getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
|
||||
const Instruction *I) {
|
||||
|
||||
int ISD = TLI->InstructionOpcodeToISD(Opcode);
|
||||
// On NEON a a vector select gets lowered to vbsl.
|
||||
if (ST->hasNEON() && ValTy->isVectorTy() && ISD == ISD::SELECT) {
|
||||
@ -455,7 +473,6 @@ int ARMTTIImpl::getArithmeticInstrCost(
|
||||
TTI::OperandValueKind Op2Info, TTI::OperandValueProperties Opd1PropInfo,
|
||||
TTI::OperandValueProperties Opd2PropInfo,
|
||||
ArrayRef<const Value *> Args) {
|
||||
|
||||
int ISDOpcode = TLI->InstructionOpcodeToISD(Opcode);
|
||||
std::pair<int, MVT> LT = TLI->getTypeLegalizationCost(DL, Ty);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- ARMTargetTransformInfo.h - ARM specific TTI -------------*- C++ -*-===//
|
||||
//===- ARMTargetTransformInfo.h - ARM specific TTI --------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -6,28 +6,43 @@
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
/// \file
|
||||
/// This file a TargetTransformInfo::Concept conforming object specific to the
|
||||
/// ARM target machine. It uses the target's detailed information to
|
||||
/// provide more precise answers to certain TTI queries, while letting the
|
||||
/// target independent and default TTI implementations handle the rest.
|
||||
///
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIB_TARGET_ARM_ARMTARGETTRANSFORMINFO_H
|
||||
#define LLVM_LIB_TARGET_ARM_ARMTARGETTRANSFORMINFO_H
|
||||
|
||||
#include "ARM.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "ARMTargetMachine.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/Analysis/TargetTransformInfo.h"
|
||||
#include "llvm/CodeGen/BasicTTIImpl.h"
|
||||
#include "llvm/Target/TargetLowering.h"
|
||||
#include "llvm/IR/Constant.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/MC/SubtargetFeature.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class APInt;
|
||||
class ARMTargetLowering;
|
||||
class Instruction;
|
||||
class Loop;
|
||||
class SCEV;
|
||||
class ScalarEvolution;
|
||||
class Type;
|
||||
class Value;
|
||||
|
||||
class ARMTTIImpl : public BasicTTIImplBase<ARMTTIImpl> {
|
||||
typedef BasicTTIImplBase<ARMTTIImpl> BaseT;
|
||||
typedef TargetTransformInfo TTI;
|
||||
using BaseT = BasicTTIImplBase<ARMTTIImpl>;
|
||||
using TTI = TargetTransformInfo;
|
||||
|
||||
friend BaseT;
|
||||
|
||||
const ARMSubtarget *ST;
|
||||
@ -175,4 +190,4 @@ public:
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_LIB_TARGET_ARM_ARMTARGETTRANSFORMINFO_H
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
//===-- ARMDisassembler.cpp - Disassembler for ARM/Thumb ISA --------------===//
|
||||
//===- ARMDisassembler.cpp - Disassembler for ARM/Thumb ISA ---------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -10,6 +10,7 @@
|
||||
#include "MCTargetDesc/ARMAddressingModes.h"
|
||||
#include "MCTargetDesc/ARMBaseInfo.h"
|
||||
#include "MCTargetDesc/ARMMCTargetDesc.h"
|
||||
#include "Utils/ARMBaseInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
|
||||
#include "llvm/MC/MCFixedLenDisassembler.h"
|
||||
@ -31,7 +32,7 @@ using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "arm-disassembler"
|
||||
|
||||
typedef MCDisassembler::DecodeStatus DecodeStatus;
|
||||
using DecodeStatus = MCDisassembler::DecodeStatus;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -117,6 +118,7 @@ public:
|
||||
|
||||
private:
|
||||
mutable ITStatus ITBlock;
|
||||
|
||||
DecodeStatus AddThumbPredicate(MCInst&) const;
|
||||
void UpdateThumbVFPPredicate(MCInst&) const;
|
||||
};
|
||||
@ -2759,7 +2761,6 @@ static DecodeStatus DecodeVSTInstruction(MCInst &Inst, unsigned Insn,
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// First input register
|
||||
switch (Inst.getOpcode()) {
|
||||
case ARM::VST1q16:
|
||||
@ -3858,7 +3859,6 @@ static DecodeStatus DecodeT2AddrModeImm12(MCInst &Inst, unsigned Val,
|
||||
return S;
|
||||
}
|
||||
|
||||
|
||||
static DecodeStatus DecodeThumbAddSPImm(MCInst &Inst, uint16_t Insn,
|
||||
uint64_t Address, const void *Decoder) {
|
||||
unsigned imm = fieldFromInstruction(Insn, 0, 7);
|
||||
@ -4182,7 +4182,6 @@ static DecodeStatus DecodeMSRMask(MCInst &Inst, unsigned Val,
|
||||
|
||||
static DecodeStatus DecodeBankedReg(MCInst &Inst, unsigned Val,
|
||||
uint64_t Address, const void *Decoder) {
|
||||
|
||||
unsigned R = fieldFromInstruction(Val, 5, 1);
|
||||
unsigned SysM = fieldFromInstruction(Val, 0, 5);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- Thumb1FrameLowering.cpp - Thumb1 Frame Information ----------------===//
|
||||
//===- Thumb1FrameLowering.cpp - Thumb1 Frame Information -----------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -16,9 +16,9 @@
|
||||
#include "ARMBaseRegisterInfo.h"
|
||||
#include "ARMMachineFunctionInfo.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMBaseInfo.h"
|
||||
#include "Thumb1InstrInfo.h"
|
||||
#include "ThumbRegisterInfo.h"
|
||||
#include "Utils/ARMBaseInfo.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
@ -32,10 +32,14 @@
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetOpcodes.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <bitset>
|
||||
#include <cassert>
|
||||
@ -69,7 +73,6 @@ static void emitSPUpdate(MachineBasicBlock &MBB,
|
||||
MRI, MIFlags);
|
||||
}
|
||||
|
||||
|
||||
MachineBasicBlock::iterator Thumb1FrameLowering::
|
||||
eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator I) const {
|
||||
@ -643,7 +646,7 @@ bool Thumb1FrameLowering::emitPopSpecialFixUp(MachineBasicBlock &MBB,
|
||||
return true;
|
||||
}
|
||||
|
||||
typedef std::bitset<ARM::NUM_TARGET_REGS> ARMRegSet;
|
||||
using ARMRegSet = std::bitset<ARM::NUM_TARGET_REGS>;
|
||||
|
||||
// Return the first iteraror after CurrentReg which is present in EnabledRegs,
|
||||
// or OrderEnd if no further registers are in that set. This does not advance
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- Thumb1FrameLowering.h - Thumb1-specific frame info stuff --*- C++ -*-=//
|
||||
//===- Thumb1FrameLowering.h - Thumb1-specific frame info stuff ---*- C++ -*-=//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -6,21 +6,17 @@
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIB_TARGET_ARM_THUMB1FRAMELOWERING_H
|
||||
#define LLVM_LIB_TARGET_ARM_THUMB1FRAMELOWERING_H
|
||||
|
||||
#include "ARMFrameLowering.h"
|
||||
#include "Thumb1InstrInfo.h"
|
||||
#include "ThumbRegisterInfo.h"
|
||||
#include "llvm/Target/TargetFrameLowering.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class ARMSubtarget;
|
||||
class MachineFunction;
|
||||
|
||||
class Thumb1FrameLowering : public ARMFrameLowering {
|
||||
public:
|
||||
explicit Thumb1FrameLowering(const ARMSubtarget &sti);
|
||||
@ -88,6 +84,6 @@ private:
|
||||
bool emitPopSpecialFixUp(MachineBasicBlock &MBB, bool DoIt) const;
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_LIB_TARGET_ARM_THUMB1FRAMELOWERING_H
|
||||
|
Loading…
Reference in New Issue
Block a user