mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
Add ifunc support to ModuleSymbolTable.
Do that by creating a global_values, which is similar to global_objects, but also iterates over aliases and ifuncs. llvm-svn: 299018
This commit is contained in:
parent
1604421b6d
commit
b8e5619a1d
@ -617,6 +617,32 @@ public:
|
||||
return global_objects().end();
|
||||
}
|
||||
|
||||
typedef concat_iterator<GlobalValue, iterator, global_iterator,
|
||||
alias_iterator, ifunc_iterator>
|
||||
global_value_iterator;
|
||||
typedef concat_iterator<const GlobalValue, const_iterator,
|
||||
const_global_iterator, const_alias_iterator,
|
||||
const_ifunc_iterator>
|
||||
const_global_value_iterator;
|
||||
|
||||
iterator_range<global_value_iterator> global_values() {
|
||||
return concat<GlobalValue>(functions(), globals(), aliases(), ifuncs());
|
||||
}
|
||||
iterator_range<const_global_value_iterator> global_values() const {
|
||||
return concat<const GlobalValue>(functions(), globals(), aliases(),
|
||||
ifuncs());
|
||||
}
|
||||
|
||||
global_value_iterator global_value_begin() { return global_values().begin(); }
|
||||
global_value_iterator global_value_end() { return global_values().end(); }
|
||||
|
||||
const_global_value_iterator global_value_begin() const {
|
||||
return global_values().begin();
|
||||
}
|
||||
const_global_value_iterator global_value_end() const {
|
||||
return global_values().end();
|
||||
}
|
||||
|
||||
/// @}
|
||||
/// @name Named Metadata Iteration
|
||||
/// @{
|
||||
|
@ -43,12 +43,8 @@ void ModuleSymbolTable::addModule(Module *M) {
|
||||
else
|
||||
FirstMod = M;
|
||||
|
||||
for (Function &F : *M)
|
||||
SymTab.push_back(&F);
|
||||
for (GlobalVariable &GV : M->globals())
|
||||
for (GlobalValue &GV : M->global_values())
|
||||
SymTab.push_back(&GV);
|
||||
for (GlobalAlias &GA : M->aliases())
|
||||
SymTab.push_back(&GA);
|
||||
|
||||
CollectAsmSymbols(*M, [this](StringRef Name, BasicSymbolRef::Flags Flags) {
|
||||
SymTab.push_back(new (AsmSymbols.Allocate()) AsmSymbol(Name, Flags));
|
||||
|
@ -12,6 +12,7 @@
|
||||
; CHECK-NEXT: C g3
|
||||
; CHECK-NOT: g4
|
||||
; CHECK-NEXT: T global_asm_sym
|
||||
; CHECK-NEXT: D ifunc_f1
|
||||
; CHECK-NEXT: t local_asm_sym
|
||||
; CHECK-NEXT: U undef_asm_sy
|
||||
|
||||
@ -36,6 +37,8 @@ define void @f1() {
|
||||
ret void
|
||||
}
|
||||
|
||||
@ifunc_f1 = ifunc void (), void ()* @f1
|
||||
|
||||
define internal void @f2() {
|
||||
ret void
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user