Skip to content
Snippets Groups Projects
Commit b122aad4 authored by Russel Arbore's avatar Russel Arbore
Browse files

emit attributes on pointer params/rets

parent d3281948
No related branches found
No related tags found
1 merge request!82LLVM parameter / return attributes
Pipeline #200725 passed
...@@ -64,12 +64,21 @@ struct LLVMBlock { ...@@ -64,12 +64,21 @@ struct LLVMBlock {
impl<'a> CPUContext<'a> { impl<'a> CPUContext<'a> {
fn codegen_function<W: Write>(&self, w: &mut W) -> Result<(), Error> { fn codegen_function<W: Write>(&self, w: &mut W) -> Result<(), Error> {
// Dump the function signature. // Dump the function signature.
write!( if self.types[self.function.return_type.idx()].is_primitive() {
w, write!(
"define {} @{}(", w,
self.get_type(self.function.return_type), "define dso_local {} @{}(",
self.function.name self.get_type(self.function.return_type),
)?; self.function.name
)?;
} else {
write!(
w,
"define dso_local nonnull noundef {} @{}(",
self.get_type(self.function.return_type),
self.function.name
)?;
}
let mut first_param = true; let mut first_param = true;
// The first set of parameters are dynamic constants. // The first set of parameters are dynamic constants.
for idx in 0..self.function.num_dynamic_constants { for idx in 0..self.function.num_dynamic_constants {
...@@ -87,7 +96,16 @@ impl<'a> CPUContext<'a> { ...@@ -87,7 +96,16 @@ impl<'a> CPUContext<'a> {
} else { } else {
write!(w, ", ")?; write!(w, ", ")?;
} }
write!(w, "{} %p{}", self.get_type(*ty), idx)?; if self.types[ty.idx()].is_primitive() {
write!(w, "{} %p{}", self.get_type(*ty), idx)?;
} else {
write!(
w,
"{} noalias nofree nonnull noundef %p{}",
self.get_type(*ty),
idx
)?;
}
} }
write!(w, ") {{\n")?; write!(w, ") {{\n")?;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment