mirror of
https://github.com/open-goal/jak-project
synced 2026-08-07 10:16:45 -04:00
integer constant program working up to ir
This commit is contained in:
+13
-2
@@ -1,11 +1,16 @@
|
||||
#include "Val.h"
|
||||
#include "Env.h"
|
||||
|
||||
/*!
|
||||
* Fallback to_gpr if a more optimized one is not provided.
|
||||
*/
|
||||
const RegVal* Val::to_gpr(FunctionEnv* fe) const {
|
||||
(void)fe;
|
||||
throw std::runtime_error("Val::to_gpr NYI"); // todo
|
||||
auto rv = to_reg(fe);
|
||||
if(rv->ireg().kind == emitter::RegKind::GPR) {
|
||||
return rv;
|
||||
} else {
|
||||
throw std::runtime_error("Val::to_gpr NYI"); // todo
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -38,4 +43,10 @@ const RegVal * RegVal::to_xmm(FunctionEnv* fe) const {
|
||||
} else {
|
||||
throw std::runtime_error("RegVal::to_xmm NYI"); // todo
|
||||
}
|
||||
}
|
||||
|
||||
const RegVal * IntegerConstantVal::to_reg(FunctionEnv* fe) const {
|
||||
auto rv = fe->make_gpr(m_ts);
|
||||
fe->emit(std::make_unique<IR_LoadConstant64>(rv, m_value));
|
||||
return rv;
|
||||
}
|
||||
Reference in New Issue
Block a user