[llvm-commits] Two patches: some VStudio compiler errors and aninterpreter multi-use crash

Chuck Rose III cfr at adobe.com
Fri Jul 27 10:24:54 PDT 2007


Hola Reid,

Comments inline.

Thanks,
Chuck.

-----Original Message-----
From: llvm-commits-bounces at cs.uiuc.edu
[mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Reid Spencer
Sent: Friday, July 27, 2007 10:05 AM
To: CVS Commit Messages for LLVM repository
Subject: Re: [llvm-commits] Two patches: some VStudio compiler errors
and aninterpreter multi-use crash

Chuck,

Looks okay to me.  Some feedback for you ..

Reid.

On Fri, 2007-07-27 at 09:31 -0700, Chuck Rose III wrote:

> 
> Index: ExecutionEngine/Interpreter/ExternalFunctions.cpp
> ===================================================================
> --- ExecutionEngine/Interpreter/ExternalFunctions.cpp   (revision
> 40471)
> +++ ExecutionEngine/Interpreter/ExternalFunctions.cpp   (working copy)
> @@ -25,6 +25,7 @@
>  #include "llvm/Support/Streams.h"
>  #include "llvm/System/DynamicLibrary.h"
>  #include "llvm/Target/TargetData.h"
> +#include "llvm/Support/ManagedStatic.h"
>  #include <csignal>
>  #include <map>
>  #include <cmath>
> @@ -33,7 +34,7 @@
>  using namespace llvm;
>  
>  typedef GenericValue (*ExFunc)(FunctionType *, const
> vector<GenericValue> &);
> -static std::map<const Function *, ExFunc> Functions;
> +static ManagedStatic<std::map<const Function *, ExFunc> > Functions;
>  static std::map<std::string, ExFunc> FuncNames;

Why not make FuncNames a ManagedStatic as well?

It should most likely be one as well.  I'll make that change in my area
and run it through its paces in our system and will put that in as a
second fix next week.

I've been working with our system here with that first fix applied to
llvm for a few weeks now, so I have good confidence that it doesn't mess
things up.  I'd like to get my current crop of fixes in today so I can
checkout tonight on a clean system and see that the new vstudio files
build there too.

>  
>  static Interpreter *TheInterpreter;
> @@ -80,7 +81,7 @@
>      FnPtr = (ExFunc)(intptr_t)
>        sys::DynamicLibrary::SearchForAddressOfSymbol(F->getName());
>    if (FnPtr != 0)
> -    Functions.insert(std::make_pair(F, FnPtr));  // Cache for later
> +    Functions->insert(std::make_pair(F, FnPtr));  // Cache for later
>    return FnPtr;
>  }
>  
> @@ -90,8 +91,8 @@
>  
>    // Do a lookup to see if the function is in our cache... this
> should just be a
>    // deferred annotation!
> -  std::map<const Function *, ExFunc>::iterator FI =
> Functions.find(F);
> -  ExFunc Fn = (FI == Functions.end()) ? lookupFunction(F) :
> FI->second;
> +  std::map<const Function *, ExFunc>::iterator FI =
> Functions->find(F);
> +  ExFunc Fn = (FI == Functions->end()) ? lookupFunction(F) :
> FI->second;
>    if (Fn == 0) {
>      cerr << "Tried to execute an unknown external function: "
>           << F->getType()->getDescription() << " " << F->getName() <<
> "\n";
> Index: Transforms/Scalar/LoopUnswitch.cpp
> ===================================================================
> --- Transforms/Scalar/LoopUnswitch.cpp  (revision 40471)
> +++ Transforms/Scalar/LoopUnswitch.cpp  (working copy)
> @@ -482,9 +482,9 @@
>        for (DominanceFrontier::DomSetType::iterator I = S.begin(), E =
> S.end();
>             I != E; ++I) {
>          BasicBlock *BB = *I;
> -        DenseMap<const Value*, Value*>::iterator I = VM.find(BB);
> -        if (I != VM.end())
> -          NewDFSet.insert(cast<BasicBlock>(I->second));
> +        DenseMap<const Value*, Value*>::iterator IDM = VM.find(BB);
> +        if (IDM != VM.end())
> +          NewDFSet.insert(cast<BasicBlock>(IDM->second));

I assume this is because of a VC++ error/warning on the redefinition of
I ?

Exactly.  Vstudio doesn't like that.  Ditto for the patch on TableGen
too.


>          else
>            NewDFSet.insert(BB);
>        }
> 


> Index: TableGen/RegisterInfoEmitter.cpp
> ===================================================================
> --- TableGen/RegisterInfoEmitter.cpp    (revision 40471)
> +++ TableGen/RegisterInfoEmitter.cpp    (working copy)
> @@ -240,8 +240,8 @@
>  
>        bool Empty = true;
>        
> -      for (unsigned subrc = 0, e2 = RC.SubRegClasses.size();
> -            subrc != e2; ++subrc) {
> +      for (unsigned subrc = 0, subrcMax = RC.SubRegClasses.size();
> +            subrc != subrcMax; ++subrc) {


>          unsigned rc2 = 0, e2 = RegisterClasses.size();
>          for (; rc2 != e2; ++rc2) {
>            const CodeGenRegisterClass &RC2 =  RegisterClasses[rc2];
> 

_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list