<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Mar 29, 2017 at 12:26 PM, Rafael Espindola via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Wed Mar 29 14:26:26 2017<br>
New Revision: 299018<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=299018&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=299018&view=rev</a><br>
Log:<br>
Add ifunc support to ModuleSymbolTable.<br></blockquote><div><br></div><div>Thanks!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Do that by creating a global_values, which is similar to<br>
global_objects, but also iterates over aliases and ifuncs.<br>
<br>
Modified:<br>
llvm/trunk/include/llvm/IR/Mod<wbr>ule.h<br>
llvm/trunk/lib/Object/ModuleSy<wbr>mbolTable.cpp<br>
llvm/trunk/test/Object/X86/nm-<wbr>ir.ll<br>
<br>
Modified: llvm/trunk/include/llvm/IR/Mod<wbr>ule.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Module.h?rev=299018&r1=299017&r2=299018&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/include/llvm/<wbr>IR/Module.h?rev=299018&r1=<wbr>299017&r2=299018&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/include/llvm/IR/Mod<wbr>ule.h (original)<br>
+++ llvm/trunk/include/llvm/IR/Mod<wbr>ule.h Wed Mar 29 14:26:26 2017<br>
@@ -617,6 +617,32 @@ public:<br>
return global_objects().end();<br>
}<br>
<br>
+ typedef concat_iterator<GlobalValue, iterator, global_iterator,<br>
+ alias_iterator, ifunc_iterator><br>
+ global_value_iterator;<br>
+ typedef concat_iterator<const GlobalValue, const_iterator,<br>
+ const_global_iterator, const_alias_iterator,<br>
+ const_ifunc_iterator><br>
+ const_global_value_iterator;<br>
+<br>
+ iterator_range<global_value_it<wbr>erator> global_values() {<br>
+ return concat<GlobalValue>(functions(<wbr>), globals(), aliases(), ifuncs());<br>
+ }<br>
+ iterator_range<const_global_va<wbr>lue_iterator> global_values() const {<br>
+ return concat<const GlobalValue>(functions(), globals(), aliases(),<br>
+ ifuncs());<br>
+ }<br>
+<br>
+ global_value_iterator global_value_begin() { return global_values().begin(); }<br>
+ global_value_iterator global_value_end() { return global_values().end(); }<br>
+<br>
+ const_global_value_iterator global_value_begin() const {<br>
+ return global_values().begin();<br>
+ }<br>
+ const_global_value_iterator global_value_end() const {<br>
+ return global_values().end();<br>
+ }<br>
+<br>
/// @}<br>
/// @name Named Metadata Iteration<br>
/// @{<br>
<br>
Modified: llvm/trunk/lib/Object/ModuleSy<wbr>mbolTable.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ModuleSymbolTable.cpp?rev=299018&r1=299017&r2=299018&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/lib/Object/Mo<wbr>duleSymbolTable.cpp?rev=299018<wbr>&r1=299017&r2=299018&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Object/ModuleSy<wbr>mbolTable.cpp (original)<br>
+++ llvm/trunk/lib/Object/ModuleSy<wbr>mbolTable.cpp Wed Mar 29 14:26:26 2017<br>
@@ -43,12 +43,8 @@ void ModuleSymbolTable::addModule(M<wbr>odule<br>
else<br>
FirstMod = M;<br>
<br>
- for (Function &F : *M)<br>
- SymTab.push_back(&F);<br>
- for (GlobalVariable &GV : M->globals())<br>
+ for (GlobalValue &GV : M->global_values())<br>
SymTab.push_back(&GV);<br>
- for (GlobalAlias &GA : M->aliases())<br>
- SymTab.push_back(&GA);<br>
<br>
CollectAsmSymbols(*M, [this](StringRef Name, BasicSymbolRef::Flags Flags) {<br>
SymTab.push_back(new (AsmSymbols.Allocate()) AsmSymbol(Name, Flags));<br>
<br>
Modified: llvm/trunk/test/Object/X86/nm-<wbr>ir.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/X86/nm-ir.ll?rev=299018&r1=299017&r2=299018&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/test/Object/<wbr>X86/nm-ir.ll?rev=299018&r1=<wbr>299017&r2=299018&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/test/Object/X86/nm-<wbr>ir.ll (original)<br>
+++ llvm/trunk/test/Object/X86/nm-<wbr>ir.ll Wed Mar 29 14:26:26 2017<br>
@@ -12,6 +12,7 @@<br>
; CHECK-NEXT: C g3<br>
; CHECK-NOT: g4<br>
; CHECK-NEXT: T global_asm_sym<br>
+; CHECK-NEXT: D ifunc_f1<br></blockquote><div><br></div><div>Should the expected output be "i ifunc_f1"?</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
; CHECK-NEXT: t local_asm_sym<br>
; CHECK-NEXT: U undef_asm_sy<br>
<br>
@@ -36,6 +37,8 @@ define void @f1() {<br>
ret void<br>
}<br>
<br>
+@ifunc_f1 = ifunc void (), void ()* @f1<br>
+<br>
define internal void @f2() {<br>
ret void<br>
}<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_6379189996938690637gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div></div>