(
&self,
template: &[InlineAsmTemplatePiece],
operands: &[GlobalAsmOperandRef],
_options: InlineAsmOptions,
_line_spans: &[Span],
)
| 305 | |
| 306 | impl<'ll, 'tcx> AsmMethods for CodegenCx<'ll, 'tcx> { |
| 307 | fn codegen_global_asm( |
| 308 | &self, |
| 309 | template: &[InlineAsmTemplatePiece], |
| 310 | operands: &[GlobalAsmOperandRef], |
| 311 | _options: InlineAsmOptions, |
| 312 | _line_spans: &[Span], |
| 313 | ) { |
| 314 | // Build the template string |
| 315 | let mut template_str = String::new(); |
| 316 | for piece in template { |
| 317 | match *piece { |
| 318 | InlineAsmTemplatePiece::String(ref s) => template_str.push_str(s), |
| 319 | InlineAsmTemplatePiece::Placeholder { |
| 320 | operand_idx, |
| 321 | modifier: _, |
| 322 | span: _, |
| 323 | } => { |
| 324 | match operands[operand_idx] { |
| 325 | GlobalAsmOperandRef::Const { ref string } => { |
| 326 | // Const operands get injected directly into the |
| 327 | // template. Note that we don't need to escape $ |
| 328 | // here unlike normal inline assembly. |
| 329 | template_str.push_str(string); |
| 330 | } |
| 331 | } |
| 332 | } |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | unsafe { |
| 337 | llvm::LLVMRustAppendModuleInlineAsm( |
| 338 | self.llmod, |
| 339 | template_str.as_ptr().cast(), |
| 340 | template_str.len(), |
| 341 | ); |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | fn reg_to_llvm(reg: InlineAsmRegOrRegClass) -> String { |
nothing calls this directly
no test coverage detected