-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77fe8b7
commit f9117f6
Showing
6 changed files
with
47 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <luisa/xir/instructions/alloca.h> | ||
#include <luisa/xir/instructions/gep.h> | ||
#include "helpers.h" | ||
|
||
namespace luisa::compute::xir { | ||
|
||
AllocaInst *trace_pointer_base_local_alloca_inst(Value *pointer) noexcept { | ||
if (pointer == nullptr || pointer->derived_value_tag() != DerivedValueTag::INSTRUCTION) { | ||
return nullptr; | ||
} | ||
switch (auto inst = static_cast<Instruction *>(pointer); inst->derived_instruction_tag()) { | ||
case DerivedInstructionTag::ALLOCA: { | ||
if (auto alloca_inst = static_cast<AllocaInst *>(inst); alloca_inst->space() == AllocSpace::LOCAL) { | ||
return alloca_inst; | ||
} | ||
return nullptr; | ||
} | ||
case DerivedInstructionTag::GEP: { | ||
auto gep_inst = static_cast<GEPInst *>(inst); | ||
return trace_pointer_base_local_alloca_inst(gep_inst->base()); | ||
} | ||
default: break; | ||
} | ||
return nullptr; | ||
} | ||
|
||
}// namespace luisa::compute::xir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include <luisa/core/dll_export.h> | ||
|
||
namespace luisa::compute::xir { | ||
|
||
class AllocaInst; | ||
class Value; | ||
|
||
[[nodiscard]] LC_XIR_API AllocaInst *trace_pointer_base_local_alloca_inst(Value *pointer) noexcept; | ||
|
||
}// namespace luisa::compute::xir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters