-
Notifications
You must be signed in to change notification settings - Fork 229
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
Conversation
src/values/instruction_value.rs
Outdated
@@ -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> { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Adding the 3 Functions and the corresponding tests.
Description
Related Issue
#454
How This Has Been Tested
Only tested on LLVM-16
Checklist