Example #1
0
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar) {
  GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
  Module::global_iterator I = GV;
  if (I == GV->getParent()->global_begin())
    return 0;
  return wrap(--I);
}
Example #2
0
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar) {
  GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
  Module::global_iterator I = GV;
  if (++I == GV->getParent()->global_end())
    return 0;
  return wrap(I);
}
Example #3
0
void moveGlobalVariableInitializer(GlobalVariable &OrigGV,
                                   ValueToValueMapTy &VMap,
                                   ValueMaterializer *Materializer,
                                   GlobalVariable *NewGV) {
  assert(OrigGV.hasInitializer() && "Nothing to move");
  if (!NewGV)
    NewGV = cast<GlobalVariable>(VMap[&OrigGV]);
  else
    assert(VMap[&OrigGV] == NewGV &&
           "Incorrect global variable mapping in VMap.");
  assert(NewGV->getParent() != OrigGV.getParent() &&
         "moveGlobalVariableInitializer should only be used to move "
         "initializers between modules");

  NewGV->setInitializer(MapValue(OrigGV.getInitializer(), VMap, RF_None,
                                 nullptr, Materializer));
}
Example #4
0
bool SpecialCaseList::isIn(const GlobalVariable &G,
                           const StringRef Category) const {
  return isIn(*G.getParent(), Category) ||
         inSectionCategory("global", G.getName(), Category) ||
         inSectionCategory("type", GetGVTypeString(G), Category);
}
Example #5
0
bool SpecialCaseList::findCategory(const GlobalVariable &G,
                                   StringRef &Category) const {
  return findCategory(*G.getParent(), Category) ||
         findCategory("global", G.getName(), Category) ||
         findCategory("type", GetGVTypeString(G), Category);
}
Example #6
0
bool BlackList::isIn(const GlobalVariable &G) {
  return isIn(*G.getParent()) || inSection("global", G.getName());
}
Example #7
0
bool BlackList::isInInit(const GlobalVariable &G) {
  return (isIn(*G.getParent()) ||
          inSection("global-init", G.getName()) ||
          inSection("global-init-type", GetGVTypeString(G)));
}