<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Craig, <div><br></div><div>I updated from the trunk some minutes ago, and thus got the "explicit". PrintReg constructor. When I do not include raw_ostream.h after including Debug.h in the backend cpp files, I now get compilation errors, not only when trying to print floats but also in other places. For example, for the code </div><div><br></div><div><div> bool ADRESRegisterInfo::hasReservedCallFrame(const MachineFunction &MF) const {</div><div>  dbgs() << "hasReservedCallFrame() = " << !MF.getFrameInfo()->hasVarSizedObjects() << "\n";</div><div>  return !MF.getFrameInfo()->hasVarSizedObjects();</div><div>}</div></div><div><br></div><div>I get </div><div><br></div><div><div>llvm[0]: Compiling ADRESRegisterInfo.cpp for Debug+Asserts build</div><div>/work/llvm/trunk/llvm/lib/Target/ADRES/ADRESRegisterInfo.cpp: In member function 'bool llvm::ADRESRegisterInfo::hasReservedCallFrame(const llvm::MachineFunction&) const':</div><div>/work/llvm/trunk/llvm/lib/Target/ADRES/ADRESRegisterInfo.cpp:38:83: error: no match for 'operator<<' in 'llvm::operator<<((* & llvm::dbgs()), (* & llvm::Twine(((const char*)"hasReservedCallFrame() = ")))) << !(& MF)->llvm::MachineFunction::getFrameInfo()->llvm::MachineFrameInfo::hasVarSizedObjects()'</div><div>/work/llvm/trunk/llvm/lib/Target/ADRES/ADRESRegisterInfo.cpp:38:83: note: candidates are:</div><div>/work/llvm/trunk/llvm/include/llvm/Type.h:412:28: note: llvm::raw_ostream& llvm::operator<<(llvm::raw_ostream&, llvm::Type&)</div><div>/work/llvm/trunk/llvm/include/llvm/Type.h:412:28: note:   no known conversion for argument 2 from 'bool' to 'llvm::Type&'</div><div>/work/llvm/trunk/llvm/include/llvm/ADT/Twine.h:516:23: note: llvm::raw_ostream& llvm::operator<<(llvm::raw_ostream&, const llvm::Twine&)</div><div>/work/llvm/trunk/llvm/include/llvm/ADT/Twine.h:516:23: note:   no known conversion for argument 2 from 'bool' to 'const llvm::Twine&'</div><div>/work/llvm/trunk/llvm/include/llvm/CodeGen/MachineOperand.h:685:21: note: llvm::raw_ostream& llvm::operator<<(llvm::raw_ostream&, const llvm::MachineOperand&)</div><div>/work/llvm/trunk/llvm/include/llvm/CodeGen/MachineOperand.h:685:21: note:   no known conversion for argument 2 from 'bool' to 'const llvm::MachineOperand&'</div><div>/work/llvm/trunk/llvm/include/llvm/Value.h:320:21: note: llvm::raw_ostream& llvm::operator<<(llvm::raw_ostream&, const llvm::Value&)</div><div>/work/llvm/trunk/llvm/include/llvm/Value.h:320:21: note:   no known conversion for argument 2 from 'bool' to 'const llvm::Value&'</div><div>/work/llvm/trunk/llvm/include/llvm/CodeGen/MachineInstr.h:1017:21: note: llvm::raw_ostream& llvm::operator<<(llvm::raw_ostream&, const llvm::MachineInstr&)</div><div>/work/llvm/trunk/llvm/include/llvm/CodeGen/MachineInstr.h:1017:21: note:   no known conversion for argument 2 from 'bool' to 'const llvm::MachineInstr&'</div><div>/work/llvm/trunk/llvm/include/llvm/CodeGen/MachineBasicBlock.h:621:14: note: llvm::raw_ostream& llvm::operator<<(llvm::raw_ostream&, const llvm::MachineBasicBlock&)</div><div>/work/llvm/trunk/llvm/include/llvm/CodeGen/MachineBasicBlock.h:621:14: note:   no known conversion for argument 2 from 'bool' to 'const llvm::MachineBasicBlock&'</div><div>/work/llvm/trunk/llvm/include/llvm/Target/TargetRegisterInfo.h:885:28: note: llvm::raw_ostream& llvm::operator<<(llvm::raw_ostream&, const llvm::PrintReg&)</div><div>/work/llvm/trunk/llvm/include/llvm/Target/TargetRegisterInfo.h:885:28: note:   no known conversion for argument 2 from 'bool' to 'const llvm::PrintReg&'</div><div>/work/llvm/trunk/llvm/include/llvm/Target/TargetRegisterInfo.h:908:28: note: llvm::raw_ostream& llvm::operator<<(llvm::raw_ostream&, const llvm::PrintRegUnit&)</div><div>/work/llvm/trunk/llvm/include/llvm/Target/TargetRegisterInfo.h:908:28: note:   no known conversion for argument 2 from 'bool' to 'const llvm::PrintRegUnit&'</div><div><br></div><div><br></div><div>Including the raw_ostream.h fixes this, but that is not a thing I should have to do, right?</div></div><div><br></div><div>Best,</div><div><br></div><div>Bjorn</div><div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div></div></span></div></span></div></span></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br><div><div>On 27 Nov 2012, at 09:05, Craig Topper <<a href="mailto:craig.topper@gmail.com">craig.topper@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Can you try making the constructor "explicit" for PrintReg in include/llvm/Target/TargetRegisterInfo.h. I think you were getting an implicit conversion there which should probably be fixed anyway.<br><br><div class="gmail_quote">
On Mon, Nov 26, 2012 at 11:47 PM, Bjorn De Sutter <span dir="ltr"><<a href="mailto:bjorn.desutter@elis.ugent.be" target="_blank">bjorn.desutter@elis.ugent.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
that solved my problem on trunk as well, thanks. Strange that you have to include this though.<br>
<br>
Bjorn<br>
<br>
On 27 Nov 2012, at 00:00, Daniel Prokesch <<a href="mailto:daniel.prokesch@gmail.com">daniel.prokesch@gmail.com</a>> wrote:<br>
<br>
> Hi,<br>
><br>
> I accidentally stumbled upon your post.<br>
> I observed similar behaviour whenever I did not include<br>
><br>
> #include "llvm/Support/Debug.h"<br>
> #include "llvm/Support/raw_ostream.h"<br>
><br>
> I'm working on release 3.1 though.<br>
><br>
> hth, Daniel<br>
<div class="HOEnZb"><div class="h5">><br>
> On 11/26/2012 03:00 PM, Bjorn De Sutter wrote:<br>
>> Hi,<br>
>><br>
>> I am trying to debug my backend, and observe very strange behavior with dbgs():<br>
>><br>
>> In the IfConverter, I have added two debugging lines that print floating-point numbers for the sake of demonstration that such printing works fine.<br>
>><br>
>> bool MeetIfcvtSizeLimit(MachineBasicBlock &BB,<br>
>>                             unsigned Cycle, unsigned Extra,<br>
>>                             const BranchProbability &Prediction) const {<br>
>><br>
>>                 dbgs() << "OOPS " << 1.14 << "\n";<br>
>>                 bool flag =  Cycle > 0 && TII->isProfitableToIfCvt(BB, Cycle, Extra,<br>
>>                                                    Prediction);<br>
>>                 dbgs() << "OOPS " << 1.15 << "\n";<br>
>>       return flag;<br>
>>     }<br>
>><br>
>> This method invokes the backend method<br>
>><br>
>> bool ADRESInstrInfo::isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, unsigned ExtraPredCycles,<br>
>>                                          const BranchProbability &Probability) const {<br>
>>      dbgs() << "OOPS " << 1.16 << "\n";<br>
>> }<br>
>><br>
>> This invocation works as it should (verified with gdb). But when I execute this code fragment, I get<br>
>><br>
>> OOPS 1.140000e+00<br>
>> OOPS %physreg1<br>
>> OOPS 1.150000e+00<br>
>><br>
>> So suddenly in the machine backend, the dbgs() ostream (which is still the very same ostream as in the IfConverter, I checked the address with gdb) prints floating point numbers as if they are physical registers. Any idea what is going on or how I can force floating-point numbers to be printed in the backend code? I want to do that to tune my if-predication heuristics ...<br>

>><br>
>> By the way, when I step through the isProfitableToIfCvt method, rather than invoking a <<-operator in an ostream class, the constructor of the Twine class is invoked ...<br>
>><br>
>> Thanks,<br>
>><br>
>> Bjorn De Sutter<br>
>> Computer Systems Lab<br>
>> Ghent University<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu/" target="_blank">http://llvm.cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu/" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>~Craig<br>
</blockquote></div><br></div></body></html>