-
Notifications
You must be signed in to change notification settings - Fork 252
Add debug information utility functions and support Metadata on Operands #607
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
base: master
Are you sure you want to change the base?
Conversation
…truction operand handling to support debug metadata, with some fixes to error messaging around value types too.
| /// An operand within a given instruction can be a value, basic block, or metadata. | ||
| /// This is a wrapper type to handle those variations returned by `InstructionValue::get_operand` family. | ||
| #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] | ||
| pub enum OperandValue<'ctx> { |
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.
Good idea making a new enum rather than using Either. I think we should swap out usages of Either elsewhere in the codebase as well.
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.
@TheDan64 0.7.0 milestone, maybe?
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.
Probably 0.8.0, trying to get 0.7.0 soon since it's been requested a number of times
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.
Ahh, darn, I was hoping to finish the Orc Engine before the 0.7.0 release.
…AsValueRef to then genericize set_operand as anything Into<OperandValue> with extra From operators
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!
|
There are some tests that are failing and need to be fixed |
|
@jaynus are you able to fix the tests? |
Description
Adds a few utility functions around debug information and changes instruction operand handling to support debug metadata, with some fixes to error messaging around value types too.
Changes
InstructionValue::get_operandfamily of functions (includingget_operands) to return a newOperandValue. They currently hadEither<BasicValue, BasicBlock>which is insufficient for operands - they can be metadata values as well.Module::is_new_debug_format- this corresponds toLLVMIsNewDbgInfoFormatModule::set_new_debug_format- this corresponds toLLVMSetIsNewDbgInfoFormatas_metadata_valueto the suite ofDI*types, as all these types are metadata values that can be fetched via instruction operands (old) orDbgRecord(new)get_operandcall.How This Has Been Tested
This was tested with llvm 20.1 locally in a personal project. Ex usage such as:
Breaking Changes
Changes
InstructionValue::get_operandandOperandIterto useOperandValueinstead ofEither<BasicValue, BasicBlock>. This was required because operands on a value instruction can be more than just BasicValue or BasicBlock, they can also beMetadataValuein the case of debug intrinsics.left()calls must now beinto_basic_value()ortry_into()orinto()right()calls must now beinto_basic_block()ortry_into()orinto()Checklist