# amd64 and va\_arg

DevFeed: [amd64 and va\_arg](<https://devfeed.tech/articles/amd64-and-va-arg-21920.md>)

Original publisher: [Read original article](<https://blog.nelhage.com/2010/10/amd64-and-va_arg/>)

Author: Nelson Elhage

Published: 2010-10-04T00:14:28Z

Content type: tutorial

Language: en

Sources: [Nelson Elhage](<https://devfeed.tech/sources/nelson-elhage.md>)

Topics: [LLVM](<https://devfeed.tech/topics/llvm.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [C](<https://devfeed.tech/topics/c.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [clang](<https://devfeed.tech/tags/clang.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [compilers](<https://devfeed.tech/tags/compilers.md>), [gcc](<https://devfeed.tech/tags/gcc.md>), [llvm](<https://devfeed.tech/tags/llvm.md>)

## AI overview

This article explains why implementing va_arg for amd64 is difficult. Unlike i386, amd64 passes integer and floating-point arguments in registers, while some arguments may also be on the stack, requiring variadic argument handling to account for both locations and register-passed small structs.

## Source excerpt

A while back, I was poking around LLVM bugs, and discovered, to my surprise, that LLVM doesn't support the va_arg intrinsic, used by functions to accept multiple arguments, at all on amd64. It turns out that clang and llvm-gcc, the compilers that backend to LLVM, have their own implementations in the frontend, so this isn't as big a deal as it might sound, but it was still a surprise to me.