Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding get_allocated_type, is_terminator and is_conditional to InstructionValue #455

Merged
merged 7 commits into from
Dec 26, 2023

Conversation

tfzee
Copy link
Contributor

@tfzee tfzee commented Dec 23, 2023

Adding the 3 Functions and the corresponding tests.

Description

Related Issue

#454

How This Has Been Tested

Only tested on LLVM-16

Checklist

@@ -282,6 +298,15 @@ impl<'ctx> InstructionValue<'ctx> {
Ok(())
}

// SubTypes: Only apply to alloca instruction
/// Returns the type that is allocated by the alloca instruction.
pub fn get_allocated_type(self) -> Result<AnyTypeEnum<'ctx>, &'static str> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this only be a BasicTypeEnum? I would imagine AnyType has types that cannot be allocated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah that's correct! I incorrectly assumed it would be the same return type as get_type.

Copy link
Owner

@TheDan64 TheDan64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@TheDan64 TheDan64 merged commit 0b2cde9 into TheDan64:master Dec 26, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding get_allocated_type, is_terminator and is_conditional to InstructionValue
2 participants