[llvm-commits] [llvm] r163592 - in /llvm/trunk: include/llvm/InitializePasses.h include/llvm/LinkAllPasses.h include/llvm/Transforms/IPO.h lib/Transforms/Utils/MetaRenamer.cpp lib/Transforms/Utils/Utils.cpp test/Transforms/MetaRenamer/ test/Transforms/MetaRenamer/lit.local.cfg test/Transforms/MetaRenamer/metarenamer.ll
Duncan Sands
baldrick at free.fr
Tue Sep 11 01:26:18 PDT 2012
Hi Alex,
> Add a pass that renames everything with metasyntatic names. This works well after using bugpoint to reduce the confusion presented by the original names, which no longer mean what they used to.
> --- llvm/trunk/lib/Transforms/Utils/MetaRenamer.cpp (added)
> +++ llvm/trunk/lib/Transforms/Utils/MetaRenamer.cpp Mon Sep 10 21:46:18 2012
> @@ -0,0 +1,132 @@
> +//===- MetaRenamer.cpp - Rename everything with metasyntatic names --------===//
> +//
> +// The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
> +//===----------------------------------------------------------------------===//
> +//
> +// This pass renames everything with metasyntatic names. The intent is to use
> +// this pass after bugpoint reduction to conceal the nature of the original
> +// program.
> +//
> +//===----------------------------------------------------------------------===//
> +
> +#include "llvm/Transforms/IPO.h"
> +#include "llvm/Function.h"
> +#include "llvm/Module.h"
> +#include "llvm/Pass.h"
> +#include "llvm/Type.h"
> +#include "llvm/TypeFinder.h"
> +#include "llvm/DerivedTypes.h"
not in alphabetical order.
> +#include "llvm/ADT/STLExtras.h"
> +#include "llvm/ADT/SmallString.h"
> + // Rename all aliases
> + for (Module::alias_iterator AI = M.alias_begin(), AE = M.alias_end();
> + AI != AE; ++AI)
> + AI->setName("alias");
> +
> + // Rename all global variables
> + for (Module::global_iterator GI = M.global_begin(), GE = M.global_end();
> + GI != GE; ++GI)
> + GI->setName("global");
I'm sure aliases and globals are feeling sad because they don't get funky names
too. Any reason why not?
> --- llvm/trunk/test/Transforms/MetaRenamer/lit.local.cfg (added)
> +++ llvm/trunk/test/Transforms/MetaRenamer/lit.local.cfg Mon Sep 10 21:46:18 2012
> @@ -0,0 +1 @@
> +config.suffixes = ['.ll', '.c', '.cpp']
I doubt you need '.c' and '.cpp' here.
Ciao, Duncan.
More information about the llvm-commits
mailing list