mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-14 23:29:51 +00:00
[ARM] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 293229
This commit is contained in:
parent
7328163c0a
commit
70ef7cf8ac
@ -16,21 +16,21 @@
|
||||
#define LLVM_LIB_TARGET_ARM_ARM_H
|
||||
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
#include "ARMBasicBlockInfo.h"
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class ARMAsmPrinter;
|
||||
class ARMBaseTargetMachine;
|
||||
struct BasicBlockInfo;
|
||||
class Function;
|
||||
class FunctionPass;
|
||||
class ImmutablePass;
|
||||
class MachineBasicBlock;
|
||||
class MachineFunction;
|
||||
class MachineInstr;
|
||||
class MCInst;
|
||||
class PassRegistry;
|
||||
class TargetLowering;
|
||||
class TargetMachine;
|
||||
|
||||
FunctionPass *createARMISelDag(ARMBaseTargetMachine &TM,
|
||||
CodeGenOpt::Level OptLevel);
|
||||
@ -54,6 +54,6 @@ std::vector<BasicBlockInfo> computeAllBlockSizes(MachineFunction *MF);
|
||||
void initializeARMLoadStoreOptPass(PassRegistry &);
|
||||
void initializeARMPreAllocLoadStoreOptPass(PassRegistry &);
|
||||
|
||||
} // end namespace llvm;
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_LIB_TARGET_ARM_ARM_H
|
||||
|
@ -11,34 +11,58 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "ARM.h"
|
||||
#include "ARMBaseInstrInfo.h"
|
||||
#include "ARMBaseRegisterInfo.h"
|
||||
#include "ARMConstantPoolValue.h"
|
||||
#include "ARMFeatures.h"
|
||||
#include "ARMHazardRecognizer.h"
|
||||
#include "ARMMachineFunctionInfo.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMAddressingModes.h"
|
||||
#include "MCTargetDesc/ARMBaseInfo.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/CodeGen/LiveVariables.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/MachineJumpTableInfo.h"
|
||||
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/ScoreboardHazardRecognizer.h"
|
||||
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
||||
#include "llvm/CodeGen/TargetSchedule.h"
|
||||
#include "llvm/IR/Attributes.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCInstrDesc.h"
|
||||
#include "llvm/MC/MCInstrItineraries.h"
|
||||
#include "llvm/Support/BranchProbability.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <new>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -301,7 +325,6 @@ bool ARMBaseInstrInfo::analyzeBranch(MachineBasicBlock &MBB,
|
||||
// Walk backwards from the end of the basic block until the branch is
|
||||
// analyzed or we give up.
|
||||
while (isPredicated(*I) || I->isTerminator() || I->isDebugValue()) {
|
||||
|
||||
// Flag to be raised on unanalyzeable instructions. This is useful in cases
|
||||
// where we want to clean up on the end of the basic block before we bail
|
||||
// out.
|
||||
@ -376,7 +399,6 @@ bool ARMBaseInstrInfo::analyzeBranch(MachineBasicBlock &MBB,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
unsigned ARMBaseInstrInfo::removeBranch(MachineBasicBlock &MBB,
|
||||
int *BytesRemoved) const {
|
||||
assert(!BytesRemoved && "code size not handled");
|
||||
@ -600,6 +622,7 @@ bool ARMBaseInstrInfo::isPredicable(MachineInstr &MI) const {
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
|
||||
template <> bool IsCPSRDead<MachineInstr>(MachineInstr *MI) {
|
||||
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
|
||||
const MachineOperand &MO = MI->getOperand(i);
|
||||
@ -613,7 +636,8 @@ template <> bool IsCPSRDead<MachineInstr>(MachineInstr *MI) {
|
||||
// all definitions of CPSR are dead
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
/// GetInstSize - Return the size of the specified MachineInstr.
|
||||
///
|
||||
@ -1298,7 +1322,7 @@ void ARMBaseInstrInfo::expandMEMCPY(MachineBasicBlock::iterator MI) const {
|
||||
|
||||
// Sort the scratch registers into ascending order.
|
||||
const TargetRegisterInfo &TRI = getRegisterInfo();
|
||||
llvm::SmallVector<unsigned, 6> ScratchRegs;
|
||||
SmallVector<unsigned, 6> ScratchRegs;
|
||||
for(unsigned I = 5; I < MI->getNumOperands(); ++I)
|
||||
ScratchRegs.push_back(MI->getOperand(I).getReg());
|
||||
std::sort(ScratchRegs.begin(), ScratchRegs.end(),
|
||||
@ -1316,7 +1340,6 @@ void ARMBaseInstrInfo::expandMEMCPY(MachineBasicBlock::iterator MI) const {
|
||||
BB->erase(MI);
|
||||
}
|
||||
|
||||
|
||||
bool ARMBaseInstrInfo::expandPostRAPseudo(MachineInstr &MI) const {
|
||||
if (MI.getOpcode() == TargetOpcode::LOAD_STACK_GUARD) {
|
||||
assert(getSubtarget().getTargetTriple().isOSBinFormatMachO() &&
|
||||
@ -1824,7 +1847,6 @@ ARMCC::CondCodes llvm::getInstrPredicate(const MachineInstr &MI,
|
||||
return (ARMCC::CondCodes)MI.getOperand(PIdx).getImm();
|
||||
}
|
||||
|
||||
|
||||
unsigned llvm::getMatchingCondBranchOpcode(unsigned Opc) {
|
||||
if (Opc == ARM::B)
|
||||
return ARM::Bcc;
|
||||
@ -2247,33 +2269,30 @@ bool llvm::rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
|
||||
unsigned NumBits = 0;
|
||||
unsigned Scale = 1;
|
||||
switch (AddrMode) {
|
||||
case ARMII::AddrMode_i12: {
|
||||
case ARMII::AddrMode_i12:
|
||||
ImmIdx = FrameRegIdx + 1;
|
||||
InstrOffs = MI.getOperand(ImmIdx).getImm();
|
||||
NumBits = 12;
|
||||
break;
|
||||
}
|
||||
case ARMII::AddrMode2: {
|
||||
case ARMII::AddrMode2:
|
||||
ImmIdx = FrameRegIdx+2;
|
||||
InstrOffs = ARM_AM::getAM2Offset(MI.getOperand(ImmIdx).getImm());
|
||||
if (ARM_AM::getAM2Op(MI.getOperand(ImmIdx).getImm()) == ARM_AM::sub)
|
||||
InstrOffs *= -1;
|
||||
NumBits = 12;
|
||||
break;
|
||||
}
|
||||
case ARMII::AddrMode3: {
|
||||
case ARMII::AddrMode3:
|
||||
ImmIdx = FrameRegIdx+2;
|
||||
InstrOffs = ARM_AM::getAM3Offset(MI.getOperand(ImmIdx).getImm());
|
||||
if (ARM_AM::getAM3Op(MI.getOperand(ImmIdx).getImm()) == ARM_AM::sub)
|
||||
InstrOffs *= -1;
|
||||
NumBits = 8;
|
||||
break;
|
||||
}
|
||||
case ARMII::AddrMode4:
|
||||
case ARMII::AddrMode6:
|
||||
// Can't fold any offset even if it's zero.
|
||||
return false;
|
||||
case ARMII::AddrMode5: {
|
||||
case ARMII::AddrMode5:
|
||||
ImmIdx = FrameRegIdx+1;
|
||||
InstrOffs = ARM_AM::getAM5Offset(MI.getOperand(ImmIdx).getImm());
|
||||
if (ARM_AM::getAM5Op(MI.getOperand(ImmIdx).getImm()) == ARM_AM::sub)
|
||||
@ -2281,7 +2300,6 @@ bool llvm::rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
|
||||
NumBits = 8;
|
||||
Scale = 4;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
llvm_unreachable("Unsupported addressing mode!");
|
||||
}
|
||||
@ -2799,7 +2817,7 @@ bool ARMBaseInstrInfo::FoldImmediate(MachineInstr &UseMI, MachineInstr &DefMI,
|
||||
switch (UseOpc) {
|
||||
default: break;
|
||||
case ARM::ADDrr:
|
||||
case ARM::SUBrr: {
|
||||
case ARM::SUBrr:
|
||||
if (UseOpc == ARM::SUBrr && Commute)
|
||||
return false;
|
||||
|
||||
@ -2815,9 +2833,8 @@ bool ARMBaseInstrInfo::FoldImmediate(MachineInstr &UseMI, MachineInstr &DefMI,
|
||||
SOImmValV1 = (uint32_t)ARM_AM::getSOImmTwoPartFirst(ImmVal);
|
||||
SOImmValV2 = (uint32_t)ARM_AM::getSOImmTwoPartSecond(ImmVal);
|
||||
break;
|
||||
}
|
||||
case ARM::ORRrr:
|
||||
case ARM::EORrr: {
|
||||
case ARM::EORrr:
|
||||
if (!ARM_AM::isSOImmTwoPartVal(ImmVal))
|
||||
return false;
|
||||
SOImmValV1 = (uint32_t)ARM_AM::getSOImmTwoPartFirst(ImmVal);
|
||||
@ -2828,9 +2845,8 @@ bool ARMBaseInstrInfo::FoldImmediate(MachineInstr &UseMI, MachineInstr &DefMI,
|
||||
case ARM::EORrr: NewUseOpc = ARM::EORri; break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ARM::t2ADDrr:
|
||||
case ARM::t2SUBrr: {
|
||||
case ARM::t2SUBrr:
|
||||
if (UseOpc == ARM::t2SUBrr && Commute)
|
||||
return false;
|
||||
|
||||
@ -2846,9 +2862,8 @@ bool ARMBaseInstrInfo::FoldImmediate(MachineInstr &UseMI, MachineInstr &DefMI,
|
||||
SOImmValV1 = (uint32_t)ARM_AM::getT2SOImmTwoPartFirst(ImmVal);
|
||||
SOImmValV2 = (uint32_t)ARM_AM::getT2SOImmTwoPartSecond(ImmVal);
|
||||
break;
|
||||
}
|
||||
case ARM::t2ORRrr:
|
||||
case ARM::t2EORrr: {
|
||||
case ARM::t2EORrr:
|
||||
if (!ARM_AM::isT2SOImmTwoPartVal(ImmVal))
|
||||
return false;
|
||||
SOImmValV1 = (uint32_t)ARM_AM::getT2SOImmTwoPartFirst(ImmVal);
|
||||
@ -2860,7 +2875,6 @@ bool ARMBaseInstrInfo::FoldImmediate(MachineInstr &UseMI, MachineInstr &DefMI,
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3485,7 +3499,7 @@ ARMBaseInstrInfo::getOperandLatency(const InstrItineraryData *ItinData,
|
||||
case ARM::t2LDMDB:
|
||||
case ARM::t2LDMIA_UPD:
|
||||
case ARM::t2LDMDB_UPD:
|
||||
LdmBypass = 1;
|
||||
LdmBypass = true;
|
||||
DefCycle = getLDMDefCycle(ItinData, DefMCID, DefClass, DefIdx, DefAlign);
|
||||
break;
|
||||
}
|
||||
@ -3960,12 +3974,11 @@ ARMBaseInstrInfo::getOperandLatency(const InstrItineraryData *ItinData,
|
||||
case ARM::t2LDRs:
|
||||
case ARM::t2LDRBs:
|
||||
case ARM::t2LDRHs:
|
||||
case ARM::t2LDRSHs: {
|
||||
case ARM::t2LDRSHs:
|
||||
// Thumb2 mode: lsl 0-3 only.
|
||||
Latency -= 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (DefAlign < 8 && Subtarget.checkVLDnAccessAlignment())
|
||||
@ -4294,6 +4307,7 @@ enum ARMExeDomain {
|
||||
ExeVFP = 1,
|
||||
ExeNEON = 2
|
||||
};
|
||||
|
||||
//
|
||||
// Also see ARMInstrFormats.td and Domain* enums in ARMBaseInfo.h
|
||||
//
|
||||
@ -4578,7 +4592,6 @@ void ARMBaseInstrInfo::setExecutionDomain(MachineInstr &MI,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -14,9 +14,9 @@
|
||||
#ifndef LLVM_LIB_TARGET_ARM_ARMBASICBLOCKINFO_H
|
||||
#define LLVM_LIB_TARGET_ARM_ARMBASICBLOCKINFO_H
|
||||
|
||||
#include "ARM.h"
|
||||
#include "ARMMachineFunctionInfo.h"
|
||||
using namespace llvm;
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@ -44,31 +44,30 @@ struct BasicBlockInfo {
|
||||
///
|
||||
/// Because worst case padding is used, the computed offset of an aligned
|
||||
/// block may not actually be aligned.
|
||||
unsigned Offset;
|
||||
unsigned Offset = 0;
|
||||
|
||||
/// Size - Size of the basic block in bytes. If the block contains
|
||||
/// inline assembly, this is a worst case estimate.
|
||||
///
|
||||
/// The size does not include any alignment padding whether from the
|
||||
/// beginning of the block, or from an aligned jump table at the end.
|
||||
unsigned Size;
|
||||
unsigned Size = 0;
|
||||
|
||||
/// KnownBits - The number of low bits in Offset that are known to be
|
||||
/// exact. The remaining bits of Offset are an upper bound.
|
||||
uint8_t KnownBits;
|
||||
uint8_t KnownBits = 0;
|
||||
|
||||
/// Unalign - When non-zero, the block contains instructions (inline asm)
|
||||
/// of unknown size. The real size may be smaller than Size bytes by a
|
||||
/// multiple of 1 << Unalign.
|
||||
uint8_t Unalign;
|
||||
uint8_t Unalign = 0;
|
||||
|
||||
/// PostAlign - When non-zero, the block terminator contains a .align
|
||||
/// directive, so the end of the block is aligned to 1 << PostAlign
|
||||
/// bytes.
|
||||
uint8_t PostAlign;
|
||||
uint8_t PostAlign = 0;
|
||||
|
||||
BasicBlockInfo() : Offset(0), Size(0), KnownBits(0), Unalign(0),
|
||||
PostAlign(0) {}
|
||||
BasicBlockInfo() = default;
|
||||
|
||||
/// Compute the number of known offset bits internally to this block.
|
||||
/// This number should be used to predict worst case padding when
|
||||
@ -107,4 +106,4 @@ struct BasicBlockInfo {
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_LIB_TARGET_ARM_ARMBASICBLOCKINFO_H
|
||||
|
@ -8,7 +8,15 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "ARM.h"
|
||||
#include "ARMBaseInstrInfo.h"
|
||||
#include "ARMBasicBlockInfo.h"
|
||||
#include "ARMMachineFunctionInfo.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace llvm {
|
||||
@ -69,4 +77,4 @@ std::vector<BasicBlockInfo> computeAllBlockSizes(MachineFunction *MF) {
|
||||
return BBInfo;
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
} // end namespace llvm
|
||||
|
@ -14,26 +14,44 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "ARM.h"
|
||||
#include "ARMBaseInstrInfo.h"
|
||||
#include "ARMBasicBlockInfo.h"
|
||||
#include "ARMMachineFunctionInfo.h"
|
||||
#include "MCTargetDesc/ARMAddressingModes.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMBaseInfo.h"
|
||||
#include "Thumb2InstrInfo.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineConstantPool.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineJumpTableInfo.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/MC/MCInstrDesc.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <new>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "arm-cp-islands"
|
||||
@ -49,7 +67,6 @@ STATISTIC(NumCBZ, "Number of CBZ / CBNZ formed");
|
||||
STATISTIC(NumJTMoved, "Number of jump table destination blocks moved");
|
||||
STATISTIC(NumJTInserted, "Number of jump table intermediate blocks inserted");
|
||||
|
||||
|
||||
static cl::opt<bool>
|
||||
AdjustJumpTableBlocks("arm-adjust-jump-tables", cl::Hidden, cl::init(true),
|
||||
cl::desc("Adjust basic block layout to better use TB[BH]"));
|
||||
@ -64,6 +81,7 @@ static cl::opt<bool> SynthesizeThumb1TBB(
|
||||
"equivalent to the TBB/TBH instructions"));
|
||||
|
||||
namespace {
|
||||
|
||||
/// ARMConstantIslands - Due to limited PC-relative displacements, ARM
|
||||
/// requires constant pool entries to be scattered among the instructions
|
||||
/// inside a function. To do this, it completely ignores the normal LLVM
|
||||
@ -76,7 +94,6 @@ namespace {
|
||||
/// CPE - A constant pool entry that has been placed somewhere, which
|
||||
/// tracks a list of users.
|
||||
class ARMConstantIslands : public MachineFunctionPass {
|
||||
|
||||
std::vector<BasicBlockInfo> BBInfo;
|
||||
|
||||
/// WaterList - A sorted list of basic blocks where islands could be placed
|
||||
@ -110,12 +127,14 @@ namespace {
|
||||
bool NegOk;
|
||||
bool IsSoImm;
|
||||
bool KnownAlignment;
|
||||
|
||||
CPUser(MachineInstr *mi, MachineInstr *cpemi, unsigned maxdisp,
|
||||
bool neg, bool soimm)
|
||||
: MI(mi), CPEMI(cpemi), MaxDisp(maxdisp), NegOk(neg), IsSoImm(soimm),
|
||||
KnownAlignment(false) {
|
||||
HighWaterMark = CPEMI->getParent();
|
||||
}
|
||||
|
||||
/// getMaxDisp - Returns the maximum displacement supported by MI.
|
||||
/// Correct for unknown alignment.
|
||||
/// Conservatively subtract 2 bytes to handle weird alignment effects.
|
||||
@ -135,6 +154,7 @@ namespace {
|
||||
MachineInstr *CPEMI;
|
||||
unsigned CPI;
|
||||
unsigned RefCount;
|
||||
|
||||
CPEntry(MachineInstr *cpemi, unsigned cpi, unsigned rc = 0)
|
||||
: CPEMI(cpemi), CPI(cpi), RefCount(rc) {}
|
||||
};
|
||||
@ -148,7 +168,7 @@ namespace {
|
||||
/// The first half of CPEntries contains generic constants, the second half
|
||||
/// contains jump tables. Use getCombinedIndex on a generic CPEMI to look up
|
||||
/// which vector it will be in here.
|
||||
std::vector<std::vector<CPEntry> > CPEntries;
|
||||
std::vector<std::vector<CPEntry>> CPEntries;
|
||||
|
||||
/// Maps a JT index to the offset in CPEntries containing copies of that
|
||||
/// table. The equivalent map for a CONSTPOOL_ENTRY is the identity.
|
||||
@ -167,6 +187,7 @@ namespace {
|
||||
unsigned MaxDisp : 31;
|
||||
bool isCond : 1;
|
||||
unsigned UncondBr;
|
||||
|
||||
ImmBranch(MachineInstr *mi, unsigned maxdisp, bool cond, unsigned ubr)
|
||||
: MI(mi), MaxDisp(maxdisp), isCond(cond), UncondBr(ubr) {}
|
||||
};
|
||||
@ -195,8 +216,10 @@ namespace {
|
||||
bool isThumb1;
|
||||
bool isThumb2;
|
||||
bool isPositionIndependentOrROPI;
|
||||
|
||||
public:
|
||||
static char ID;
|
||||
|
||||
ARMConstantIslands() : MachineFunctionPass(ID) {}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &MF) override;
|
||||
@ -264,8 +287,10 @@ namespace {
|
||||
U.getMaxDisp(), U.NegOk, U.IsSoImm);
|
||||
}
|
||||
};
|
||||
|
||||
char ARMConstantIslands::ID = 0;
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
/// verify - check BBOffsets, BBSizes, alignment of islands
|
||||
void ARMConstantIslands::verify() {
|
||||
@ -309,12 +334,6 @@ void ARMConstantIslands::dumpBBs() {
|
||||
});
|
||||
}
|
||||
|
||||
/// createARMConstantIslandPass - returns an instance of the constpool
|
||||
/// island pass.
|
||||
FunctionPass *llvm::createARMConstantIslandPass() {
|
||||
return new ARMConstantIslands();
|
||||
}
|
||||
|
||||
bool ARMConstantIslands::runOnMachineFunction(MachineFunction &mf) {
|
||||
MF = &mf;
|
||||
MCP = mf.getConstantPool();
|
||||
@ -873,7 +892,6 @@ void ARMConstantIslands::updateForInsertedWaterBlock(MachineBasicBlock *NewBB) {
|
||||
WaterList.insert(IP, NewBB);
|
||||
}
|
||||
|
||||
|
||||
/// Split the basic block containing MI into two blocks, which are joined by
|
||||
/// an unconditional branch. Update data structures and renumber blocks to
|
||||
/// account for this change and returns the newly created block.
|
||||
@ -1797,13 +1815,12 @@ bool ARMConstantIslands::optimizeThumb2Branches() {
|
||||
Bits = 11;
|
||||
Scale = 2;
|
||||
break;
|
||||
case ARM::t2Bcc: {
|
||||
case ARM::t2Bcc:
|
||||
NewOpc = ARM::tBcc;
|
||||
Bits = 8;
|
||||
Scale = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (NewOpc) {
|
||||
unsigned MaxOffs = ((1 << (Bits-1))-1) * Scale;
|
||||
MachineBasicBlock *DestBB = Br.MI->getOperand(0).getMBB();
|
||||
@ -2091,7 +2108,6 @@ bool ARMConstantIslands::optimizeThumb2JumpTables() {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Now safe to delete the load and lsl. The LEA will be removed later.
|
||||
CanDeleteLEA = true;
|
||||
Shift->eraseFromParent();
|
||||
@ -2259,3 +2275,9 @@ adjustJTTargetBlockForward(MachineBasicBlock *BB, MachineBasicBlock *JTBB) {
|
||||
++NumJTInserted;
|
||||
return NewBB;
|
||||
}
|
||||
|
||||
/// createARMConstantIslandPass - returns an instance of the constpool
|
||||
/// island pass.
|
||||
FunctionPass *llvm::createARMConstantIslandPass() {
|
||||
return new ARMConstantIslands();
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ARMBaseRegisterInfo.h"
|
||||
#include "ARMConstantPoolValue.h"
|
||||
#include "ARMMachineFunctionInfo.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMAddressingModes.h"
|
||||
#include "llvm/CodeGen/LivePhysRegs.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
@ -30,6 +31,7 @@
|
||||
#include "llvm/Support/raw_ostream.h" // FIXME: for debug only. remove!
|
||||
#include "llvm/Target/TargetFrameLowering.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "arm-pseudo"
|
||||
|
@ -16,19 +16,49 @@
|
||||
#include "ARMBaseRegisterInfo.h"
|
||||
#include "ARMConstantPoolValue.h"
|
||||
#include "ARMMachineFunctionInfo.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMAddressingModes.h"
|
||||
#include "MCTargetDesc/ARMBaseInfo.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/STLExtras.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/MachineModuleInfo.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/RegisterScavenging.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/IR/Attributes.h"
|
||||
#include "llvm/IR/CallingConv.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#define DEBUG_TYPE "arm-frame-lowering"
|
||||
|
||||
@ -180,6 +210,7 @@ static bool WindowsRequiresStackProbe(const MachineFunction &MF,
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
struct StackAdjustingInsts {
|
||||
struct InstInfo {
|
||||
MachineBasicBlock::iterator I;
|
||||
@ -196,7 +227,8 @@ struct StackAdjustingInsts {
|
||||
}
|
||||
|
||||
void addExtraBytes(const MachineBasicBlock::iterator I, unsigned ExtraBytes) {
|
||||
auto Info = find_if(Insts, [&](InstInfo &Info) { return Info.I == I; });
|
||||
auto Info =
|
||||
llvm::find_if(Insts, [&](InstInfo &Info) { return Info.I == I; });
|
||||
assert(Info != Insts.end() && "invalid sp adjusting instruction");
|
||||
Info->SPAdjust += ExtraBytes;
|
||||
}
|
||||
@ -219,7 +251,8 @@ struct StackAdjustingInsts {
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
/// Emit an instruction sequence that will align the address in
|
||||
/// register Reg by zero-ing out the lower bits. For versions of the
|
||||
@ -840,7 +873,7 @@ ARMFrameLowering::ResolveFrameIndexReference(const MachineFunction &MF,
|
||||
// When dynamically realigning the stack, use the frame pointer for
|
||||
// parameters, and the stack/base pointer for locals.
|
||||
if (RegInfo->needsStackRealignment(MF)) {
|
||||
assert (hasFP(MF) && "dynamic stack realignment without a FP!");
|
||||
assert(hasFP(MF) && "dynamic stack realignment without a FP!");
|
||||
if (isFixed) {
|
||||
FrameReg = RegInfo->getFrameRegister(MF);
|
||||
Offset = FPOffset;
|
||||
@ -1692,11 +1725,11 @@ void ARMFrameLowering::determineCalleeSaves(MachineFunction &MF,
|
||||
SavedRegs.set(ARM::LR);
|
||||
LRSpilled = true;
|
||||
NumGPRSpills++;
|
||||
auto LRPos = find(UnspilledCS1GPRs, ARM::LR);
|
||||
auto LRPos = llvm::find(UnspilledCS1GPRs, ARM::LR);
|
||||
if (LRPos != UnspilledCS1GPRs.end())
|
||||
UnspilledCS1GPRs.erase(LRPos);
|
||||
}
|
||||
auto FPPos = find(UnspilledCS1GPRs, FramePtr);
|
||||
auto FPPos = llvm::find(UnspilledCS1GPRs, FramePtr);
|
||||
if (FPPos != UnspilledCS1GPRs.end())
|
||||
UnspilledCS1GPRs.erase(FPPos);
|
||||
NumGPRSpills++;
|
||||
@ -1807,7 +1840,7 @@ void ARMFrameLowering::determineCalleeSaves(MachineFunction &MF,
|
||||
NumGPRSpills++;
|
||||
CS1Spilled = true;
|
||||
ExtraCSSpill = true;
|
||||
UnspilledCS1GPRs.erase(find(UnspilledCS1GPRs, Reg));
|
||||
UnspilledCS1GPRs.erase(llvm::find(UnspilledCS1GPRs, Reg));
|
||||
if (Reg == ARM::LR)
|
||||
LRSpilled = true;
|
||||
}
|
||||
@ -1820,7 +1853,7 @@ void ARMFrameLowering::determineCalleeSaves(MachineFunction &MF,
|
||||
SavedRegs.set(ARM::LR);
|
||||
NumGPRSpills++;
|
||||
SmallVectorImpl<unsigned>::iterator LRPos;
|
||||
LRPos = find(UnspilledCS1GPRs, (unsigned)ARM::LR);
|
||||
LRPos = llvm::find(UnspilledCS1GPRs, (unsigned)ARM::LR);
|
||||
if (LRPos != UnspilledCS1GPRs.end())
|
||||
UnspilledCS1GPRs.erase(LRPos);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- ARMInstructionSelector ------------------------------------*- C++ -*-==//
|
||||
//===- ARMInstructionSelector -----------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -6,8 +6,10 @@
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
/// \file
|
||||
/// This file declares the targeting of the InstructionSelector class for ARM.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIB_TARGET_ARM_ARMINSTRUCTIONSELECTOR_H
|
||||
@ -16,9 +18,9 @@
|
||||
#include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class ARMBaseInstrInfo;
|
||||
class ARMBaseRegisterInfo;
|
||||
class ARMBaseTargetMachine;
|
||||
class ARMRegisterBankInfo;
|
||||
class ARMSubtarget;
|
||||
|
||||
@ -27,7 +29,7 @@ public:
|
||||
ARMInstructionSelector(const ARMSubtarget &STI,
|
||||
const ARMRegisterBankInfo &RBI);
|
||||
|
||||
virtual bool select(MachineInstr &I) const override;
|
||||
bool select(MachineInstr &I) const override;
|
||||
|
||||
private:
|
||||
const ARMBaseInstrInfo &TII;
|
||||
@ -35,5 +37,6 @@ private:
|
||||
const ARMRegisterBankInfo &RBI;
|
||||
};
|
||||
|
||||
} // End llvm namespace.
|
||||
#endif
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_LIB_TARGET_ARM_ARMINSTRUCTIONSELECTOR_H
|
||||
|
@ -14,18 +14,27 @@
|
||||
|
||||
#include "ARM.h"
|
||||
#include "ARMAsmPrinter.h"
|
||||
#include "ARMBaseInstrInfo.h"
|
||||
#include "ARMMachineFunctionInfo.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMAddressingModes.h"
|
||||
#include "MCTargetDesc/ARMBaseInfo.h"
|
||||
#include "MCTargetDesc/ARMMCExpr.h"
|
||||
#include "llvm/ADT/APFloat.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/Mangler.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCInstBuilder.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
using namespace llvm;
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
MCOperand ARMAsmPrinter::GetSymbolRef(const MachineOperand &MO,
|
||||
const MCSymbol *Symbol) {
|
||||
@ -75,11 +84,10 @@ bool ARMAsmPrinter::lowerOperand(const MachineOperand &MO,
|
||||
MCOp = MCOperand::createExpr(MCSymbolRefExpr::create(
|
||||
MO.getMBB()->getSymbol(), OutContext));
|
||||
break;
|
||||
case MachineOperand::MO_GlobalAddress: {
|
||||
case MachineOperand::MO_GlobalAddress:
|
||||
MCOp = GetSymbolRef(MO,
|
||||
GetARMGVSymbol(MO.getGlobal(), MO.getTargetFlags()));
|
||||
break;
|
||||
}
|
||||
case MachineOperand::MO_ExternalSymbol:
|
||||
MCOp = GetSymbolRef(MO,
|
||||
GetExternalSymbolSymbol(MO.getSymbolName()));
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "ARMMachineFunctionInfo.h"
|
||||
#include "ARMSubtarget.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -15,10 +16,4 @@ void ARMFunctionInfo::anchor() {}
|
||||
|
||||
ARMFunctionInfo::ARMFunctionInfo(MachineFunction &MF)
|
||||
: isThumb(MF.getSubtarget<ARMSubtarget>().isThumb()),
|
||||
hasThumb2(MF.getSubtarget<ARMSubtarget>().hasThumb2()),
|
||||
StByValParamsPadding(0), ArgRegsSaveSize(0), ReturnRegsCount(0),
|
||||
HasStackFrame(false), RestoreSPFromFP(false), LRSpilledForFarJump(false),
|
||||
FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
|
||||
GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0), PICLabelUId(0),
|
||||
VarArgsFrameIndex(0), HasITBlocks(false), ArgumentStackSize(0),
|
||||
IsSplitCSR(false), PromotedGlobalsIncrease(0) {}
|
||||
hasThumb2(MF.getSubtarget<ARMSubtarget>().hasThumb2()) {}
|
||||
|
@ -14,11 +14,11 @@
|
||||
#ifndef LLVM_LIB_TARGET_ARM_ARMMACHINEFUNCTIONINFO_H
|
||||
#define LLVM_LIB_TARGET_ARM_ARMMACHINEFUNCTIONINFO_H
|
||||
|
||||
#include "ARMSubtarget.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include <utility>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@ -29,42 +29,42 @@ class ARMFunctionInfo : public MachineFunctionInfo {
|
||||
|
||||
/// isThumb - True if this function is compiled under Thumb mode.
|
||||
/// Used to initialized Align, so must precede it.
|
||||
bool isThumb;
|
||||
bool isThumb = false;
|
||||
|
||||
/// hasThumb2 - True if the target architecture supports Thumb2. Do not use
|
||||
/// to determine if function is compiled under Thumb mode, for that use
|
||||
/// 'isThumb'.
|
||||
bool hasThumb2;
|
||||
bool hasThumb2 = false;
|
||||
|
||||
/// StByValParamsPadding - For parameter that is split between
|
||||
/// GPRs and memory; while recovering GPRs part, when
|
||||
/// StackAlignment > 4, and GPRs-part-size mod StackAlignment != 0,
|
||||
/// we need to insert gap before parameter start address. It allows to
|
||||
/// "attach" GPR-part to the part that was passed via stack.
|
||||
unsigned StByValParamsPadding;
|
||||
unsigned StByValParamsPadding = 0;
|
||||
|
||||
/// VarArgsRegSaveSize - Size of the register save area for vararg functions.
|
||||
///
|
||||
unsigned ArgRegsSaveSize;
|
||||
unsigned ArgRegsSaveSize = 0;
|
||||
|
||||
/// ReturnRegsCount - Number of registers used up in the return.
|
||||
unsigned ReturnRegsCount;
|
||||
unsigned ReturnRegsCount = 0;
|
||||
|
||||
/// HasStackFrame - True if this function has a stack frame. Set by
|
||||
/// determineCalleeSaves().
|
||||
bool HasStackFrame;
|
||||
bool HasStackFrame = false;
|
||||
|
||||
/// RestoreSPFromFP - True if epilogue should restore SP from FP. Set by
|
||||
/// emitPrologue.
|
||||
bool RestoreSPFromFP;
|
||||
bool RestoreSPFromFP = false;
|
||||
|
||||
/// LRSpilledForFarJump - True if the LR register has been for spilled to
|
||||
/// enable far jump.
|
||||
bool LRSpilledForFarJump;
|
||||
bool LRSpilledForFarJump = false;
|
||||
|
||||
/// FramePtrSpillOffset - If HasStackFrame, this records the frame pointer
|
||||
/// spill stack offset.
|
||||
unsigned FramePtrSpillOffset;
|
||||
unsigned FramePtrSpillOffset = 0;
|
||||
|
||||
/// GPRCS1Offset, GPRCS2Offset, DPRCSOffset - Starting offset of callee saved
|
||||
/// register spills areas. For Mac OS X:
|
||||
@ -77,16 +77,16 @@ class ARMFunctionInfo : public MachineFunctionInfo {
|
||||
///
|
||||
/// Also see AlignedDPRCSRegs below. Not all D-regs need to go in area 3.
|
||||
/// Some may be spilled after the stack has been realigned.
|
||||
unsigned GPRCS1Offset;
|
||||
unsigned GPRCS2Offset;
|
||||
unsigned DPRCSOffset;
|
||||
unsigned GPRCS1Offset = 0;
|
||||
unsigned GPRCS2Offset = 0;
|
||||
unsigned DPRCSOffset = 0;
|
||||
|
||||
/// GPRCS1Size, GPRCS2Size, DPRCSSize - Sizes of callee saved register spills
|
||||
/// areas.
|
||||
unsigned GPRCS1Size;
|
||||
unsigned GPRCS2Size;
|
||||
unsigned DPRCSAlignGapSize;
|
||||
unsigned DPRCSSize;
|
||||
unsigned GPRCS1Size = 0;
|
||||
unsigned GPRCS2Size = 0;
|
||||
unsigned DPRCSAlignGapSize = 0;
|
||||
unsigned DPRCSSize = 0;
|
||||
|
||||
/// NumAlignedDPRCS2Regs - The number of callee-saved DPRs that are saved in
|
||||
/// the aligned portion of the stack frame. This is always a contiguous
|
||||
@ -95,15 +95,15 @@ class ARMFunctionInfo : public MachineFunctionInfo {
|
||||
/// We do not keep track of the frame indices used for these registers - they
|
||||
/// behave like any other frame index in the aligned stack frame. These
|
||||
/// registers also aren't included in DPRCSSize above.
|
||||
unsigned NumAlignedDPRCS2Regs;
|
||||
unsigned NumAlignedDPRCS2Regs = 0;
|
||||
|
||||
unsigned PICLabelUId;
|
||||
unsigned PICLabelUId = 0;
|
||||
|
||||
/// VarArgsFrameIndex - FrameIndex for start of varargs area.
|
||||
int VarArgsFrameIndex;
|
||||
int VarArgsFrameIndex = 0;
|
||||
|
||||
/// HasITBlocks - True if IT blocks have been inserted.
|
||||
bool HasITBlocks;
|
||||
bool HasITBlocks = false;
|
||||
|
||||
/// CPEClones - Track constant pool entries clones created by Constant Island
|
||||
/// pass.
|
||||
@ -111,7 +111,7 @@ class ARMFunctionInfo : public MachineFunctionInfo {
|
||||
|
||||
/// ArgumentStackSize - amount of bytes on stack consumed by the arguments
|
||||
/// being passed on the stack
|
||||
unsigned ArgumentStackSize;
|
||||
unsigned ArgumentStackSize = 0;
|
||||
|
||||
/// CoalescedWeights - mapping of basic blocks to the rolling counter of
|
||||
/// coalesced weights.
|
||||
@ -119,26 +119,16 @@ class ARMFunctionInfo : public MachineFunctionInfo {
|
||||
|
||||
/// True if this function has a subset of CSRs that is handled explicitly via
|
||||
/// copies.
|
||||
bool IsSplitCSR;
|
||||
bool IsSplitCSR = false;
|
||||
|
||||
/// Globals that have had their storage promoted into the constant pool.
|
||||
SmallPtrSet<const GlobalVariable*,2> PromotedGlobals;
|
||||
|
||||
/// The amount the literal pool has been increasedby due to promoted globals.
|
||||
int PromotedGlobalsIncrease;
|
||||
int PromotedGlobalsIncrease = 0;
|
||||
|
||||
public:
|
||||
ARMFunctionInfo() :
|
||||
isThumb(false),
|
||||
hasThumb2(false),
|
||||
ArgRegsSaveSize(0), ReturnRegsCount(0), HasStackFrame(false),
|
||||
RestoreSPFromFP(false),
|
||||
LRSpilledForFarJump(false),
|
||||
FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
|
||||
GPRCS1Size(0), GPRCS2Size(0), DPRCSAlignGapSize(0), DPRCSSize(0),
|
||||
NumAlignedDPRCS2Regs(0), PICLabelUId(0),
|
||||
VarArgsFrameIndex(0), HasITBlocks(false), IsSplitCSR(false),
|
||||
PromotedGlobalsIncrease(0) {}
|
||||
ARMFunctionInfo() = default;
|
||||
|
||||
explicit ARMFunctionInfo(MachineFunction &MF);
|
||||
|
||||
@ -250,6 +240,7 @@ public:
|
||||
PromotedGlobalsIncrease = Sz;
|
||||
}
|
||||
};
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_LIB_TARGET_ARM_ARMMACHINEFUNCTIONINFO_H
|
||||
|
@ -11,14 +11,36 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Thumb1FrameLowering.h"
|
||||
#include "ARMBaseInstrInfo.h"
|
||||
#include "ARMBaseRegisterInfo.h"
|
||||
#include "ARMMachineFunctionInfo.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMBaseInfo.h"
|
||||
#include "Thumb1FrameLowering.h"
|
||||
#include "Thumb1InstrInfo.h"
|
||||
#include "ThumbRegisterInfo.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/CodeGen/LivePhysRegs.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <cassert>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -746,7 +768,7 @@ spillCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
}
|
||||
|
||||
// Add the low registers to the PUSH, in ascending order.
|
||||
for (unsigned Reg : reverse(RegsToPush))
|
||||
for (unsigned Reg : llvm::reverse(RegsToPush))
|
||||
PushMIB.addReg(Reg, RegState::Kill);
|
||||
|
||||
// Insert the PUSH instruction after the MOVs.
|
||||
|
@ -9,13 +9,26 @@
|
||||
|
||||
#include "ARM.h"
|
||||
#include "ARMMachineFunctionInfo.h"
|
||||
#include "ARMSubtarget.h"
|
||||
#include "MCTargetDesc/ARMBaseInfo.h"
|
||||
#include "Thumb2InstrInfo.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/StringRef.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/MachineInstrBundle.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/MC/MCInstrDesc.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include <cassert>
|
||||
#include <new>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "thumb2-it"
|
||||
@ -24,16 +37,18 @@ STATISTIC(NumITs, "Number of IT blocks inserted");
|
||||
STATISTIC(NumMovedInsts, "Number of predicated instructions moved");
|
||||
|
||||
namespace {
|
||||
|
||||
class Thumb2ITBlockPass : public MachineFunctionPass {
|
||||
public:
|
||||
static char ID;
|
||||
Thumb2ITBlockPass() : MachineFunctionPass(ID) {}
|
||||
|
||||
bool restrictIT;
|
||||
const Thumb2InstrInfo *TII;
|
||||
const TargetRegisterInfo *TRI;
|
||||
ARMFunctionInfo *AFI;
|
||||
|
||||
Thumb2ITBlockPass() : MachineFunctionPass(ID) {}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &Fn) override;
|
||||
|
||||
MachineFunctionProperties getRequiredProperties() const override {
|
||||
@ -52,8 +67,10 @@ namespace {
|
||||
SmallSet<unsigned, 4> &Uses);
|
||||
bool InsertITInstructions(MachineBasicBlock &MBB);
|
||||
};
|
||||
|
||||
char Thumb2ITBlockPass::ID = 0;
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
/// TrackDefUses - Tracking what registers are being defined and used by
|
||||
/// instructions in the IT block. This also tracks "dependencies", i.e. uses
|
||||
|
Loading…
Reference in New Issue
Block a user