2017-07-27 07:20:35 +08:00
|
|
|
//===- HexagonBitTracker.h --------------------------------------*- C++ -*-===//
|
2015-07-07 23:16:42 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2017-01-04 10:02:05 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
|
|
|
|
#define LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
|
2015-07-07 23:16:42 +08:00
|
|
|
|
|
|
|
#include "BitTracker.h"
|
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2017-01-04 10:02:05 +08:00
|
|
|
#include <cstdint>
|
2015-07-07 23:16:42 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
2017-01-04 10:02:05 +08:00
|
|
|
|
|
|
|
class HexagonInstrInfo;
|
|
|
|
class HexagonRegisterInfo;
|
2017-07-27 07:20:35 +08:00
|
|
|
class MachineFrameInfo;
|
|
|
|
class MachineFunction;
|
|
|
|
class MachineInstr;
|
|
|
|
class MachineRegisterInfo;
|
2015-07-07 23:16:42 +08:00
|
|
|
|
|
|
|
struct HexagonEvaluator : public BitTracker::MachineEvaluator {
|
2017-07-27 07:20:35 +08:00
|
|
|
using CellMapType = BitTracker::CellMapType;
|
|
|
|
using RegisterRef = BitTracker::RegisterRef;
|
|
|
|
using RegisterCell = BitTracker::RegisterCell;
|
|
|
|
using BranchTargetList = BitTracker::BranchTargetList;
|
2015-07-07 23:16:42 +08:00
|
|
|
|
2015-07-14 04:38:16 +08:00
|
|
|
HexagonEvaluator(const HexagonRegisterInfo &tri, MachineRegisterInfo &mri,
|
|
|
|
const HexagonInstrInfo &tii, MachineFunction &mf);
|
2015-07-07 23:16:42 +08:00
|
|
|
|
2016-07-12 09:55:32 +08:00
|
|
|
bool evaluate(const MachineInstr &MI, const CellMapType &Inputs,
|
2015-07-14 04:38:16 +08:00
|
|
|
CellMapType &Outputs) const override;
|
2016-07-12 09:55:32 +08:00
|
|
|
bool evaluate(const MachineInstr &BI, const CellMapType &Inputs,
|
2015-07-14 04:38:16 +08:00
|
|
|
BranchTargetList &Targets, bool &FallsThru) const override;
|
2015-07-07 23:16:42 +08:00
|
|
|
|
2015-07-14 04:38:16 +08:00
|
|
|
BitTracker::BitMask mask(unsigned Reg, unsigned Sub) const override;
|
2015-07-07 23:16:42 +08:00
|
|
|
|
2017-09-26 03:12:55 +08:00
|
|
|
uint16_t getPhysRegBitWidth(unsigned Reg) const override;
|
|
|
|
|
|
|
|
const TargetRegisterClass &composeWithSubRegIndex(
|
|
|
|
const TargetRegisterClass &RC, unsigned Idx) const override;
|
|
|
|
|
2015-07-14 04:38:16 +08:00
|
|
|
MachineFunction &MF;
|
|
|
|
MachineFrameInfo &MFI;
|
|
|
|
const HexagonInstrInfo &TII;
|
2015-07-07 23:16:42 +08:00
|
|
|
|
|
|
|
private:
|
2016-07-12 09:55:32 +08:00
|
|
|
bool evaluateLoad(const MachineInstr &MI, const CellMapType &Inputs,
|
2015-07-14 04:38:16 +08:00
|
|
|
CellMapType &Outputs) const;
|
2016-07-12 09:55:32 +08:00
|
|
|
bool evaluateFormalCopy(const MachineInstr &MI, const CellMapType &Inputs,
|
2015-07-14 04:38:16 +08:00
|
|
|
CellMapType &Outputs) const;
|
2015-07-07 23:16:42 +08:00
|
|
|
|
|
|
|
unsigned getNextPhysReg(unsigned PReg, unsigned Width) const;
|
|
|
|
unsigned getVirtRegFor(unsigned PReg) const;
|
|
|
|
|
|
|
|
// Type of formal parameter extension.
|
|
|
|
struct ExtType {
|
|
|
|
enum { SExt, ZExt };
|
2017-01-04 10:02:05 +08:00
|
|
|
|
|
|
|
ExtType() = default;
|
2015-07-07 23:16:42 +08:00
|
|
|
ExtType(char t, uint16_t w) : Type(t), Width(w) {}
|
2017-01-04 10:02:05 +08:00
|
|
|
|
|
|
|
char Type = 0;
|
|
|
|
uint16_t Width = 0;
|
2015-07-07 23:16:42 +08:00
|
|
|
};
|
|
|
|
// Map VR -> extension type.
|
2017-07-27 07:20:35 +08:00
|
|
|
using RegExtMap = DenseMap<unsigned, ExtType>;
|
2015-07-07 23:16:42 +08:00
|
|
|
RegExtMap VRX;
|
|
|
|
};
|
|
|
|
|
2015-07-14 04:38:16 +08:00
|
|
|
} // end namespace llvm
|
2015-07-07 23:16:42 +08:00
|
|
|
|
2017-01-04 10:02:05 +08:00
|
|
|
#endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
|