Make TOC order deterministic by using MapVector instead of DenseMap.
llvm-svn: 167737
This commit is contained in:
		
							parent
							
								
									8fab8e53fb
								
							
						
					
					
						commit
						2c93acdfbf
					
				| 
						 | 
					@ -54,12 +54,13 @@
 | 
				
			||||||
#include "llvm/Support/ELF.h"
 | 
					#include "llvm/Support/ELF.h"
 | 
				
			||||||
#include "llvm/ADT/StringExtras.h"
 | 
					#include "llvm/ADT/StringExtras.h"
 | 
				
			||||||
#include "llvm/ADT/SmallString.h"
 | 
					#include "llvm/ADT/SmallString.h"
 | 
				
			||||||
 | 
					#include "llvm/ADT/MapVector.h"
 | 
				
			||||||
using namespace llvm;
 | 
					using namespace llvm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace {
 | 
					namespace {
 | 
				
			||||||
  class PPCAsmPrinter : public AsmPrinter {
 | 
					  class PPCAsmPrinter : public AsmPrinter {
 | 
				
			||||||
  protected:
 | 
					  protected:
 | 
				
			||||||
    DenseMap<MCSymbol*, MCSymbol*> TOC;
 | 
					    MapVector<MCSymbol*, MCSymbol*> TOC;
 | 
				
			||||||
    const PPCSubtarget &Subtarget;
 | 
					    const PPCSubtarget &Subtarget;
 | 
				
			||||||
    uint64_t TOCLabelID;
 | 
					    uint64_t TOCLabelID;
 | 
				
			||||||
  public:
 | 
					  public:
 | 
				
			||||||
| 
						 | 
					@ -465,8 +466,7 @@ bool PPCLinuxAsmPrinter::doFinalization(Module &M) {
 | 
				
			||||||
        SectionKind::getReadOnly());
 | 
					        SectionKind::getReadOnly());
 | 
				
			||||||
    OutStreamer.SwitchSection(Section);
 | 
					    OutStreamer.SwitchSection(Section);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // FIXME: This is nondeterminstic!
 | 
					    for (MapVector<MCSymbol*, MCSymbol*>::iterator I = TOC.begin(),
 | 
				
			||||||
    for (DenseMap<MCSymbol*, MCSymbol*>::iterator I = TOC.begin(),
 | 
					 | 
				
			||||||
         E = TOC.end(); I != E; ++I) {
 | 
					         E = TOC.end(); I != E; ++I) {
 | 
				
			||||||
      OutStreamer.EmitLabel(I->second);
 | 
					      OutStreamer.EmitLabel(I->second);
 | 
				
			||||||
      MCSymbol *S = OutContext.GetOrCreateSymbol(I->first->getName());
 | 
					      MCSymbol *S = OutContext.GetOrCreateSymbol(I->first->getName());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue