Commit 7e9ba096 by Nicolas Capens

Fix support for routines taking no arguments.

Change-Id: I678f4c94d140bb5cd66569336b2813b8c7c0e075 Reviewed-on: https://swiftshader-review.googlesource.com/5781Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 9913558b
...@@ -2526,12 +2526,17 @@ namespace sw ...@@ -2526,12 +2526,17 @@ namespace sw
Routine *operator()(const wchar_t *name, ...); Routine *operator()(const wchar_t *name, ...);
private: protected:
Nucleus *core; Nucleus *core;
llvm::Function *function; llvm::Function *function;
std::vector<llvm::Type*> arguments; std::vector<llvm::Type*> arguments;
}; };
template<typename Return>
class Function<Return()> : public Function<Return(Void)>
{
};
template<int index, typename Return, typename... Arguments> template<int index, typename Return, typename... Arguments>
Argument<typename ArgI<index, Arguments...>::Type> Arg(Function<Return(Arguments...)> &function) Argument<typename ArgI<index, Arguments...>::Type> Arg(Function<Return(Arguments...)> &function)
{ {
...@@ -2978,7 +2983,10 @@ namespace sw ...@@ -2978,7 +2983,10 @@ namespace sw
llvm::Type *types[] = {Arguments::getType()...}; llvm::Type *types[] = {Arguments::getType()...};
for(llvm::Type *type : types) for(llvm::Type *type : types)
{ {
arguments.push_back(type); if(type != Void::getType())
{
arguments.push_back(type);
}
} }
function = Nucleus::createFunction(Return::getType(), arguments); function = Nucleus::createFunction(Return::getType(), arguments);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment