Fix a bug in the X86 ABI. The size of a struct is different from the size of a

pointer to that struct...
This commit is contained in:
Frits van Bommel 2009-03-06 21:15:13 +01:00
parent 1c6c4bc361
commit 5af82ee8d3
4 changed files with 46 additions and 7 deletions

View file

@ -3,6 +3,7 @@
#include "gen/tollvm.h"
#include "gen/abi.h"
#include "gen/dvalue.h"
#include "gen/logger.h"
#include "ir/irfunction.h"
#include <sstream>
@ -27,32 +28,44 @@ IrFuncTyArg::IrFuncTyArg(Type* t, bool bref, unsigned a)
llvm::Value* IrFuncTy::putRet(Type* dty, DValue* val)
{
assert(!arg_sret);
if (ret->rewrite)
if (ret->rewrite) {
Logger::println("Rewrite: putRet");
LOG_SCOPE
return ret->rewrite->put(dty, val);
}
return val->getRVal();
}
llvm::Value* IrFuncTy::getRet(Type* dty, DValue* val)
{
assert(!arg_sret);
if (ret->rewrite)
if (ret->rewrite) {
Logger::println("Rewrite: getRet");
LOG_SCOPE
return ret->rewrite->get(dty, val);
}
return val->getRVal();
}
llvm::Value* IrFuncTy::putParam(Type* dty, int idx, DValue* val)
{
assert(idx >= 0 && idx < args.size() && "invalid putParam");
if (args[idx]->rewrite)
if (args[idx]->rewrite) {
Logger::println("Rewrite: putParam");
LOG_SCOPE
return args[idx]->rewrite->put(dty, val);
}
return val->getRVal();
}
llvm::Value* IrFuncTy::getParam(Type* dty, int idx, DValue* val)
{
assert(idx >= 0 && idx < args.size() && "invalid getParam");
if (args[idx]->rewrite)
if (args[idx]->rewrite) {
Logger::println("Rewrite: getParam (get)");
LOG_SCOPE
return args[idx]->rewrite->get(dty, val);
}
return val->getRVal();
}
@ -62,6 +75,8 @@ void IrFuncTy::getParam(Type* dty, int idx, DValue* val, llvm::Value* lval)
if (args[idx]->rewrite)
{
Logger::println("Rewrite: getParam (getL)");
LOG_SCOPE
args[idx]->rewrite->getL(dty, val, lval);
return;
}