Declare a global value, returns the existing value if it was already declared.
(
&self,
name: &str,
ty: &'ll Type,
address_space: AddressSpace,
)
| 283 | |
| 284 | /// Declare a global value, returns the existing value if it was already declared. |
| 285 | pub fn declare_global( |
| 286 | &self, |
| 287 | name: &str, |
| 288 | ty: &'ll Type, |
| 289 | address_space: AddressSpace, |
| 290 | ) -> &'ll Value { |
| 291 | // NVVM doesnt allow `.` inside of globals, this should be sound, at worst it should result in an nvvm error if something goes wrong. |
| 292 | let name = sanitize_global_ident(name); |
| 293 | trace!("Declaring global `{}`", name); |
| 294 | unsafe { |
| 295 | llvm::LLVMRustGetOrInsertGlobal( |
| 296 | self.llmod, |
| 297 | name.as_ptr().cast(), |
| 298 | name.len(), |
| 299 | ty, |
| 300 | address_space.0, |
| 301 | ) |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | /// Declare a function. All functions use the default ABI, NVVM ignores any calling convention markers. |
| 306 | /// All functions calls are generated according to the PTX calling convention. |
no test coverage detected