mirror of https://github.com/inolen/redream.git
fix for const value() getter on Value
This commit is contained in:
parent
79ad6dc037
commit
ed806dc781
|
@ -1430,7 +1430,7 @@ EMITTER(LSHR) {
|
|||
EMITTER(BRANCH) {
|
||||
if (instr->arg0()->type() == VALUE_BLOCK) {
|
||||
// jump to local block
|
||||
Block *dst = instr->arg0()->value<Block *>();
|
||||
const Block *dst = instr->arg0()->value<const Block *>();
|
||||
c.jmp(GetLabel(dst), Xbyak::CodeGenerator::T_NEAR);
|
||||
} else {
|
||||
// return if we need to branch to a far block
|
||||
|
@ -1450,8 +1450,8 @@ EMITTER(BRANCH_COND) {
|
|||
instr->arg2()->type() == VALUE_BLOCK) {
|
||||
// jump to local block
|
||||
const Block *next_block = instr->block()->next();
|
||||
Block *block_true = instr->arg1()->value<Block *>();
|
||||
Block *block_false = instr->arg2()->value<Block *>();
|
||||
const Block *block_true = instr->arg1()->value<const Block *>();
|
||||
const Block *block_false = instr->arg2()->value<const Block *>();
|
||||
|
||||
// don't emit a jump if the block is next
|
||||
if (next_block != block_true) {
|
||||
|
|
|
@ -192,7 +192,7 @@ void IRBuilder::Dump() const {
|
|||
ss << v->value<double>();
|
||||
break;
|
||||
case VALUE_BLOCK:
|
||||
DumpBlock(ss, v->value<Block *>());
|
||||
DumpBlock(ss, v->value<const Block *>());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,8 +128,8 @@ class Value {
|
|||
|
||||
bool constant() const { return constant_; }
|
||||
|
||||
template <typename T>
|
||||
T value() const;
|
||||
template <typename T> T value() const;
|
||||
template <typename T> T value();
|
||||
|
||||
const core::IntrusiveList<ValueRef> &refs() const { return refs_; }
|
||||
core::IntrusiveList<ValueRef> &refs() { return refs_; }
|
||||
|
@ -165,44 +165,72 @@ class Value {
|
|||
|
||||
template <>
|
||||
inline int8_t Value::value() const {
|
||||
DCHECK_EQ(type_, VALUE_I8);
|
||||
DCHECK_EQ(constant_, true);
|
||||
DCHECK(constant_ && type_ == VALUE_I8);
|
||||
return i8_;
|
||||
}
|
||||
template <>
|
||||
inline int8_t Value::value() {
|
||||
DCHECK(constant_ && type_ == VALUE_I8);
|
||||
return i8_;
|
||||
}
|
||||
template <>
|
||||
inline int16_t Value::value() const {
|
||||
DCHECK_EQ(type_, VALUE_I16);
|
||||
DCHECK_EQ(constant_, true);
|
||||
DCHECK(constant_ && type_ == VALUE_I16);
|
||||
return i16_;
|
||||
}
|
||||
template <>
|
||||
inline int16_t Value::value() {
|
||||
DCHECK(constant_ && type_ == VALUE_I16);
|
||||
return i16_;
|
||||
}
|
||||
template <>
|
||||
inline int32_t Value::value() const {
|
||||
DCHECK_EQ(type_, VALUE_I32);
|
||||
DCHECK_EQ(constant_, true);
|
||||
DCHECK(constant_ && type_ == VALUE_I32);
|
||||
return i32_;
|
||||
}
|
||||
template <>
|
||||
inline int32_t Value::value() {
|
||||
DCHECK(constant_ && type_ == VALUE_I32);
|
||||
return i32_;
|
||||
}
|
||||
template <>
|
||||
inline int64_t Value::value() const {
|
||||
DCHECK_EQ(type_, VALUE_I64);
|
||||
DCHECK_EQ(constant_, true);
|
||||
DCHECK(constant_ && type_ == VALUE_I64);
|
||||
return i64_;
|
||||
}
|
||||
template <>
|
||||
inline int64_t Value::value() {
|
||||
DCHECK(constant_ && type_ == VALUE_I64);
|
||||
return i64_;
|
||||
}
|
||||
template <>
|
||||
inline float Value::value() const {
|
||||
DCHECK_EQ(type_, VALUE_F32);
|
||||
DCHECK_EQ(constant_, true);
|
||||
DCHECK(constant_ && type_ == VALUE_F32);
|
||||
return f32_;
|
||||
}
|
||||
template <>
|
||||
inline float Value::value() {
|
||||
DCHECK(constant_ && type_ == VALUE_F32);
|
||||
return f32_;
|
||||
}
|
||||
template <>
|
||||
inline double Value::value() const {
|
||||
DCHECK_EQ(type_, VALUE_F64);
|
||||
DCHECK_EQ(constant_, true);
|
||||
DCHECK(constant_ && type_ == VALUE_F64);
|
||||
return f64_;
|
||||
}
|
||||
template <>
|
||||
inline Block *Value::value() const {
|
||||
DCHECK_EQ(type_, VALUE_BLOCK);
|
||||
DCHECK_EQ(constant_, true);
|
||||
inline double Value::value() {
|
||||
DCHECK(constant_ && type_ == VALUE_F64);
|
||||
return f64_;
|
||||
}
|
||||
template <>
|
||||
inline const Block *Value::value() const {
|
||||
DCHECK(constant_ && type_ == VALUE_BLOCK);
|
||||
return block_;
|
||||
}
|
||||
template <>
|
||||
inline Block *Value::value() {
|
||||
DCHECK(constant_ && type_ == VALUE_BLOCK);
|
||||
return block_;
|
||||
}
|
||||
|
||||
|
|
|
@ -444,10 +444,10 @@ void TileAccelerator::WritePVRState(TileContext *tactx) {
|
|||
void TileAccelerator::WriteBackgroundState(TileContext *tactx) {
|
||||
// according to the hardware docs, this is the correct calculation of the
|
||||
// background ISP address. however, in practice, the second TA buffer's ISP
|
||||
// address comes out to be 0x800000 when booting the the bios when the vram
|
||||
// is only 8mb total. by examining a raw memory dump, the ISP data is only
|
||||
// ever available at 0x0 when booting the bios, so masking this seems to
|
||||
// be the correct solution
|
||||
// address comes out to be 0x800000 when booting the bios and the vram is
|
||||
// only 8mb total. by examining a raw memory dump, the ISP data is only ever
|
||||
// available at 0x0 when booting the bios, so masking this seems to be the
|
||||
// correct solution
|
||||
uint32_t vram_offset =
|
||||
PVR_VRAM64_START +
|
||||
((tactx->addr + dc_->ISP_BACKGND_T.tag_address * 4) & 0x7fffff);
|
||||
|
|
Loading…
Reference in New Issue