[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
Alex Rosenberg
alexr at leftfield.org
Fri Sep 14 12:21:53 PDT 2012
On Sep 11, 2012, at 1:26 AM, Duncan Sands wrote:
> 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.
Fixed in r163928.
>> +#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?
I was only interested in being able to reason about functions and thus give them names.
>> --- 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.
Also fixed.
Alex
More information about the llvm-commits
mailing list