yes, simple bit copyable structures.
I am new to llvm and clang so appologise for asking the obvious.
If I run using the -emit-llvm, I can clearly see the 'byval' attributes -
all correct and sensible.
By using -emit-llvm am I seeinf what the clang front end is creating to be
passed to the llvm target backend?
there's some terminology issues here (to Clang hackers, anything
beyond Clang (ie: all of LLVM) is sometimes "the backend" - but to
LLVM hackers, only the actual target-specific stuff (not the IR-to-IR
(so called "mid level") optimizations) is the 'backend'), but you're
more or less on the right track. -emit-llvm (at -O0) is basically just
what Clang generated.
OR is this an intermediate IR within clang stages?
Nope - Clang has an AST as an intermediate, Clang's "CodeGen" (better
referred to as "IRGen" - and will be renamed as such one day)
generates LLVM IR - at which point it's handed off to LLVM & Clang
doesn't have much to do with it anymore.
may be I am over simplifying where clang fits in (e.g. front and back).
Right - there's a 'middle', which is still part of LLVM (called from
Clang, but not part of the Clang codebase) - the IR-to-IR
From my fiddling it seems the '-emit-llvm' is then passed through the
CodeGen stage in clang, and particularly the
I'm left pondering what the relationship between the llvm codegen and the
clang codegen is?
Clang CodeGen (really IRGen) produces LLVM IR from Clang ASTs.
LLVM CodeGen (really CodeGen) produces machine code (or assembly, etc)
from LLVM IR.
Source -> AST -> IR -> better IR -> ASM/machine code
- not taken a close look yet - Tomorrow!
I hacked the EmitFunctionProlog() to see if I could get what I needed - and
I can (hack below).
but am I on the right track or way off?
I'm not especially familiar with this - my only suggestion, as before,
is that you should just need to cause Clang's CodeGen (really IRGen)
to produce the 'byval' attribute on the right parameters you want this
to happen on. You shouldn't need to manually emit new/different IR
instructions, I don't think.
That's just my rough guess.