mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[AArch64] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 309062
This commit is contained in:
parent
60633f66f7
commit
c6903d856f
@ -1,4 +1,4 @@
|
||||
//===-- AArch64AsmPrinter.cpp - AArch64 LLVM assembly writer --------------===//
|
||||
//===- AArch64AsmPrinter.cpp - AArch64 LLVM assembly writer ---------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -19,30 +19,39 @@
|
||||
#include "AArch64Subtarget.h"
|
||||
#include "InstPrinter/AArch64InstPrinter.h"
|
||||
#include "MCTargetDesc/AArch64AddressingModes.h"
|
||||
#include "MCTargetDesc/AArch64MCExpr.h"
|
||||
#include "MCTargetDesc/AArch64MCTargetDesc.h"
|
||||
#include "Utils/AArch64BaseInfo.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/CodeGen/AsmPrinter.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/StackMaps.h"
|
||||
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/DebugInfo.h"
|
||||
#include "llvm/IR/DebugInfoMetadata.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCInstBuilder.h"
|
||||
#include "llvm/MC/MCLinkerOptimizationHint.h"
|
||||
#include "llvm/MC/MCSectionELF.h"
|
||||
#include "llvm/MC/MCSectionMachO.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCSymbolELF.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "asm-printer"
|
||||
@ -57,7 +66,7 @@ class AArch64AsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
AArch64AsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer)
|
||||
: AsmPrinter(TM, std::move(Streamer)), MCInstLowering(OutContext, *this),
|
||||
SM(*this), AArch64FI(nullptr) {}
|
||||
SM(*this) {}
|
||||
|
||||
StringRef getPassName() const override { return "AArch64 Assembly Printer"; }
|
||||
|
||||
@ -118,7 +127,8 @@ private:
|
||||
|
||||
MCSymbol *GetCPISymbol(unsigned CPID) const override;
|
||||
void EmitEndOfAsmFile(Module &M) override;
|
||||
AArch64FunctionInfo *AArch64FI;
|
||||
|
||||
AArch64FunctionInfo *AArch64FI = nullptr;
|
||||
|
||||
/// \brief Emit the LOHs contained in AArch64FI.
|
||||
void EmitLOHs();
|
||||
@ -126,13 +136,12 @@ private:
|
||||
/// Emit instruction to set float register to zero.
|
||||
void EmitFMov0(const MachineInstr &MI);
|
||||
|
||||
typedef std::map<const MachineInstr *, MCSymbol *> MInstToMCSymbol;
|
||||
using MInstToMCSymbol = std::map<const MachineInstr *, MCSymbol *>;
|
||||
|
||||
MInstToMCSymbol LOHInstToLabel;
|
||||
};
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
} // end anonymous namespace
|
||||
|
||||
void AArch64AsmPrinter::LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===--- AArch64CallLowering.h - Call lowering ------------------*- C++ -*-===//
|
||||
//===- AArch64CallLowering.h - Call lowering --------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -17,12 +17,18 @@
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/CodeGen/GlobalISel/CallLowering.h"
|
||||
#include "llvm/IR/CallingConv.h"
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class AArch64TargetLowering;
|
||||
class CCValAssign;
|
||||
class DataLayout;
|
||||
class MachineIRBuilder;
|
||||
class MachineRegisterInfo;
|
||||
class Type;
|
||||
|
||||
class AArch64CallLowering: public CallLowering {
|
||||
public:
|
||||
@ -39,14 +45,13 @@ public:
|
||||
ArrayRef<ArgInfo> OrigArgs) const override;
|
||||
|
||||
private:
|
||||
typedef std::function<void(MachineIRBuilder &, Type *, unsigned,
|
||||
CCValAssign &)>
|
||||
RegHandler;
|
||||
using RegHandler = std::function<void(MachineIRBuilder &, Type *, unsigned,
|
||||
CCValAssign &)>;
|
||||
|
||||
typedef std::function<void(MachineIRBuilder &, int, CCValAssign &)>
|
||||
MemHandler;
|
||||
using MemHandler =
|
||||
std::function<void(MachineIRBuilder &, int, CCValAssign &)>;
|
||||
|
||||
typedef std::function<void(unsigned, uint64_t)> SplitArgTy;
|
||||
using SplitArgTy = std::function<void(unsigned, uint64_t)>;
|
||||
|
||||
void splitToValueTypes(const ArgInfo &OrigArgInfo,
|
||||
SmallVectorImpl<ArgInfo> &SplitArgs,
|
||||
|
@ -60,20 +60,26 @@
|
||||
|
||||
#include "AArch64.h"
|
||||
#include "MCTargetDesc/AArch64AddressingModes.h"
|
||||
#include "Utils/AArch64BaseInfo.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DepthFirstIterator.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineDominators.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/Pass.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/TargetSubtargetInfo.h"
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <tuple>
|
||||
|
||||
@ -84,6 +90,7 @@ using namespace llvm;
|
||||
STATISTIC(NumConditionsAdjusted, "Number of conditions adjusted");
|
||||
|
||||
namespace {
|
||||
|
||||
class AArch64ConditionOptimizer : public MachineFunctionPass {
|
||||
const TargetInstrInfo *TII;
|
||||
MachineDominatorTree *DomTree;
|
||||
@ -92,12 +99,14 @@ class AArch64ConditionOptimizer : public MachineFunctionPass {
|
||||
public:
|
||||
// Stores immediate, compare instruction opcode and branch condition (in this
|
||||
// order) of adjusted comparison.
|
||||
typedef std::tuple<int, unsigned, AArch64CC::CondCode> CmpInfo;
|
||||
using CmpInfo = std::tuple<int, unsigned, AArch64CC::CondCode>;
|
||||
|
||||
static char ID;
|
||||
|
||||
AArch64ConditionOptimizer() : MachineFunctionPass(ID) {
|
||||
initializeAArch64ConditionOptimizerPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
MachineInstr *findSuitableCompare(MachineBasicBlock *MBB);
|
||||
CmpInfo adjustCmp(MachineInstr *CmpMI, AArch64CC::CondCode Cmp);
|
||||
@ -105,10 +114,12 @@ public:
|
||||
bool adjustTo(MachineInstr *CmpMI, AArch64CC::CondCode Cmp, MachineInstr *To,
|
||||
int ToImm);
|
||||
bool runOnMachineFunction(MachineFunction &MF) override;
|
||||
|
||||
StringRef getPassName() const override {
|
||||
return "AArch64 Condition Optimizer";
|
||||
}
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
char AArch64ConditionOptimizer::ID = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
//==-- AArch64ExpandPseudoInsts.cpp - Expand pseudo instructions --*- C++ -*-=//
|
||||
//===- AArch64ExpandPseudoInsts.cpp - Expand pseudo instructions ----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -18,24 +18,44 @@
|
||||
#include "AArch64Subtarget.h"
|
||||
#include "MCTargetDesc/AArch64AddressingModes.h"
|
||||
#include "Utils/AArch64BaseInfo.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/Triple.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/MachineOperand.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/MC/MCInstrDesc.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define AARCH64_EXPAND_PSEUDO_NAME "AArch64 pseudo instruction expansion pass"
|
||||
|
||||
namespace {
|
||||
|
||||
class AArch64ExpandPseudo : public MachineFunctionPass {
|
||||
public:
|
||||
const AArch64InstrInfo *TII;
|
||||
|
||||
static char ID;
|
||||
|
||||
AArch64ExpandPseudo() : MachineFunctionPass(ID) {
|
||||
initializeAArch64ExpandPseudoPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
const AArch64InstrInfo *TII;
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &Fn) override;
|
||||
|
||||
StringRef getPassName() const override { return AARCH64_EXPAND_PSEUDO_NAME; }
|
||||
@ -55,8 +75,10 @@ private:
|
||||
MachineBasicBlock::iterator MBBI,
|
||||
MachineBasicBlock::iterator &NextMBBI);
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
char AArch64ExpandPseudo::ID = 0;
|
||||
}
|
||||
|
||||
INITIALIZE_PASS(AArch64ExpandPseudo, "aarch64-expand-pseudo",
|
||||
AARCH64_EXPAND_PSEUDO_NAME, false, false)
|
||||
@ -151,12 +173,12 @@ static bool canUseOrr(uint64_t Chunk, uint64_t &Encoding) {
|
||||
/// This allows us to materialize constants like |A|B|A|A| or |A|B|C|A| (order
|
||||
/// of the chunks doesn't matter), assuming |A|A|A|A| can be materialized with
|
||||
/// an ORR instruction.
|
||||
///
|
||||
static bool tryToreplicateChunks(uint64_t UImm, MachineInstr &MI,
|
||||
MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator &MBBI,
|
||||
const AArch64InstrInfo *TII) {
|
||||
typedef DenseMap<uint64_t, unsigned> CountMap;
|
||||
using CountMap = DenseMap<uint64_t, unsigned>;
|
||||
|
||||
CountMap Counts;
|
||||
|
||||
// Scan the constant and count how often every chunk occurs.
|
||||
@ -242,7 +264,7 @@ static bool tryToreplicateChunks(uint64_t UImm, MachineInstr &MI,
|
||||
/// starts a contiguous sequence of ones if we look at the bits from the LSB
|
||||
/// towards the MSB.
|
||||
static bool isStartChunk(uint64_t Chunk) {
|
||||
if (Chunk == 0 || Chunk == UINT64_MAX)
|
||||
if (Chunk == 0 || Chunk == std::numeric_limits<uint64_t>::max())
|
||||
return false;
|
||||
|
||||
return isMask_64(~Chunk);
|
||||
@ -252,7 +274,7 @@ static bool isStartChunk(uint64_t Chunk) {
|
||||
/// ends a contiguous sequence of ones if we look at the bits from the LSB
|
||||
/// towards the MSB.
|
||||
static bool isEndChunk(uint64_t Chunk) {
|
||||
if (Chunk == 0 || Chunk == UINT64_MAX)
|
||||
if (Chunk == 0 || Chunk == std::numeric_limits<uint64_t>::max())
|
||||
return false;
|
||||
|
||||
return isMask_64(Chunk);
|
||||
@ -285,7 +307,6 @@ static uint64_t updateImm(uint64_t Imm, unsigned Idx, bool Clear) {
|
||||
///
|
||||
/// We are also looking for constants like |S|A|B|E| where the contiguous
|
||||
/// sequence of ones wraps around the MSB into the LSB.
|
||||
///
|
||||
static bool trySequenceOfOnes(uint64_t UImm, MachineInstr &MI,
|
||||
MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator &MBBI,
|
||||
@ -668,7 +689,6 @@ bool AArch64ExpandPseudo::expandCMP_SWAP(
|
||||
bool AArch64ExpandPseudo::expandCMP_SWAP_128(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
|
||||
MachineBasicBlock::iterator &NextMBBI) {
|
||||
|
||||
MachineInstr &MI = *MBBI;
|
||||
DebugLoc DL = MI.getDebugLoc();
|
||||
MachineOperand &DestLo = MI.getOperand(0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- AArch64FalkorHWPFFix.cpp - Avoid HW prefetcher pitfalls on Falkor--===//
|
||||
//===- AArch64FalkorHWPFFix.cpp - Avoid HW prefetcher pitfalls on Falkor --===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -15,21 +15,41 @@
|
||||
|
||||
#include "AArch64.h"
|
||||
#include "AArch64InstrInfo.h"
|
||||
#include "AArch64Subtarget.h"
|
||||
#include "AArch64TargetMachine.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/DepthFirstIterator.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
#include "llvm/Analysis/ScalarEvolution.h"
|
||||
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
|
||||
#include "llvm/CodeGen/LiveRegUnits.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/MachineLoopInfo.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/TargetPassConfig.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/IR/Dominators.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/IR/Instruction.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include <cassert>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -60,6 +80,7 @@ private:
|
||||
class FalkorMarkStridedAccessesLegacy : public FunctionPass {
|
||||
public:
|
||||
static char ID; // Pass ID, replacement for typeid
|
||||
|
||||
FalkorMarkStridedAccessesLegacy() : FunctionPass(ID) {
|
||||
initializeFalkorMarkStridedAccessesLegacyPass(
|
||||
*PassRegistry::getPassRegistry());
|
||||
@ -78,9 +99,11 @@ public:
|
||||
|
||||
bool runOnFunction(Function &F) override;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
char FalkorMarkStridedAccessesLegacy::ID = 0;
|
||||
|
||||
INITIALIZE_PASS_BEGIN(FalkorMarkStridedAccessesLegacy, DEBUG_TYPE,
|
||||
"Falkor HW Prefetch Fix", false, false)
|
||||
INITIALIZE_PASS_DEPENDENCY(TargetPassConfig)
|
||||
@ -165,7 +188,7 @@ public:
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &Fn) override;
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
AU.addRequired<MachineLoopInfo>();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
}
|
||||
@ -186,17 +209,16 @@ private:
|
||||
|
||||
/// Bits from load opcodes used to compute HW prefetcher instruction tags.
|
||||
struct LoadInfo {
|
||||
LoadInfo()
|
||||
: DestReg(0), BaseReg(0), BaseRegIdx(-1), OffsetOpnd(nullptr),
|
||||
IsPrePost(false) {}
|
||||
unsigned DestReg;
|
||||
unsigned BaseReg;
|
||||
int BaseRegIdx;
|
||||
const MachineOperand *OffsetOpnd;
|
||||
bool IsPrePost;
|
||||
LoadInfo() = default;
|
||||
|
||||
unsigned DestReg = 0;
|
||||
unsigned BaseReg = 0;
|
||||
int BaseRegIdx = -1;
|
||||
const MachineOperand *OffsetOpnd = nullptr;
|
||||
bool IsPrePost = false;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // end anonymous namespace
|
||||
|
||||
char FalkorHWPFFix::ID = 0;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- AArch6464FastISel.cpp - AArch64 FastISel implementation -----------===//
|
||||
//===- AArch6464FastISel.cpp - AArch64 FastISel implementation ------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -53,6 +53,7 @@
|
||||
#include "llvm/IR/Instruction.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/Operator.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/User.h"
|
||||
@ -63,6 +64,7 @@
|
||||
#include "llvm/Support/AtomicOrdering.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include <algorithm>
|
||||
@ -78,10 +80,10 @@ namespace {
|
||||
class AArch64FastISel final : public FastISel {
|
||||
class Address {
|
||||
public:
|
||||
typedef enum {
|
||||
using BaseKind = enum {
|
||||
RegBase,
|
||||
FrameIndexBase
|
||||
} BaseKind;
|
||||
};
|
||||
|
||||
private:
|
||||
BaseKind Kind = RegBase;
|
||||
@ -944,7 +946,6 @@ bool AArch64FastISel::computeCallAddress(const Value *V, Address &Addr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool AArch64FastISel::isTypeLegal(Type *Ty, MVT &VT) {
|
||||
EVT evt = TLI.getValueType(DL, Ty, true);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//=- AArch64LoadStoreOptimizer.cpp - AArch64 load/store opt. pass -*- C++ -*-=//
|
||||
//===- AArch64LoadStoreOptimizer.cpp - AArch64 load/store opt. pass -------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -20,6 +20,7 @@
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
@ -64,7 +65,7 @@ static cl::opt<unsigned> UpdateLimit("aarch64-update-scan-limit", cl::init(100),
|
||||
|
||||
namespace {
|
||||
|
||||
typedef struct LdStPairFlags {
|
||||
using LdStPairFlags = struct LdStPairFlags {
|
||||
// If a matching instruction is found, MergeForward is set to true if the
|
||||
// merge is to remove the first instruction and replace the second with
|
||||
// a pair-wise insn, and false if the reverse is true.
|
||||
@ -83,8 +84,7 @@ typedef struct LdStPairFlags {
|
||||
|
||||
void setSExtIdx(int V) { SExtIdx = V; }
|
||||
int getSExtIdx() const { return SExtIdx; }
|
||||
|
||||
} LdStPairFlags;
|
||||
};
|
||||
|
||||
struct AArch64LoadStoreOpt : public MachineFunctionPass {
|
||||
static char ID;
|
||||
@ -101,7 +101,7 @@ struct AArch64LoadStoreOpt : public MachineFunctionPass {
|
||||
// Track which registers have been modified and used.
|
||||
BitVector ModifiedRegs, UsedRegs;
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
AU.addRequired<AAResultsWrapperPass>();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
}
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MachineInstr;
|
||||
|
||||
/// AArch64FunctionInfo - This class is derived from MachineFunctionInfo and
|
||||
/// contains private AArch64-specific information for each MachineFunction.
|
||||
class AArch64FunctionInfo final : public MachineFunctionInfo {
|
||||
@ -145,7 +147,7 @@ public:
|
||||
unsigned getVarArgsFPRSize() const { return VarArgsFPRSize; }
|
||||
void setVarArgsFPRSize(unsigned Size) { VarArgsFPRSize = Size; }
|
||||
|
||||
typedef SmallPtrSet<const MachineInstr *, 16> SetOfInstructions;
|
||||
using SetOfInstructions = SmallPtrSet<const MachineInstr *, 16>;
|
||||
|
||||
const SetOfInstructions &getLOHRelated() const { return LOHRelated; }
|
||||
|
||||
@ -157,7 +159,7 @@ public:
|
||||
SmallVector<const MachineInstr *, 3> Args;
|
||||
|
||||
public:
|
||||
typedef ArrayRef<const MachineInstr *> LOHArgs;
|
||||
using LOHArgs = ArrayRef<const MachineInstr *>;
|
||||
|
||||
MILOHDirective(MCLOHType Kind, LOHArgs Args)
|
||||
: Kind(Kind), Args(Args.begin(), Args.end()) {
|
||||
@ -168,8 +170,8 @@ public:
|
||||
LOHArgs getArgs() const { return Args; }
|
||||
};
|
||||
|
||||
typedef MILOHDirective::LOHArgs MILOHArgs;
|
||||
typedef SmallVector<MILOHDirective, 32> MILOHContainer;
|
||||
using MILOHArgs = MILOHDirective::LOHArgs;
|
||||
using MILOHContainer = SmallVector<MILOHDirective, 32>;
|
||||
|
||||
const MILOHContainer &getLOHContainer() const { return LOHContainerSet; }
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//=- AArch64PromoteConstant.cpp --- Promote constant to global for AArch64 -==//
|
||||
//==- AArch64PromoteConstant.cpp - Promote constant to global for AArch64 --==//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -22,23 +22,31 @@
|
||||
|
||||
#include "AArch64.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/Constant.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/Dominators.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/IR/GlobalVariable.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#include "llvm/IR/InstIterator.h"
|
||||
#include "llvm/IR/Instruction.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -56,6 +64,7 @@ STATISTIC(NumPromotedUses, "Number of promoted constants uses");
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace {
|
||||
|
||||
/// Promotes interesting constant into global variables.
|
||||
/// The motivating example is:
|
||||
/// static const uint16_t TableA[32] = {
|
||||
@ -83,13 +92,12 @@ namespace {
|
||||
/// Therefore the final assembly final has 4 different loads. With this pass
|
||||
/// enabled, only one load is issued for the constants.
|
||||
class AArch64PromoteConstant : public ModulePass {
|
||||
|
||||
public:
|
||||
struct PromotedConstant {
|
||||
bool ShouldConvert = false;
|
||||
GlobalVariable *GV = nullptr;
|
||||
};
|
||||
typedef SmallDenseMap<Constant *, PromotedConstant, 16> PromotionCacheTy;
|
||||
using PromotionCacheTy = SmallDenseMap<Constant *, PromotedConstant, 16>;
|
||||
|
||||
struct UpdateRecord {
|
||||
Constant *C;
|
||||
@ -101,6 +109,7 @@ public:
|
||||
};
|
||||
|
||||
static char ID;
|
||||
|
||||
AArch64PromoteConstant() : ModulePass(ID) {
|
||||
initializeAArch64PromoteConstantPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
@ -135,9 +144,9 @@ private:
|
||||
}
|
||||
|
||||
/// Type to store a list of Uses.
|
||||
typedef SmallVector<std::pair<Instruction *, unsigned>, 4> Uses;
|
||||
using Uses = SmallVector<std::pair<Instruction *, unsigned>, 4>;
|
||||
/// Map an insertion point to all the uses it dominates.
|
||||
typedef DenseMap<Instruction *, Uses> InsertionPoints;
|
||||
using InsertionPoints = DenseMap<Instruction *, Uses>;
|
||||
|
||||
/// Find the closest point that dominates the given Use.
|
||||
Instruction *findInsertionPoint(Instruction &User, unsigned OpNo);
|
||||
@ -212,6 +221,7 @@ private:
|
||||
InsertPts.erase(OldInstr);
|
||||
}
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
char AArch64PromoteConstant::ID = 0;
|
||||
@ -357,7 +367,6 @@ Instruction *AArch64PromoteConstant::findInsertionPoint(Instruction &User,
|
||||
bool AArch64PromoteConstant::isDominated(Instruction *NewPt, Instruction *User,
|
||||
unsigned OpNo,
|
||||
InsertionPoints &InsertPts) {
|
||||
|
||||
DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>(
|
||||
*NewPt->getParent()->getParent()).getDomTree();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- AArch64TargetTransformInfo.h - AArch64 specific TTI -----*- C++ -*-===//
|
||||
//===- AArch64TargetTransformInfo.h - AArch64 specific TTI ------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -18,17 +18,31 @@
|
||||
#define LLVM_LIB_TARGET_AARCH64_AARCH64TARGETTRANSFORMINFO_H
|
||||
|
||||
#include "AArch64.h"
|
||||
#include "AArch64Subtarget.h"
|
||||
#include "AArch64TargetMachine.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/Analysis/TargetTransformInfo.h"
|
||||
#include "llvm/CodeGen/BasicTTIImpl.h"
|
||||
#include "llvm/Target/TargetLowering.h"
|
||||
#include <algorithm>
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class APInt;
|
||||
class Instruction;
|
||||
class IntrinsicInst;
|
||||
class Loop;
|
||||
class SCEV;
|
||||
class ScalarEvolution;
|
||||
class Type;
|
||||
class Value;
|
||||
class VectorType;
|
||||
|
||||
class AArch64TTIImpl : public BasicTTIImplBase<AArch64TTIImpl> {
|
||||
typedef BasicTTIImplBase<AArch64TTIImpl> BaseT;
|
||||
typedef TargetTransformInfo TTI;
|
||||
using BaseT = BasicTTIImplBase<AArch64TTIImpl>;
|
||||
using TTI = TargetTransformInfo;
|
||||
|
||||
friend BaseT;
|
||||
|
||||
const AArch64Subtarget *ST;
|
||||
@ -157,4 +171,4 @@ public:
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_LIB_TARGET_AARCH64_AARCH64TARGETTRANSFORMINFO_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- AArch64Disassembler.cpp - Disassembler for AArch64 -------*- C++ -*-===//
|
||||
//===- AArch64Disassembler.cpp - Disassembler for AArch64 -----------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -14,160 +14,162 @@
|
||||
#include "AArch64ExternalSymbolizer.h"
|
||||
#include "AArch64Subtarget.h"
|
||||
#include "MCTargetDesc/AArch64AddressingModes.h"
|
||||
#include "MCTargetDesc/AArch64MCTargetDesc.h"
|
||||
#include "Utils/AArch64BaseInfo.h"
|
||||
#include "llvm-c/Disassembler.h"
|
||||
#include "llvm/MC/MCDisassembler/MCRelocationInfo.h"
|
||||
#include "llvm/MC/MCFixedLenDisassembler.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "aarch64-disassembler"
|
||||
|
||||
// Pull DecodeStatus and its enum values into the global namespace.
|
||||
typedef llvm::MCDisassembler::DecodeStatus DecodeStatus;
|
||||
using DecodeStatus = MCDisassembler::DecodeStatus;
|
||||
|
||||
// Forward declare these because the autogenerated code will reference them.
|
||||
// Definitions are further down.
|
||||
static DecodeStatus DecodeFPR128RegisterClass(llvm::MCInst &Inst,
|
||||
static DecodeStatus DecodeFPR128RegisterClass(MCInst &Inst,
|
||||
unsigned RegNo, uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeFPR128_loRegisterClass(llvm::MCInst &Inst,
|
||||
static DecodeStatus DecodeFPR128_loRegisterClass(MCInst &Inst,
|
||||
unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeFPR64RegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||
static DecodeStatus DecodeFPR64RegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeFPR32RegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||
static DecodeStatus DecodeFPR32RegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeFPR16RegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||
static DecodeStatus DecodeFPR16RegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeFPR8RegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||
static DecodeStatus DecodeFPR8RegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeGPR64RegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||
static DecodeStatus DecodeGPR64RegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeGPR64spRegisterClass(llvm::MCInst &Inst,
|
||||
static DecodeStatus DecodeGPR64spRegisterClass(MCInst &Inst,
|
||||
unsigned RegNo, uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeGPR32RegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||
static DecodeStatus DecodeGPR32RegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeGPR32spRegisterClass(llvm::MCInst &Inst,
|
||||
static DecodeStatus DecodeGPR32spRegisterClass(MCInst &Inst,
|
||||
unsigned RegNo, uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeQQRegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||
static DecodeStatus DecodeQQRegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeQQQRegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||
static DecodeStatus DecodeQQQRegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeQQQQRegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||
static DecodeStatus DecodeQQQQRegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeDDRegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||
static DecodeStatus DecodeDDRegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeDDDRegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||
static DecodeStatus DecodeDDDRegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeDDDDRegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||
static DecodeStatus DecodeDDDDRegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
|
||||
static DecodeStatus DecodeFixedPointScaleImm32(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeFixedPointScaleImm32(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeFixedPointScaleImm64(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeFixedPointScaleImm64(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodePCRelLabel19(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodePCRelLabel19(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Address, const void *Decoder);
|
||||
static DecodeStatus DecodeMemExtend(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeMemExtend(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Address, const void *Decoder);
|
||||
static DecodeStatus DecodeMRSSystemRegister(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeMRSSystemRegister(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Address, const void *Decoder);
|
||||
static DecodeStatus DecodeMSRSystemRegister(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeMSRSystemRegister(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Address, const void *Decoder);
|
||||
static DecodeStatus DecodeThreeAddrSRegInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn,
|
||||
static DecodeStatus DecodeThreeAddrSRegInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeMoveImmInstruction(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodeMoveImmInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeUnsignedLdStInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn,
|
||||
static DecodeStatus DecodeUnsignedLdStInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeSignedLdStInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn, uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeExclusiveLdStInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn,
|
||||
static DecodeStatus DecodeSignedLdStInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodePairLdStInstruction(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodeExclusiveLdStInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeAddSubERegInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn, uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeLogicalImmInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn, uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeModImmInstruction(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodePairLdStInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeModImmTiedInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn, uint64_t Address,
|
||||
static DecodeStatus DecodeAddSubERegInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeAdrInstruction(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodeLogicalImmInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeModImmInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeModImmTiedInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeAdrInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address, const void *Decoder);
|
||||
static DecodeStatus DecodeBaseAddSubImm(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodeBaseAddSubImm(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address, const void *Decoder);
|
||||
static DecodeStatus DecodeUnconditionalBranch(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodeUnconditionalBranch(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeSystemPStateInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn,
|
||||
static DecodeStatus DecodeSystemPStateInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeTestAndBranch(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodeTestAndBranch(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Address, const void *Decoder);
|
||||
|
||||
static DecodeStatus DecodeFMOVLaneInstruction(llvm::MCInst &Inst, unsigned Insn,
|
||||
static DecodeStatus DecodeFMOVLaneInstruction(MCInst &Inst, unsigned Insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeVecShiftR64Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR64Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder);
|
||||
static DecodeStatus DecodeVecShiftR64ImmNarrow(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR64ImmNarrow(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeVecShiftR32Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR32Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder);
|
||||
static DecodeStatus DecodeVecShiftR32ImmNarrow(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR32ImmNarrow(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeVecShiftR16Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR16Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder);
|
||||
static DecodeStatus DecodeVecShiftR16ImmNarrow(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR16ImmNarrow(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr,
|
||||
const void *Decoder);
|
||||
static DecodeStatus DecodeVecShiftR8Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR8Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder);
|
||||
static DecodeStatus DecodeVecShiftL64Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftL64Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder);
|
||||
static DecodeStatus DecodeVecShiftL32Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftL32Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder);
|
||||
static DecodeStatus DecodeVecShiftL16Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftL16Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder);
|
||||
static DecodeStatus DecodeVecShiftL8Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftL8Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder);
|
||||
static DecodeStatus DecodeWSeqPairsClassRegisterClass(MCInst &Inst,
|
||||
unsigned RegNo,
|
||||
@ -196,9 +198,9 @@ static bool Check(DecodeStatus &Out, DecodeStatus In) {
|
||||
#include "AArch64GenDisassemblerTables.inc"
|
||||
#include "AArch64GenInstrInfo.inc"
|
||||
|
||||
#define Success llvm::MCDisassembler::Success
|
||||
#define Fail llvm::MCDisassembler::Fail
|
||||
#define SoftFail llvm::MCDisassembler::SoftFail
|
||||
#define Success MCDisassembler::Success
|
||||
#define Fail MCDisassembler::Fail
|
||||
#define SoftFail MCDisassembler::SoftFail
|
||||
|
||||
static MCDisassembler *createAArch64Disassembler(const Target &T,
|
||||
const MCSubtargetInfo &STI,
|
||||
@ -232,7 +234,7 @@ createAArch64ExternalSymbolizer(const Triple &TT, LLVMOpInfoCallback GetOpInfo,
|
||||
LLVMSymbolLookupCallback SymbolLookUp,
|
||||
void *DisInfo, MCContext *Ctx,
|
||||
std::unique_ptr<MCRelocationInfo> &&RelInfo) {
|
||||
return new llvm::AArch64ExternalSymbolizer(*Ctx, move(RelInfo), GetOpInfo,
|
||||
return new AArch64ExternalSymbolizer(*Ctx, std::move(RelInfo), GetOpInfo,
|
||||
SymbolLookUp, DisInfo);
|
||||
}
|
||||
|
||||
@ -587,7 +589,7 @@ static DecodeStatus DecodeDDDDRegisterClass(MCInst &Inst, unsigned RegNo,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeFixedPointScaleImm32(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeFixedPointScaleImm32(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
// scale{5} is asserted as 1 in tblgen.
|
||||
@ -596,14 +598,14 @@ static DecodeStatus DecodeFixedPointScaleImm32(llvm::MCInst &Inst, unsigned Imm,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeFixedPointScaleImm64(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeFixedPointScaleImm64(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
Inst.addOperand(MCOperand::createImm(64 - Imm));
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodePCRelLabel19(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodePCRelLabel19(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder) {
|
||||
int64_t ImmVal = Imm;
|
||||
const AArch64Disassembler *Dis =
|
||||
@ -619,14 +621,14 @@ static DecodeStatus DecodePCRelLabel19(llvm::MCInst &Inst, unsigned Imm,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeMemExtend(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeMemExtend(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Address, const void *Decoder) {
|
||||
Inst.addOperand(MCOperand::createImm((Imm >> 1) & 1));
|
||||
Inst.addOperand(MCOperand::createImm(Imm & 1));
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeMRSSystemRegister(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeMRSSystemRegister(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Address,
|
||||
const void *Decoder) {
|
||||
Inst.addOperand(MCOperand::createImm(Imm));
|
||||
@ -636,7 +638,7 @@ static DecodeStatus DecodeMRSSystemRegister(llvm::MCInst &Inst, unsigned Imm,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeMSRSystemRegister(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeMSRSystemRegister(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Address,
|
||||
const void *Decoder) {
|
||||
Inst.addOperand(MCOperand::createImm(Imm));
|
||||
@ -644,7 +646,7 @@ static DecodeStatus DecodeMSRSystemRegister(llvm::MCInst &Inst, unsigned Imm,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeFMOVLaneInstruction(llvm::MCInst &Inst, unsigned Insn,
|
||||
static DecodeStatus DecodeFMOVLaneInstruction(MCInst &Inst, unsigned Insn,
|
||||
uint64_t Address,
|
||||
const void *Decoder) {
|
||||
// This decoder exists to add the dummy Lane operand to the MCInst, which must
|
||||
@ -667,78 +669,78 @@ static DecodeStatus DecodeFMOVLaneInstruction(llvm::MCInst &Inst, unsigned Insn,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeVecShiftRImm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftRImm(MCInst &Inst, unsigned Imm,
|
||||
unsigned Add) {
|
||||
Inst.addOperand(MCOperand::createImm(Add - Imm));
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeVecShiftLImm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftLImm(MCInst &Inst, unsigned Imm,
|
||||
unsigned Add) {
|
||||
Inst.addOperand(MCOperand::createImm((Imm + Add) & (Add - 1)));
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeVecShiftR64Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR64Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder) {
|
||||
return DecodeVecShiftRImm(Inst, Imm, 64);
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeVecShiftR64ImmNarrow(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR64ImmNarrow(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
return DecodeVecShiftRImm(Inst, Imm | 0x20, 64);
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeVecShiftR32Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR32Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder) {
|
||||
return DecodeVecShiftRImm(Inst, Imm, 32);
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeVecShiftR32ImmNarrow(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR32ImmNarrow(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
return DecodeVecShiftRImm(Inst, Imm | 0x10, 32);
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeVecShiftR16Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR16Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder) {
|
||||
return DecodeVecShiftRImm(Inst, Imm, 16);
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeVecShiftR16ImmNarrow(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR16ImmNarrow(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
return DecodeVecShiftRImm(Inst, Imm | 0x8, 16);
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeVecShiftR8Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftR8Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder) {
|
||||
return DecodeVecShiftRImm(Inst, Imm, 8);
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeVecShiftL64Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftL64Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder) {
|
||||
return DecodeVecShiftLImm(Inst, Imm, 64);
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeVecShiftL32Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftL32Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder) {
|
||||
return DecodeVecShiftLImm(Inst, Imm, 32);
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeVecShiftL16Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftL16Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder) {
|
||||
return DecodeVecShiftLImm(Inst, Imm, 16);
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeVecShiftL8Imm(llvm::MCInst &Inst, unsigned Imm,
|
||||
static DecodeStatus DecodeVecShiftL8Imm(MCInst &Inst, unsigned Imm,
|
||||
uint64_t Addr, const void *Decoder) {
|
||||
return DecodeVecShiftLImm(Inst, Imm, 8);
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeThreeAddrSRegInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn, uint64_t Addr,
|
||||
static DecodeStatus DecodeThreeAddrSRegInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
unsigned Rd = fieldFromInstruction(insn, 0, 5);
|
||||
unsigned Rn = fieldFromInstruction(insn, 5, 5);
|
||||
@ -799,7 +801,7 @@ static DecodeStatus DecodeThreeAddrSRegInstruction(llvm::MCInst &Inst,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeMoveImmInstruction(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodeMoveImmInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
unsigned Rd = fieldFromInstruction(insn, 0, 5);
|
||||
@ -832,8 +834,8 @@ static DecodeStatus DecodeMoveImmInstruction(llvm::MCInst &Inst, uint32_t insn,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeUnsignedLdStInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn, uint64_t Addr,
|
||||
static DecodeStatus DecodeUnsignedLdStInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
unsigned Rt = fieldFromInstruction(insn, 0, 5);
|
||||
unsigned Rn = fieldFromInstruction(insn, 5, 5);
|
||||
@ -893,8 +895,8 @@ static DecodeStatus DecodeUnsignedLdStInstruction(llvm::MCInst &Inst,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeSignedLdStInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn, uint64_t Addr,
|
||||
static DecodeStatus DecodeSignedLdStInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
unsigned Rt = fieldFromInstruction(insn, 0, 5);
|
||||
unsigned Rn = fieldFromInstruction(insn, 5, 5);
|
||||
@ -1078,8 +1080,8 @@ static DecodeStatus DecodeSignedLdStInstruction(llvm::MCInst &Inst,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeExclusiveLdStInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn, uint64_t Addr,
|
||||
static DecodeStatus DecodeExclusiveLdStInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
unsigned Rt = fieldFromInstruction(insn, 0, 5);
|
||||
unsigned Rn = fieldFromInstruction(insn, 5, 5);
|
||||
@ -1161,7 +1163,7 @@ static DecodeStatus DecodeExclusiveLdStInstruction(llvm::MCInst &Inst,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodePairLdStInstruction(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodePairLdStInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
unsigned Rt = fieldFromInstruction(insn, 0, 5);
|
||||
@ -1290,8 +1292,8 @@ static DecodeStatus DecodePairLdStInstruction(llvm::MCInst &Inst, uint32_t insn,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeAddSubERegInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn, uint64_t Addr,
|
||||
static DecodeStatus DecodeAddSubERegInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
unsigned Rd = fieldFromInstruction(insn, 0, 5);
|
||||
unsigned Rn = fieldFromInstruction(insn, 5, 5);
|
||||
@ -1347,8 +1349,8 @@ static DecodeStatus DecodeAddSubERegInstruction(llvm::MCInst &Inst,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeLogicalImmInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn, uint64_t Addr,
|
||||
static DecodeStatus DecodeLogicalImmInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
unsigned Rd = fieldFromInstruction(insn, 0, 5);
|
||||
unsigned Rn = fieldFromInstruction(insn, 5, 5);
|
||||
@ -1378,7 +1380,7 @@ static DecodeStatus DecodeLogicalImmInstruction(llvm::MCInst &Inst,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeModImmInstruction(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodeModImmInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
unsigned Rd = fieldFromInstruction(insn, 0, 5);
|
||||
@ -1417,8 +1419,8 @@ static DecodeStatus DecodeModImmInstruction(llvm::MCInst &Inst, uint32_t insn,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeModImmTiedInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn, uint64_t Addr,
|
||||
static DecodeStatus DecodeModImmTiedInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
unsigned Rd = fieldFromInstruction(insn, 0, 5);
|
||||
unsigned cmode = fieldFromInstruction(insn, 12, 4);
|
||||
@ -1435,7 +1437,7 @@ static DecodeStatus DecodeModImmTiedInstruction(llvm::MCInst &Inst,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeAdrInstruction(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodeAdrInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr, const void *Decoder) {
|
||||
unsigned Rd = fieldFromInstruction(insn, 0, 5);
|
||||
int64_t imm = fieldFromInstruction(insn, 5, 19) << 2;
|
||||
@ -1454,7 +1456,7 @@ static DecodeStatus DecodeAdrInstruction(llvm::MCInst &Inst, uint32_t insn,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeBaseAddSubImm(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodeBaseAddSubImm(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr, const void *Decoder) {
|
||||
unsigned Rd = fieldFromInstruction(insn, 0, 5);
|
||||
unsigned Rn = fieldFromInstruction(insn, 5, 5);
|
||||
@ -1490,7 +1492,7 @@ static DecodeStatus DecodeBaseAddSubImm(llvm::MCInst &Inst, uint32_t insn,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeUnconditionalBranch(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodeUnconditionalBranch(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
int64_t imm = fieldFromInstruction(insn, 0, 26);
|
||||
@ -1507,8 +1509,8 @@ static DecodeStatus DecodeUnconditionalBranch(llvm::MCInst &Inst, uint32_t insn,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeSystemPStateInstruction(llvm::MCInst &Inst,
|
||||
uint32_t insn, uint64_t Addr,
|
||||
static DecodeStatus DecodeSystemPStateInstruction(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr,
|
||||
const void *Decoder) {
|
||||
uint64_t op1 = fieldFromInstruction(insn, 16, 3);
|
||||
uint64_t op2 = fieldFromInstruction(insn, 5, 3);
|
||||
@ -1531,7 +1533,7 @@ static DecodeStatus DecodeSystemPStateInstruction(llvm::MCInst &Inst,
|
||||
return Fail;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeTestAndBranch(llvm::MCInst &Inst, uint32_t insn,
|
||||
static DecodeStatus DecodeTestAndBranch(MCInst &Inst, uint32_t insn,
|
||||
uint64_t Addr, const void *Decoder) {
|
||||
uint64_t Rt = fieldFromInstruction(insn, 0, 5);
|
||||
uint64_t bit = fieldFromInstruction(insn, 31, 1) << 5;
|
||||
|
Loading…
x
Reference in New Issue
Block a user