remove redundant size parameters to appendReturn and appendCall

This commit is contained in:
Joshua Warner 2014-05-03 21:34:26 -06:00 committed by Joshua Warner
parent 9282c78549
commit c259faf24a
3 changed files with 22 additions and 31 deletions

View File

@ -2436,7 +2436,6 @@ class MyCompiler: public Compiler {
flags, flags,
traceHandler, traceHandler,
result, result,
resultType.size(),
util::Slice<ir::Value*>(RUNTIME_ARRAY_BODY(arguments), index)); util::Slice<ir::Value*>(RUNTIME_ARRAY_BODY(arguments), index));
return result; return result;
@ -2456,7 +2455,6 @@ class MyCompiler: public Compiler {
flags, flags,
traceHandler, traceHandler,
result, result,
resultType.size(),
arguments); arguments);
assert(&c, c.stack == b); assert(&c, c.stack == b);
return result; return result;
@ -2464,12 +2462,13 @@ class MyCompiler: public Compiler {
virtual void return_(ir::Value* a) virtual void return_(ir::Value* a)
{ {
appendReturn(&c, a->type.size(), static_cast<Value*>(a)); assert(&c, a);
appendReturn(&c, static_cast<Value*>(a));
} }
virtual void return_() virtual void return_()
{ {
appendReturn(&c, 0, 0); appendReturn(&c, 0);
} }
virtual void initLocal(unsigned footprint, unsigned index, ir::Type type) virtual void initLocal(unsigned footprint, unsigned index, ir::Type type)

View File

@ -292,19 +292,17 @@ class CallEvent: public Event {
ir::CallingConvention callingConvention, ir::CallingConvention callingConvention,
unsigned flags, unsigned flags,
TraceHandler* traceHandler, TraceHandler* traceHandler,
Value* result, Value* resultValue,
unsigned resultSize,
util::Slice<ir::Value*> arguments) util::Slice<ir::Value*> arguments)
: Event(c), : Event(c),
address(address), address(address),
traceHandler(traceHandler), traceHandler(traceHandler),
result(result), resultValue(resultValue),
returnAddressSurrogate(0), returnAddressSurrogate(0),
framePointerSurrogate(0), framePointerSurrogate(0),
popIndex(0), popIndex(0),
stackArgumentIndex(0), stackArgumentIndex(0),
flags(flags), flags(flags),
resultSize(resultSize),
stackArgumentFootprint(callingConvention == ir::AvianCallingConvention stackArgumentFootprint(callingConvention == ir::AvianCallingConvention
? arguments.count ? arguments.count
: 0) : 0)
@ -573,10 +571,12 @@ class CallEvent: public Event {
clean(c, this, stackBefore, localsBefore, reads, popIndex); clean(c, this, stackBefore, localsBefore, reads, popIndex);
if (resultSize and live(c, result)) { if (resultValue->type.size() and live(c, resultValue)) {
result->addSite(c, registerSite(c, c->arch->returnLow())); resultValue->addSite(c, registerSite(c, c->arch->returnLow()));
if (resultSize > vm::TargetBytesPerWord and live(c, result->nextWord)) { if (resultValue->type.size()
result->nextWord->addSite(c, registerSite(c, c->arch->returnHigh())); > vm::TargetBytesPerWord and live(c, resultValue->nextWord)) {
resultValue->nextWord->addSite(c,
registerSite(c, c->arch->returnHigh()));
} }
} }
} }
@ -587,13 +587,12 @@ class CallEvent: public Event {
Value* address; Value* address;
TraceHandler* traceHandler; TraceHandler* traceHandler;
Value* result; Value* resultValue;
Value* returnAddressSurrogate; Value* returnAddressSurrogate;
Value* framePointerSurrogate; Value* framePointerSurrogate;
unsigned popIndex; unsigned popIndex;
unsigned stackArgumentIndex; unsigned stackArgumentIndex;
unsigned flags; unsigned flags;
unsigned resultSize;
unsigned stackArgumentFootprint; unsigned stackArgumentFootprint;
}; };
@ -603,10 +602,8 @@ void appendCall(Context* c,
unsigned flags, unsigned flags,
TraceHandler* traceHandler, TraceHandler* traceHandler,
Value* result, Value* result,
unsigned resultSize,
util::Slice<ir::Value*> arguments) util::Slice<ir::Value*> arguments)
{ {
assert(c, resultSize == result->type.size());
append(c, append(c,
new (c->zone) CallEvent(c, new (c->zone) CallEvent(c,
address, address,
@ -614,20 +611,20 @@ void appendCall(Context* c,
flags, flags,
traceHandler, traceHandler,
result, result,
resultSize,
arguments)); arguments));
} }
class ReturnEvent: public Event { class ReturnEvent: public Event {
public: public:
ReturnEvent(Context* c, unsigned size, Value* value): ReturnEvent(Context* c, Value* value) : Event(c), value(value)
Event(c), value(value)
{ {
if (value) { if (value) {
this->addReads(c, value, size, this->addReads(c,
SiteMask::fixedRegisterMask(c->arch->returnLow()), value,
SiteMask::fixedRegisterMask(c->arch->returnHigh())); value->type.size(),
SiteMask::fixedRegisterMask(c->arch->returnLow()),
SiteMask::fixedRegisterMask(c->arch->returnHigh()));
} }
} }
@ -650,9 +647,9 @@ class ReturnEvent: public Event {
Value* value; Value* value;
}; };
void appendReturn(Context* c, unsigned size, Value* value) { void appendReturn(Context* c, Value* value)
assert(c, (value == 0 && size == 0) || size == value->type.size()); {
append(c, new(c->zone) ReturnEvent(c, size, value)); append(c, new (c->zone) ReturnEvent(c, value));
} }
class MoveEvent: public Event { class MoveEvent: public Event {
@ -1062,7 +1059,6 @@ void appendCombine(Context* c,
0, 0,
0, 0,
resultValue, resultValue,
resultValue->type.size(),
slice); slice);
} else { } else {
append(c, append(c,
@ -1190,7 +1186,6 @@ void appendTranslate(Context* c,
0, 0,
0, 0,
resultValue, resultValue,
resultValue->type.size(),
slice); slice);
} else { } else {
append(c, append(c,
@ -1562,7 +1557,6 @@ appendBranch(Context* c, lir::TernaryOperation type, unsigned size, Value* first
0, 0,
0, 0,
result, result,
4,
slice); slice);
appendBranch(c, appendBranch(c,

View File

@ -119,11 +119,9 @@ void appendCall(Context* c,
unsigned flags, unsigned flags,
TraceHandler* traceHandler, TraceHandler* traceHandler,
Value* result, Value* result,
unsigned resultSize,
util::Slice<ir::Value*> arguments); util::Slice<ir::Value*> arguments);
void void appendReturn(Context* c, Value* value);
appendReturn(Context* c, unsigned size, Value* value);
void void
appendMove(Context* c, lir::BinaryOperation type, unsigned srcSize, appendMove(Context* c, lir::BinaryOperation type, unsigned srcSize,