CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Core/MIPS/IR/IRAnalysis.h
Views: 1401
// Copyright (c) 2016- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.1617#pragma once1819#include "Core/MIPS/IR/IRInst.h"2021struct IRInstMeta {22union {23IRInst i;24struct {25IROp op;26union {27IRReg dest;28IRReg src3;29};30IRReg src1;31IRReg src2;32u32 constant;33};34};35IRMeta m;36};3738static_assert(offsetof(IRInst, src2) == offsetof(IRInstMeta, src2));3940inline IRInstMeta GetIRMeta(const IRInst &inst) {41return { { inst }, *GetIRMeta(inst.op) };42}4344bool IRReadsFromFPR(const IRInstMeta &inst, int reg, bool *directly = nullptr);45bool IRReadsFromGPR(const IRInstMeta &inst, int reg, bool *directly = nullptr);46bool IRWritesToGPR(const IRInstMeta &inst, int reg);47bool IRWritesToFPR(const IRInstMeta &inst, int reg);48int IRDestGPR(const IRInstMeta &inst);49int IRDestFPRs(const IRInstMeta &inst, IRReg regs[4]);50int IRReadsFromGPRs(const IRInstMeta &inst, IRReg regs[4]);51int IRReadsFromFPRs(const IRInstMeta &inst, IRReg regs[16]);5253struct IRSituation {54int lookaheadCount;55int currentIndex;56const IRInst *instructions;57int numInstructions;58};5960enum class IRUsage {61UNKNOWN,62UNUSED,63READ,64WRITE,65CLOBBERED,66};6768IRUsage IRNextGPRUsage(int gpr, const IRSituation &info);69IRUsage IRNextFPRUsage(int fpr, const IRSituation &info);707172