1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00

[Hexagon] Simplify MCCodeEmitter, move data to tables

llvm-svn: 331883
This commit is contained in:
Krzysztof Parzyszek 2018-05-09 15:02:04 +00:00
parent 64645f6c32
commit eb411966ec
2 changed files with 567 additions and 588 deletions

File diff suppressed because it is too large Load Diff

View File

@ -35,26 +35,20 @@ class raw_ostream;
class HexagonMCCodeEmitter : public MCCodeEmitter { class HexagonMCCodeEmitter : public MCCodeEmitter {
MCContext &MCT; MCContext &MCT;
MCInstrInfo const &MCII; MCInstrInfo const &MCII;
std::unique_ptr<unsigned> Addend;
std::unique_ptr<bool> Extended;
std::unique_ptr<bool> SubInst1;
std::unique_ptr<MCInst const *> CurrentBundle;
std::unique_ptr<size_t> CurrentIndex;
// helper routine for getMachineOpValue() // A mutable state of the emitter when encoding bundles and duplexes.
unsigned getExprOpValue(const MCInst &MI, const MCOperand &MO, struct EmitterState {
const MCExpr *ME, SmallVectorImpl<MCFixup> &Fixups, unsigned Addend = 0;
const MCSubtargetInfo &STI) const; bool Extended = false;
bool SubInst1 = false;
Hexagon::Fixups getFixupNoBits(MCInstrInfo const &MCII, const MCInst &MI, const MCInst *Bundle = nullptr;
const MCOperand &MO, size_t Index = 0;
const MCSymbolRefExpr::VariantKind kind) const; };
mutable EmitterState State;
public: public:
HexagonMCCodeEmitter(MCInstrInfo const &aMII, MCContext &aMCT); HexagonMCCodeEmitter(MCInstrInfo const &MII, MCContext &MCT)
: MCT(MCT), MCII(MII) {}
// Return parse bits for instruction `MCI' inside bundle `MCB'
uint32_t parseBits(size_t Last, MCInst const &MCB, MCInst const &MCI) const;
void encodeInstruction(MCInst const &MI, raw_ostream &OS, void encodeInstruction(MCInst const &MI, raw_ostream &OS,
SmallVectorImpl<MCFixup> &Fixups, SmallVectorImpl<MCFixup> &Fixups,
@ -77,6 +71,18 @@ public:
MCSubtargetInfo const &STI) const; MCSubtargetInfo const &STI) const;
private: private:
// helper routine for getMachineOpValue()
unsigned getExprOpValue(const MCInst &MI, const MCOperand &MO,
const MCExpr *ME, SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const;
Hexagon::Fixups getFixupNoBits(MCInstrInfo const &MCII, const MCInst &MI,
const MCOperand &MO,
const MCSymbolRefExpr::VariantKind Kind) const;
// Return parse bits for instruction `MCI' inside bundle `MCB'
uint32_t parseBits(size_t Last, MCInst const &MCB, MCInst const &MCI) const;
uint64_t computeAvailableFeatures(const FeatureBitset &FB) const; uint64_t computeAvailableFeatures(const FeatureBitset &FB) const;
void verifyInstructionPredicates(const MCInst &MI, void verifyInstructionPredicates(const MCInst &MI,
uint64_t AvailableFeatures) const; uint64_t AvailableFeatures) const;