Skip to content

Commit cf0f440

Browse files
committed
LLVMCodeBuilder: Allow different arg types in createOp()
1 parent 138197f commit cf0f440

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/dev/engine/internal/llvm/llvmcodebuilder.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,14 +1438,27 @@ void LLVMCodeBuilder::reloadVariables(llvm::Value *targetVariables)
14381438
}
14391439

14401440
LLVMInstruction &LLVMCodeBuilder::createOp(LLVMInstruction::Type type, Compiler::StaticType retType, Compiler::StaticType argType, size_t argCount)
1441+
{
1442+
std::vector<Compiler::StaticType> types;
1443+
types.reserve(argCount);
1444+
1445+
for (size_t i = 0; i < argCount; i++)
1446+
types.push_back(argType);
1447+
1448+
return createOp(type, retType, types, argCount);
1449+
}
1450+
1451+
LLVMInstruction &LLVMCodeBuilder::createOp(LLVMInstruction::Type type, Compiler::StaticType retType, const std::vector<Compiler::StaticType> &argTypes, size_t argCount)
14411452
{
14421453
LLVMInstruction ins(type);
14431454

14441455
assert(m_tmpRegs.size() >= argCount);
14451456
size_t j = 0;
14461457

1447-
for (size_t i = m_tmpRegs.size() - argCount; i < m_tmpRegs.size(); i++)
1448-
ins.args.push_back({ argType, m_tmpRegs[i] });
1458+
for (size_t i = m_tmpRegs.size() - argCount; i < m_tmpRegs.size(); i++) {
1459+
ins.args.push_back({ argTypes[j], m_tmpRegs[i] });
1460+
j++;
1461+
}
14491462

14501463
m_tmpRegs.erase(m_tmpRegs.end() - argCount, m_tmpRegs.end());
14511464

src/dev/engine/internal/llvm/llvmcodebuilder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class LLVMCodeBuilder : public ICodeBuilder
110110
void reloadVariables(llvm::Value *targetVariables);
111111

112112
LLVMInstruction &createOp(LLVMInstruction::Type type, Compiler::StaticType retType, Compiler::StaticType argType, size_t argCount);
113+
LLVMInstruction &createOp(LLVMInstruction::Type type, Compiler::StaticType retType, const std::vector<Compiler::StaticType> &argTypes, size_t argCount);
113114

114115
void createValueStore(LLVMRegisterPtr reg, llvm::Value *targetPtr, Compiler::StaticType sourceType, Compiler::StaticType targetType);
115116
void createInitialValueStore(LLVMRegisterPtr reg, llvm::Value *targetPtr, Compiler::StaticType sourceType);

0 commit comments

Comments
 (0)