<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi David,<br>
<br>
yes, simple bit copyable structures.<br>
I am new to llvm and clang so appologise for asking the obvious.<br>
<br>
If I run using the -emit-llvm, I can clearly see the 'byval' attributes - all correct and sensible.<br>
<br>
By using -emit-llvm am I seeinf what the clang front end is creating to be passed to the llvm target backend?<br>
OR is this an intermediate IR within clang stages?<br>
may be I am over simplifying where clang fits in (e.g. front and back).<br>
<br>
>From my fiddling it seems the '-emit-llvm' is then passed through the CodeGen stage in clang, and particularly the CodeGenFunction::EmitFunctionProlog() function.<br>
I'm left pondering what the relationship between the llvm codegen and the clang codegen is? - not taken a close look yet - Tomorrow!<br>
<br>
<br>
I hacked the EmitFunctionProlog() to see if I could get what I needed - and I can (hack below).<br>
but am I on the right track or way off?<br>
I took a look in the target backend briefly and will look again.<br>
(Also tried -debug to dump the stages)<br>
<br>
robert<br>
<br>
--- clang/lib/CodeGen/CGCall.cpp<br>
+++ clang/lib/CodeGen/CGCall.cpp<br>
@@ -1290,6 +1290,14 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,<br>
false);<br>
V = AlignedTemp;<br>
}<br>
+ else if (ArgI.getIndirectByVal()) {<br>
+ llvm::AllocaInst *ByValue<br>
+ = CreateMemTemp(Ty, V->getName() + "agg.tmp");<br>
+ llvm::ConstantInt * size = llvm::ConstantInt::get(IntPtrTy,<br>
+ getContext().getTypeSizeInChars(Ty).getQuantity());<br>
+ Builder.CreateMemCpy(ByValue, V, size, 4 ); // where do we get alignment from?<br>
+ V = ByValue;<br>
+ }<br>
} else {<br>
// Load scalar value from indirect argument.<br>
CharUnits Alignment = getContext().getTypeAlignInChars(Ty);<br>
<br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF919668"><font color="#000000" face="Tahoma" size="2"><b>From:</b> David Blaikie [dblaikie@gmail.com]<br>
<b>Sent:</b> 03 July 2013 15:51<br>
<b>To:</b> Robert Lytton<br>
<b>Cc:</b> cfe-dev Developers<br>
<b>Subject:</b> Re: [cfe-dev] pass-by-value aggregates - using the callee's frame<br>
</font><br>
</div>
<div></div>
<div>
<p dir="ltr">I believe (assuming you're talking about bit-copiable aggregates (not C++ types with non-trivial copy)) this is handled in Clang's irgen by using the 'byval' llvm ir attribute. I don't recall the specifics, but if shouldn't be too hard to find
some handling of that in there.</p>
<div class="gmail_quote">On Jul 3, 2013 12:44 AM, "Robert Lytton" <<a href="mailto:robert@xmos.com" target="_blank">robert@xmos.com</a>> wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-size:10pt; font-family:Tahoma">
<div style="direction:ltr; font-size:10pt; font-family:Tahoma">Hi,<br>
<br>
I'm adding an XCore target front end.<br>
The XCore ABI is the same as the DefaultABIInfo ... almost.<br>
<br>
One outstanding issue is the need to copy pass-by-value aggregates into the callee's stack-frame during the prolog.<br>
Any advise, suggestions or direction as to where to look (CodeGenFunction::EmitFunctionProlog()? ) most welcome.<br>
<br>
robert<br>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>