~ppsspp/ppsspp/ppsspp_1.3.0

« back to all changes in this revision

Viewing changes to Core/MIPS/IR/IRRegCache.h

  • Committer: Sérgio Benjamim
  • Date: 2017-01-02 00:12:05 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20170102001205-cxbta9za203nmjwm
1.3.0 source (from ppsspp_1.3.0-r160.p5.l1762.a165.t83~56~ubuntu16.04.1.tar.xz).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#pragma once
 
2
 
 
3
// IRRegCache is only to perform pre-constant folding. This is worth it to get cleaner
 
4
// IR.
 
5
 
 
6
#include "Common/CommonTypes.h"
 
7
#include "Core/MIPS/MIPS.h"
 
8
 
 
9
enum {
 
10
        TOTAL_MAPPABLE_MIPSREGS = 256,
 
11
};
 
12
 
 
13
struct RegIR {
 
14
        bool isImm;
 
15
        u32 immVal;
 
16
};
 
17
 
 
18
class IRWriter;
 
19
 
 
20
// Transient
 
21
class IRRegCache {
 
22
public:
 
23
        IRRegCache(IRWriter *ir);
 
24
 
 
25
        void SetImm(int r, u32 immVal) {
 
26
                reg_[r].isImm = true;
 
27
                reg_[r].immVal = immVal;
 
28
        }
 
29
 
 
30
        bool IsImm(int r) const { return reg_[r].isImm; }
 
31
        u32 GetImm(int r) const { return reg_[r].immVal; }
 
32
 
 
33
        void FlushAll();
 
34
 
 
35
        void MapDirty(int rd);
 
36
        void MapIn(int rd);
 
37
        void MapInIn(int rs, int rt);
 
38
        void MapInInIn(int rd, int rs, int rt);
 
39
        void MapDirtyIn(int rd, int rs);
 
40
        void MapDirtyInIn(int rd, int rs, int rt);
 
41
 
 
42
private:
 
43
        void Flush(int rd);
 
44
        void Discard(int rd);
 
45
        RegIR reg_[TOTAL_MAPPABLE_MIPSREGS];
 
46
        IRWriter *ir_;
 
47
};