mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 02:25:01 +00:00
Add a module flags accessor method which returns the flags in a vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150623 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -328,6 +328,21 @@ void Module::eraseNamedMetadata(NamedMDNode *NMD) {
|
||||
NamedMDList.erase(NMD);
|
||||
}
|
||||
|
||||
/// getModuleFlagsMetadata - Returns the module flags in the provided vector.
|
||||
void Module::
|
||||
getModuleFlagsMetadata(SmallVectorImpl<ModuleFlagEntry> &Flags) const {
|
||||
const NamedMDNode *ModFlags = getModuleFlagsMetadata();
|
||||
if (!ModFlags) return;
|
||||
|
||||
for (unsigned i = 0, e = ModFlags->getNumOperands(); i != e; ++i) {
|
||||
MDNode *Flag = ModFlags->getOperand(i);
|
||||
ConstantInt *Behavior = cast<ConstantInt>(Flag->getOperand(0));
|
||||
MDString *Key = cast<MDString>(Flag->getOperand(1));
|
||||
Value *Val = Flag->getOperand(2);
|
||||
Flags.push_back(ModuleFlagEntry(Behavior->getZExtValue(), Key, Val));
|
||||
}
|
||||
}
|
||||
|
||||
/// getModuleFlagsMetadata - Returns the NamedMDNode in the module that
|
||||
/// represents module-level flags. This method returns null if there are no
|
||||
/// module-level flags.
|
||||
|
Reference in New Issue
Block a user