mirror of
https://github.com/corda/corda.git
synced 2025-06-18 07:08:15 +00:00
use ir::Type in Compiler::initLocal
This commit is contained in:
committed by
Joshua Warner
parent
4bfb359cdd
commit
d8914a9646
@ -2118,6 +2118,8 @@ unsigned typeFootprint(Context* c, ir::Type type)
|
||||
case ir::Type::Integer:
|
||||
return type.size() / 4;
|
||||
case ir::Type::Object:
|
||||
case ir::Type::Address:
|
||||
case ir::Type::Half:
|
||||
return 1;
|
||||
default:
|
||||
abort(c);
|
||||
@ -2274,7 +2276,7 @@ class MyCompiler: public Compiler {
|
||||
for (unsigned li = 0; li < c.localFootprint; ++li) {
|
||||
Local* local = c.locals + li;
|
||||
if (local->value == 0) {
|
||||
initLocal(1, li, IntegerType);
|
||||
initLocal(1, li, ir::Type(ir::Type::Address, TargetBytesPerWord));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2510,11 +2512,13 @@ class MyCompiler: public Compiler {
|
||||
appendReturn(&c, 0, 0);
|
||||
}
|
||||
|
||||
virtual void initLocal(unsigned footprint, unsigned index, OperandType type)
|
||||
virtual void initLocal(unsigned footprint, unsigned index, ir::Type type)
|
||||
{
|
||||
// TODO: enable the following assertion when possible:
|
||||
// assert(&c, footprint == typeFootprint(type));
|
||||
assert(&c, index + footprint <= c.localFootprint);
|
||||
|
||||
Value* v = value(&c, valueType(&c, type));
|
||||
Value* v = value(&c, type);
|
||||
|
||||
if (footprint > 1) {
|
||||
assert(&c, footprint == 2);
|
||||
@ -2564,7 +2568,7 @@ class MyCompiler: public Compiler {
|
||||
for (int i = 0; i < static_cast<int>(c.localFootprint); ++i) {
|
||||
Local* local = e->locals() + i;
|
||||
if (local->value) {
|
||||
initLocal(1, i, isGeneralValue(local->value) ? IntegerType : FloatType);
|
||||
initLocal(1, i, local->value->type);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user