diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-12-18 20:30:12 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-04-06 20:11:55 +0000 |
commit | 5f757f3ff9144b609b3c433dfd370cc6bdc191ad (patch) | |
tree | 1b4e980b866cd26a00af34c0a653eb640bd09caf /contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp | |
parent | 3e1c8a35f741a5d114d0ba670b15191355711fe9 (diff) | |
parent | 312c0ed19cc5276a17bacf2120097bec4515b0f1 (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 768d84501337..2559ed6a31a6 100644 --- a/contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -340,7 +340,7 @@ void *ArgvArray::reset(LLVMContext &C, ExecutionEngine *EE, Array = std::make_unique<char[]>((InputArgv.size()+1)*PtrSize); LLVM_DEBUG(dbgs() << "JIT: ARGV = " << (void *)Array.get() << "\n"); - Type *SBytePtr = Type::getInt8PtrTy(C); + Type *SBytePtr = PointerType::getUnqual(C); for (unsigned i = 0; i != InputArgv.size(); ++i) { unsigned Size = InputArgv[i].size()+1; @@ -430,7 +430,7 @@ int ExecutionEngine::runFunctionAsMain(Function *Fn, // Check main() type unsigned NumArgs = Fn->getFunctionType()->getNumParams(); FunctionType *FTy = Fn->getFunctionType(); - Type* PPInt8Ty = Type::getInt8PtrTy(Fn->getContext())->getPointerTo(); + Type *PPInt8Ty = PointerType::get(Fn->getContext(), 0); // Check the argument types. if (NumArgs > 3) @@ -471,7 +471,7 @@ EngineBuilder::EngineBuilder() : EngineBuilder(nullptr) {} EngineBuilder::EngineBuilder(std::unique_ptr<Module> M) : M(std::move(M)), WhichEngine(EngineKind::Either), ErrorStr(nullptr), - OptLevel(CodeGenOpt::Default), MemMgr(nullptr), Resolver(nullptr) { + OptLevel(CodeGenOptLevel::Default), MemMgr(nullptr), Resolver(nullptr) { // IR module verification is enabled by default in debug builds, and disabled // by default in release builds. #ifndef NDEBUG @@ -618,7 +618,18 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { case Type::ScalableVectorTyID: report_fatal_error( "Scalable vector support not yet implemented in ExecutionEngine"); - case Type::FixedVectorTyID: + case Type::ArrayTyID: { + auto *ArrTy = cast<ArrayType>(C->getType()); + Type *ElemTy = ArrTy->getElementType(); + unsigned int elemNum = ArrTy->getNumElements(); + Result.AggregateVal.resize(elemNum); + if (ElemTy->isIntegerTy()) + for (unsigned int i = 0; i < elemNum; ++i) + Result.AggregateVal[i].IntVal = + APInt(ElemTy->getPrimitiveSizeInBits(), 0); + break; + } + case Type::FixedVectorTyID: { // if the whole vector is 'undef' just reserve memory for the value. auto *VTy = cast<FixedVectorType>(C->getType()); Type *ElemTy = VTy->getElementType(); @@ -629,6 +640,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { Result.AggregateVal[i].IntVal = APInt(ElemTy->getPrimitiveSizeInBits(), 0); break; + } } return Result; } |