<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:D="DAV:" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-GB link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>Hi,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I’m doing some cleaning up of the target-specific
hacks in the Driver, as prep for some cross-compilation changes discussed
previously on the list.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>My previous set of patches tablegen’d up a lot of the horrible
string matching, but I’ve realised that actually it’s almost all
superfluous and can be deleted completely.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>That said, there are some defaults and corner cases that I’d
like the list’s (and especially Douglas, Chandler and Eric’s)
opinions on before I go any further. This all relates to the ARM specific stuff
– I can’t really touch the Intel, MIPS or PowerPC stuff so it’d
be better if someone else cleans that up if they feel like it. A lot of these
changes revolve around not trying to be too clever in the frontend driver and
leaving defaults to more specialised parts of the back ends.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Does anyone have any opinions or answers to the following?
Thanks!<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>1:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span style='font-family:Consolas'> // Select the ABI
to use.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> //<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> // FIXME: Support
-meabi.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> const char
*ABIName = 0;<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> if (Arg *A =
Args.getLastArg(options::OPT_mabi_EQ)) {<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
ABIName = A->getValue(Args);<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> } else {<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> //
Select the default based on the platform.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
switch(Triple.getEnvironment()) {<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> case
llvm::Triple::GNUEABI:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
ABIName = "aapcs-linux";<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
break;<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> case
llvm::Triple::EABI:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
ABIName = "aapcs";<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
break;<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
default:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
ABIName = "apcs-gnu";<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> }<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> }<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
CmdArgs.push_back("-target-abi");<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
CmdArgs.push_back(ABIName);<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I don’t really think the target ABI needs to be set if
it is part of the triple (the else clause) – that should be inferred by
all other tools by the triple.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>2: The driver currently tries to pick a default CPU for the architecture
if none is specified. I think this is wrong – if no CPU is specified then
the compiler should *<b>not</b>* tune for a specific CPU. The user would expect
if specifying –arch armv7, for the compiler to give an output that has
good blended performance on all armv7 cores, not cortex-a8 specifically for
example.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>3: Selecting the floating point ABI is a rather large set of
switch-cases which I think can be contracted into a simple:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span style='font-family:Consolas'> // If unspecified,
choose the default based on the platform.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> if
(FloatABI.empty()) {<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> const
llvm::Triple &Triple = getToolChain().getTriple();<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> if
(Triple.getOS() == llvm::Triple::Darwin &&<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
(ArchName.startswith("v6") || ArchName.startswith("v7"))<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
FloatABI = "soft";<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> else<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
FloatABI = "softfp";<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> }<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I also don’t see why the current default is “soft”
if no ABI is specified. Why not “softfp”? If the target has
hardware FP support that’ll be used, if not then it is implied that the
ABI is “soft”. I also don’t know how critical that Darwin
special-case is. If it could be gotten rid of, that’d be lovely.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>4: These are hacks:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span style='font-family:Consolas'> // Use software
floating point operations?<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> if (FloatABI ==
"soft") {<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
CmdArgs.push_back("-target-feature");<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
CmdArgs.push_back("+soft-float");<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> }<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> // Use software
floating point argument passing?<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> if (FloatABI !=
"hard") {<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
CmdArgs.push_back("-target-feature");<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
CmdArgs.push_back("+soft-float-abi");<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> }<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>They’re referenced from lib/Basic/Targets.cpp –
would it not be better for Targets.cpp to infer these from the other passed
parameters? That’s actually a self-answering question, so my question
really is: “Is there any reason why I can’t make the trivial change
to make this so?”<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>5:<o:p></o:p></p>
<p class=MsoNormal><span style='font-family:Consolas'> // Set
the target features based on the FPU.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> if
(FPU == "fpa" || FPU == "fpe2" || FPU == "fpe3"
|| FPU == "maverick") {<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Where did these names come from? Do people actually use
them? I see google results for GCC command lines specific to a Cirrus core –
is that the reason they’re there? Can we get rid of them as nasty GCC
relics?<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>6:<o:p></o:p></p>
<p class=MsoNormal><span style='font-family:Consolas'> // Setting
-msoft-float effectively disables NEON because of the GCC<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> // implementation,
although the same isn't true of VFP or VFP3.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> if (FloatABI ==
"soft") {<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
CmdArgs.push_back("-target-feature");<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
CmdArgs.push_back("-neon");<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> }<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>It’s not evident why this code is here. Why does –msoft-float
disable NEON? NEON has an integer vectoriser too. GCC relic?<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>7:<o:p></o:p></p>
<p class=MsoNormal><span style='font-family:Consolas'> // Setting
-mno-global-merge disables the codegen global merge pass. Setting <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> // -mglobal-merge
has no effect as the pass is enabled by default.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> if (Arg *A =
Args.getLastArg(options::OPT_mglobal_merge,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
options::OPT_mno_global_merge)) {<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> if
(A->getOption().matches(options::OPT_mno_global_merge))<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'>
CmdArgs.push_back("-mno-global-merge");<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:Consolas'> }<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>It seems like this should be better handled by the sys::cl
code in llc.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Cheers,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>James<o:p></o:p></p>
</div>
</body>
</html>