[C++11] Add 'override' keyword to virtual methods that override their base class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203344 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2014-03-08 07:51:20 +00:00
parent 1829d9d290
commit 838cb749dc
16 changed files with 229 additions and 237 deletions

View File

@ -56,7 +56,7 @@ protected:
/// while providing a common ObjectBuffer interface for access to the
/// memory once the object has been generated.
class ObjectBufferStream : public ObjectBuffer {
virtual void anchor();
void anchor() override;
public:
ObjectBufferStream() : OS(SV) {}
virtual ~ObjectBufferStream() {}

View File

@ -48,19 +48,18 @@ public:
///
/// The value of \p Alignment must be a power of two. If \p Alignment is zero
/// a default alignment of 16 will be used.
virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID,
StringRef SectionName);
uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID,
StringRef SectionName) override;
/// \brief Allocates a memory block of (at least) the given size suitable for
/// executable code.
///
/// The value of \p Alignment must be a power of two. If \p Alignment is zero
/// a default alignment of 16 will be used.
virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID,
StringRef SectionName,
bool isReadOnly);
uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID, StringRef SectionName,
bool isReadOnly) override;
/// \brief Update section-specific memory permissions and other attributes.
///
@ -73,7 +72,7 @@ public:
/// operations needed to reliably use the memory are also performed.
///
/// \returns true if an error occurred, false otherwise.
virtual bool finalizeMemory(std::string *ErrMsg = 0);
bool finalizeMemory(std::string *ErrMsg = 0) override;
/// \brief Invalidate instruction cache for code sections.
///

View File

@ -97,7 +97,7 @@ public:
return static_cast<char*>(RawMemory) + sizeof(GVMemoryBlock);
}
virtual void deleted() {
void deleted() override {
// We allocated with operator new and with some extra memory hanging off the
// end, so don't just delete this. I'm not sure if this is actually
// required.

View File

@ -361,15 +361,15 @@ public:
void *Opaque);
virtual ~SimpleBindingMemoryManager();
virtual uint8_t *allocateCodeSection(
uintptr_t Size, unsigned Alignment, unsigned SectionID,
StringRef SectionName);
uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID,
StringRef SectionName) override;
virtual uint8_t *allocateDataSection(
uintptr_t Size, unsigned Alignment, unsigned SectionID,
StringRef SectionName, bool isReadOnly);
uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID, StringRef SectionName,
bool isReadOnly) override;
virtual bool finalizeMemory(std::string *ErrMsg);
bool finalizeMemory(std::string *ErrMsg) override;
private:
SimpleBindingMMFunctions Functions;

View File

@ -112,11 +112,11 @@ public:
/// run - Start execution with the specified function and arguments.
///
virtual GenericValue runFunction(Function *F,
const std::vector<GenericValue> &ArgValues);
GenericValue runFunction(Function *F,
const std::vector<GenericValue> &ArgValues) override;
virtual void *getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure = true) {
void *getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure = true) override {
// FIXME: not implemented.
return 0;
}
@ -124,13 +124,13 @@ public:
/// recompileAndRelinkFunction - For the interpreter, functions are always
/// up-to-date.
///
virtual void *recompileAndRelinkFunction(Function *F) {
void *recompileAndRelinkFunction(Function *F) override {
return getPointerToFunction(F);
}
/// freeMachineCodeForFunction - The interpreter does not generate any code.
///
void freeMachineCodeForFunction(Function *F) { }
void freeMachineCodeForFunction(Function *F) override { }
// Methods used to execute code:
// Place a call on the stack
@ -212,8 +212,8 @@ private: // Helper functions
//
void SwitchToNewBasicBlock(BasicBlock *Dest, ExecutionContext &SF);
void *getPointerToFunction(Function *F) { return (void*)F; }
void *getPointerToBasicBlock(BasicBlock *BB) { return (void*)BB; }
void *getPointerToFunction(Function *F) override { return (void*)F; }
void *getPointerToBasicBlock(BasicBlock *BB) override { return (void*)BB; }
void initializeExecutionEngine() { }
void initializeExternalFunctions();

View File

@ -450,9 +450,8 @@ void JIT::runJITOnFunction(Function *F, MachineCodeInfo *MCI) {
MachineCodeInfo *const MCI;
public:
MCIListener(MachineCodeInfo *mci) : MCI(mci) {}
virtual void NotifyFunctionEmitted(const Function &,
void *Code, size_t Size,
const EmittedFunctionDetails &) {
void NotifyFunctionEmitted(const Function &, void *Code, size_t Size,
const EmittedFunctionDetails &) override {
MCI->setAddress(Code);
MCI->setSize(Size);
}

View File

@ -106,16 +106,16 @@ public:
RM, CMM);
}
virtual void addModule(Module *M);
void addModule(Module *M) override;
/// removeModule - Remove a Module from the list of modules. Returns true if
/// M is found.
virtual bool removeModule(Module *M);
bool removeModule(Module *M) override;
/// runFunction - Start execution with the specified function and arguments.
///
virtual GenericValue runFunction(Function *F,
const std::vector<GenericValue> &ArgValues);
GenericValue runFunction(Function *F,
const std::vector<GenericValue> &ArgValues) override;
/// getPointerToNamedFunction - This method returns the address of the
/// specified function by using the MemoryManager. As such it is only
@ -125,8 +125,8 @@ public:
/// found, this function silently returns a null pointer. Otherwise,
/// it prints a message to stderr and aborts.
///
virtual void *getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure = true);
void *getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure = true) override;
// CompilationCallback - Invoked the first time that a call site is found,
// which causes lazy compilation of the target function.
@ -136,7 +136,7 @@ public:
/// getPointerToFunction - This returns the address of the specified function,
/// compiling it if necessary.
///
void *getPointerToFunction(Function *F);
void *getPointerToFunction(Function *F) override;
/// addPointerToBasicBlock - Adds address of the specific basic block.
void addPointerToBasicBlock(const BasicBlock *BB, void *Addr);
@ -146,18 +146,18 @@ public:
/// getPointerToBasicBlock - This returns the address of the specified basic
/// block, assuming function is compiled.
void *getPointerToBasicBlock(BasicBlock *BB);
void *getPointerToBasicBlock(BasicBlock *BB) override;
/// getOrEmitGlobalVariable - Return the address of the specified global
/// variable, possibly emitting it to memory if needed. This is used by the
/// Emitter.
void *getOrEmitGlobalVariable(const GlobalVariable *GV);
void *getOrEmitGlobalVariable(const GlobalVariable *GV) override;
/// getPointerToFunctionOrStub - If the specified function has been
/// code-gen'd, return a pointer to the function. If not, compile it, or use
/// a stub to implement lazy compilation if available.
///
void *getPointerToFunctionOrStub(Function *F);
void *getPointerToFunctionOrStub(Function *F) override;
/// recompileAndRelinkFunction - This method is used to force a function
/// which has already been compiled, to be compiled again, possibly
@ -165,12 +165,12 @@ public:
/// with a branch to the new copy. If there was no old copy, this acts
/// just like JIT::getPointerToFunction().
///
void *recompileAndRelinkFunction(Function *F);
void *recompileAndRelinkFunction(Function *F) override;
/// freeMachineCodeForFunction - deallocate memory used to code-generate this
/// Function.
///
void freeMachineCodeForFunction(Function *F);
void freeMachineCodeForFunction(Function *F) override;
/// addPendingFunction - while jitting non-lazily, a called but non-codegen'd
/// function was encountered. Add it to a pending list to be processed after
@ -189,12 +189,12 @@ public:
TargetMachine *TM);
// Run the JIT on F and return information about the generated code
void runJITOnFunction(Function *F, MachineCodeInfo *MCI = 0);
void runJITOnFunction(Function *F, MachineCodeInfo *MCI = 0) override;
virtual void RegisterJITEventListener(JITEventListener *L);
virtual void UnregisterJITEventListener(JITEventListener *L);
void RegisterJITEventListener(JITEventListener *L) override;
void UnregisterJITEventListener(JITEventListener *L) override;
virtual TargetMachine *getTargetMachine() { return &TM; }
TargetMachine *getTargetMachine() override { return &TM; }
/// These functions correspond to the methods on JITEventListener. They
/// iterate over the registered listeners and call the corresponding method on
@ -220,7 +220,7 @@ private:
protected:
/// getMemoryforGV - Allocate memory for a global variable.
virtual char* getMemoryForGV(const GlobalVariable* GV);
char* getMemoryForGV(const GlobalVariable* GV) override;
};

View File

@ -375,8 +375,8 @@ namespace {
JITResolver &getJITResolver() { return Resolver; }
virtual void startFunction(MachineFunction &F);
virtual bool finishFunction(MachineFunction &F);
void startFunction(MachineFunction &F) override;
bool finishFunction(MachineFunction &F) override;
void emitConstantPool(MachineConstantPool *MCP);
void initJumpTableInfo(MachineJumpTableInfo *MJTI);
@ -386,24 +386,23 @@ namespace {
unsigned StubSize, unsigned Alignment = 1);
void startGVStub(void *Buffer, unsigned StubSize);
void finishGVStub();
virtual void *allocIndirectGV(const GlobalValue *GV,
const uint8_t *Buffer, size_t Size,
unsigned Alignment);
void *allocIndirectGV(const GlobalValue *GV, const uint8_t *Buffer,
size_t Size, unsigned Alignment) override;
/// allocateSpace - Reserves space in the current block if any, or
/// allocate a new one of the given size.
virtual void *allocateSpace(uintptr_t Size, unsigned Alignment);
void *allocateSpace(uintptr_t Size, unsigned Alignment) override;
/// allocateGlobal - Allocate memory for a global. Unlike allocateSpace,
/// this method does not allocate memory in the current output buffer,
/// because a global may live longer than the current function.
virtual void *allocateGlobal(uintptr_t Size, unsigned Alignment);
void *allocateGlobal(uintptr_t Size, unsigned Alignment) override;
virtual void addRelocation(const MachineRelocation &MR) {
void addRelocation(const MachineRelocation &MR) override {
Relocations.push_back(MR);
}
virtual void StartMachineBasicBlock(MachineBasicBlock *MBB) {
void StartMachineBasicBlock(MachineBasicBlock *MBB) override {
if (MBBLocations.size() <= (unsigned)MBB->getNumber())
MBBLocations.resize((MBB->getNumber()+1)*2);
MBBLocations[MBB->getNumber()] = getCurrentPCValue();
@ -414,10 +413,11 @@ namespace {
<< (void*) getCurrentPCValue() << "]\n");
}
virtual uintptr_t getConstantPoolEntryAddress(unsigned Entry) const;
virtual uintptr_t getJumpTableEntryAddress(unsigned Entry) const;
uintptr_t getConstantPoolEntryAddress(unsigned Entry) const override;
uintptr_t getJumpTableEntryAddress(unsigned Entry) const override;
virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const{
uintptr_t
getMachineBasicBlockAddress(MachineBasicBlock *MBB) const override {
assert(MBBLocations.size() > (unsigned)MBB->getNumber() &&
MBBLocations[MBB->getNumber()] && "MBB not emitted!");
return MBBLocations[MBB->getNumber()];
@ -432,22 +432,22 @@ namespace {
/// function body.
void deallocateMemForFunction(const Function *F);
virtual void processDebugLoc(DebugLoc DL, bool BeforePrintingInsn);
void processDebugLoc(DebugLoc DL, bool BeforePrintingInsn) override;
virtual void emitLabel(MCSymbol *Label) {
void emitLabel(MCSymbol *Label) override {
LabelLocations[Label] = getCurrentPCValue();
}
virtual DenseMap<MCSymbol*, uintptr_t> *getLabelLocations() {
DenseMap<MCSymbol*, uintptr_t> *getLabelLocations() override {
return &LabelLocations;
}
virtual uintptr_t getLabelAddress(MCSymbol *Label) const {
uintptr_t getLabelAddress(MCSymbol *Label) const override {
assert(LabelLocations.count(Label) && "Label not emitted!");
return LabelLocations.find(Label)->second;
}
virtual void setModuleInfo(MachineModuleInfo* Info) {
void setModuleInfo(MachineModuleInfo* Info) override {
MMI = Info;
}

View File

@ -274,8 +274,8 @@ namespace {
public:
JITSlabAllocator(DefaultJITMemoryManager &jmm) : JMM(jmm) { }
virtual ~JITSlabAllocator() { }
virtual MemSlab *Allocate(size_t Size);
virtual void Deallocate(MemSlab *Slab);
MemSlab *Allocate(size_t Size) override;
void Deallocate(MemSlab *Slab) override;
};
/// DefaultJITMemoryManager - Manage memory for the JIT code generation.
@ -332,23 +332,24 @@ namespace {
/// getPointerToNamedFunction - This method returns the address of the
/// specified function by using the dlsym function call.
virtual void *getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure = true);
void *getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure = true) override;
void AllocateGOT();
void AllocateGOT() override;
// Testing methods.
virtual bool CheckInvariants(std::string &ErrorStr);
size_t GetDefaultCodeSlabSize() { return DefaultCodeSlabSize; }
size_t GetDefaultDataSlabSize() { return DefaultSlabSize; }
size_t GetDefaultStubSlabSize() { return DefaultSlabSize; }
unsigned GetNumCodeSlabs() { return CodeSlabs.size(); }
unsigned GetNumDataSlabs() { return DataAllocator.GetNumSlabs(); }
unsigned GetNumStubSlabs() { return StubAllocator.GetNumSlabs(); }
bool CheckInvariants(std::string &ErrorStr) override;
size_t GetDefaultCodeSlabSize() override { return DefaultCodeSlabSize; }
size_t GetDefaultDataSlabSize() override { return DefaultSlabSize; }
size_t GetDefaultStubSlabSize() override { return DefaultSlabSize; }
unsigned GetNumCodeSlabs() override { return CodeSlabs.size(); }
unsigned GetNumDataSlabs() override { return DataAllocator.GetNumSlabs(); }
unsigned GetNumStubSlabs() override { return StubAllocator.GetNumSlabs(); }
/// startFunctionBody - When a function starts, allocate a block of free
/// executable memory, returning a pointer to it and its actual size.
uint8_t *startFunctionBody(const Function *F, uintptr_t &ActualSize) {
uint8_t *startFunctionBody(const Function *F,
uintptr_t &ActualSize) override {
FreeRangeHeader* candidateBlock = FreeMemoryList;
FreeRangeHeader* head = FreeMemoryList;
@ -422,7 +423,7 @@ namespace {
/// endFunctionBody - The function F is now allocated, and takes the memory
/// in the range [FunctionStart,FunctionEnd).
void endFunctionBody(const Function *F, uint8_t *FunctionStart,
uint8_t *FunctionEnd) {
uint8_t *FunctionEnd) override {
assert(FunctionEnd > FunctionStart);
assert(FunctionStart == (uint8_t *)(CurBlock+1) &&
"Mismatched function start/end!");
@ -435,7 +436,7 @@ namespace {
/// allocateSpace - Allocate a memory block of the given size. This method
/// cannot be called between calls to startFunctionBody and endFunctionBody.
uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) {
uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) override {
CurBlock = FreeMemoryList;
FreeMemoryList = FreeMemoryList->AllocateBlock();
@ -453,18 +454,19 @@ namespace {
/// allocateStub - Allocate memory for a function stub.
uint8_t *allocateStub(const GlobalValue* F, unsigned StubSize,
unsigned Alignment) {
unsigned Alignment) override {
return (uint8_t*)StubAllocator.Allocate(StubSize, Alignment);
}
/// allocateGlobal - Allocate memory for a global.
uint8_t *allocateGlobal(uintptr_t Size, unsigned Alignment) {
uint8_t *allocateGlobal(uintptr_t Size, unsigned Alignment) override {
return (uint8_t*)DataAllocator.Allocate(Size, Alignment);
}
/// allocateCodeSection - Allocate memory for a code section.
uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID, StringRef SectionName) {
unsigned SectionID,
StringRef SectionName) override {
// Grow the required block size to account for the block header
Size += sizeof(*CurBlock);
@ -511,15 +513,15 @@ namespace {
/// allocateDataSection - Allocate memory for a data section.
uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID, StringRef SectionName,
bool IsReadOnly) {
bool IsReadOnly) override {
return (uint8_t*)DataAllocator.Allocate(Size, Alignment);
}
bool finalizeMemory(std::string *ErrMsg) {
bool finalizeMemory(std::string *ErrMsg) override {
return false;
}
uint8_t *getGOTBase() const {
uint8_t *getGOTBase() const override {
return GOTBase;
}
@ -539,28 +541,26 @@ namespace {
/// deallocateFunctionBody - Deallocate all memory for the specified
/// function body.
void deallocateFunctionBody(void *Body) {
void deallocateFunctionBody(void *Body) override {
if (Body) deallocateBlock(Body);
}
/// setMemoryWritable - When code generation is in progress,
/// the code pages may need permissions changed.
void setMemoryWritable()
{
void setMemoryWritable() override {
for (unsigned i = 0, e = CodeSlabs.size(); i != e; ++i)
sys::Memory::setWritable(CodeSlabs[i]);
}
/// setMemoryExecutable - When code generation is done and we're ready to
/// start execution, the code pages may need permissions changed.
void setMemoryExecutable()
{
void setMemoryExecutable() override {
for (unsigned i = 0, e = CodeSlabs.size(); i != e; ++i)
sys::Memory::setExecutable(CodeSlabs[i]);
}
/// setPoisonMemory - Controls whether we write garbage over freed memory.
///
void setPoisonMemory(bool poison) {
void setPoisonMemory(bool poison) override {
PoisonMemory = poison;
}
};

View File

@ -31,46 +31,47 @@ public:
LinkingMemoryManager(MCJIT *Parent, RTDyldMemoryManager *MM)
: ParentEngine(Parent), ClientMM(MM) {}
virtual uint64_t getSymbolAddress(const std::string &Name);
uint64_t getSymbolAddress(const std::string &Name) override;
// Functions deferred to client memory manager
virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID, StringRef SectionName) {
uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID,
StringRef SectionName) override {
return ClientMM->allocateCodeSection(Size, Alignment, SectionID, SectionName);
}
virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID, StringRef SectionName,
bool IsReadOnly) {
uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID, StringRef SectionName,
bool IsReadOnly) override {
return ClientMM->allocateDataSection(Size, Alignment,
SectionID, SectionName, IsReadOnly);
}
virtual void reserveAllocationSpace(
uintptr_t CodeSize, uintptr_t DataSizeRO, uintptr_t DataSizeRW) {
void reserveAllocationSpace(uintptr_t CodeSize, uintptr_t DataSizeRO,
uintptr_t DataSizeRW) override {
return ClientMM->reserveAllocationSpace(CodeSize, DataSizeRO, DataSizeRW);
}
virtual bool needsToReserveAllocationSpace() {
bool needsToReserveAllocationSpace() override {
return ClientMM->needsToReserveAllocationSpace();
}
virtual void notifyObjectLoaded(ExecutionEngine *EE,
const ObjectImage *Obj) {
void notifyObjectLoaded(ExecutionEngine *EE,
const ObjectImage *Obj) override {
ClientMM->notifyObjectLoaded(EE, Obj);
}
virtual void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {
void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr,
size_t Size) override {
ClientMM->registerEHFrames(Addr, LoadAddr, Size);
}
virtual void deregisterEHFrames(uint8_t *Addr,
uint64_t LoadAddr,
size_t Size) {
void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr,
size_t Size) override {
ClientMM->deregisterEHFrames(Addr, LoadAddr, Size);
}
virtual bool finalizeMemory(std::string *ErrMsg = 0) {
bool finalizeMemory(std::string *ErrMsg = 0) override {
return ClientMM->finalizeMemory(ErrMsg);
}
@ -237,20 +238,20 @@ public:
/// @name ExecutionEngine interface implementation
/// @{
virtual void addModule(Module *M);
virtual void addObjectFile(object::ObjectFile *O);
virtual void addArchive(object::Archive *O);
virtual bool removeModule(Module *M);
void addModule(Module *M) override;
void addObjectFile(object::ObjectFile *O) override;
void addArchive(object::Archive *O) override;
bool removeModule(Module *M) override;
/// FindFunctionNamed - Search all of the active modules to find the one that
/// defines FnName. This is very slow operation and shouldn't be used for
/// general code.
virtual Function *FindFunctionNamed(const char *FnName);
Function *FindFunctionNamed(const char *FnName) override;
/// Sets the object manager that MCJIT should use to avoid compilation.
virtual void setObjectCache(ObjectCache *manager);
void setObjectCache(ObjectCache *manager) override;
virtual void generateCodeForModule(Module *M);
void generateCodeForModule(Module *M) override;
/// finalizeObject - ensure the module is fully processed and is usable.
///
@ -261,7 +262,7 @@ public:
/// object.
/// Is it OK to finalize a set of modules, add modules and finalize again.
// FIXME: Do we really need both of these?
virtual void finalizeObject();
void finalizeObject() override;
virtual void finalizeModule(Module *);
void finalizeLoadedModules();
@ -269,18 +270,18 @@ public:
/// the static constructors or destructors for a program.
///
/// \param isDtors - Run the destructors instead of constructors.
void runStaticConstructorsDestructors(bool isDtors);
void runStaticConstructorsDestructors(bool isDtors) override;
virtual void *getPointerToBasicBlock(BasicBlock *BB);
void *getPointerToBasicBlock(BasicBlock *BB) override;
virtual void *getPointerToFunction(Function *F);
void *getPointerToFunction(Function *F) override;
virtual void *recompileAndRelinkFunction(Function *F);
void *recompileAndRelinkFunction(Function *F) override;
virtual void freeMachineCodeForFunction(Function *F);
void freeMachineCodeForFunction(Function *F) override;
virtual GenericValue runFunction(Function *F,
const std::vector<GenericValue> &ArgValues);
GenericValue runFunction(Function *F,
const std::vector<GenericValue> &ArgValues) override;
/// getPointerToNamedFunction - This method returns the address of the
/// specified function by using the dlsym function call. As such it is only
@ -290,27 +291,27 @@ public:
/// found, this function silently returns a null pointer. Otherwise,
/// it prints a message to stderr and aborts.
///
virtual void *getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure = true);
void *getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure = true) override;
/// mapSectionAddress - map a section to its target address space value.
/// Map the address of a JIT section as returned from the memory manager
/// to the address in the target process as the running code will see it.
/// This is the address which will be used for relocation resolution.
virtual void mapSectionAddress(const void *LocalAddress,
uint64_t TargetAddress) {
void mapSectionAddress(const void *LocalAddress,
uint64_t TargetAddress) override {
Dyld.mapSectionAddress(LocalAddress, TargetAddress);
}
virtual void RegisterJITEventListener(JITEventListener *L);
virtual void UnregisterJITEventListener(JITEventListener *L);
void RegisterJITEventListener(JITEventListener *L) override;
void UnregisterJITEventListener(JITEventListener *L) override;
// If successful, these function will implicitly finalize all loaded objects.
// To get a function address within MCJIT without causing a finalize, use
// getSymbolAddress.
virtual uint64_t getGlobalValueAddress(const std::string &Name);
virtual uint64_t getFunctionAddress(const std::string &Name);
uint64_t getGlobalValueAddress(const std::string &Name) override;
uint64_t getFunctionAddress(const std::string &Name) override;
virtual TargetMachine *getTargetMachine() { return TM; }
TargetMachine *getTargetMachine() override { return TM; }
/// @}
/// @name (Private) Registration Interfaces

View File

@ -84,12 +84,12 @@ public:
/// Creates an entry in the JIT registry for the buffer @p Object,
/// which must contain an object file in executable memory with any
/// debug information for the debugger.
void registerObject(const ObjectBuffer &Object);
void registerObject(const ObjectBuffer &Object) override;
/// Removes the internal registration of @p Object, and
/// frees associated resources.
/// Returns true if @p Object was found in ObjectBufferMap.
bool deregisterObject(const ObjectBuffer &Object);
bool deregisterObject(const ObjectBuffer &Object) override;
private:
/// Deregister the debug info for the given object file from the debugger

View File

@ -27,7 +27,7 @@ namespace object {
class ObjectImageCommon : public ObjectImage {
ObjectImageCommon(); // = delete
ObjectImageCommon(const ObjectImageCommon &other); // = delete
virtual void anchor();
void anchor() override;
protected:
object::ObjectFile *ObjFile;
@ -51,33 +51,33 @@ public:
: ObjectImage(NULL), ObjFile(Input) {}
virtual ~ObjectImageCommon() { delete ObjFile; }
virtual object::symbol_iterator begin_symbols() const
{ return ObjFile->symbol_begin(); }
virtual object::symbol_iterator end_symbols() const
{ return ObjFile->symbol_end(); }
object::symbol_iterator begin_symbols() const override
{ return ObjFile->symbol_begin(); }
object::symbol_iterator end_symbols() const override
{ return ObjFile->symbol_end(); }
virtual object::section_iterator begin_sections() const
{ return ObjFile->section_begin(); }
virtual object::section_iterator end_sections() const
{ return ObjFile->section_end(); }
object::section_iterator begin_sections() const override
{ return ObjFile->section_begin(); }
object::section_iterator end_sections() const override
{ return ObjFile->section_end(); }
virtual /* Triple::ArchType */ unsigned getArch() const
{ return ObjFile->getArch(); }
/* Triple::ArchType */ unsigned getArch() const override
{ return ObjFile->getArch(); }
virtual StringRef getData() const { return ObjFile->getData(); }
StringRef getData() const override { return ObjFile->getData(); }
virtual object::ObjectFile* getObjectFile() const { return ObjFile; }
object::ObjectFile* getObjectFile() const override { return ObjFile; }
// Subclasses can override these methods to update the image with loaded
// addresses for sections and common symbols
virtual void updateSectionAddress(const object::SectionRef &Sec,
uint64_t Addr) {}
virtual void updateSymbolAddress(const object::SymbolRef &Sym, uint64_t Addr)
{}
void updateSectionAddress(const object::SectionRef &Sec,
uint64_t Addr) override {}
void updateSymbolAddress(const object::SymbolRef &Sym,
uint64_t Addr) override {}
// Subclasses can override these methods to provide JIT debugging support
virtual void registerWithDebugger() {}
virtual void deregisterWithDebugger() {}
void registerWithDebugger() override {}
void deregisterWithDebugger() override {}
};
} // end namespace llvm

View File

@ -94,23 +94,19 @@ class ELFObjectImage : public ObjectImageCommon {
// Subclasses can override these methods to update the image with loaded
// addresses for sections and common symbols
virtual void updateSectionAddress(const SectionRef &Sec, uint64_t Addr)
{
void updateSectionAddress(const SectionRef &Sec, uint64_t Addr) override {
DyldObj->updateSectionAddress(Sec, Addr);
}
virtual void updateSymbolAddress(const SymbolRef &Sym, uint64_t Addr)
{
void updateSymbolAddress(const SymbolRef &Sym, uint64_t Addr) override {
DyldObj->updateSymbolAddress(Sym, Addr);
}
virtual void registerWithDebugger()
{
void registerWithDebugger() override {
JITRegistrar::getGDBRegistrar().registerObject(*Buffer);
Registered = true;
}
virtual void deregisterWithDebugger()
{
void deregisterWithDebugger() override {
JITRegistrar::getGDBRegistrar().deregisterObject(*Buffer);
}
};

View File

@ -82,7 +82,7 @@ class RuntimeDyldELF : public RuntimeDyldImpl {
uint32_t Type,
int64_t Addend);
unsigned getMaxStubSize() {
unsigned getMaxStubSize() override {
if (Arch == Triple::aarch64)
return 20; // movz; movk; movk; movk; br
if (Arch == Triple::arm || Arch == Triple::thumb)
@ -99,7 +99,7 @@ class RuntimeDyldELF : public RuntimeDyldImpl {
return 0;
}
unsigned getStubAlignment() {
unsigned getStubAlignment() override {
if (Arch == Triple::systemz)
return 8;
else
@ -114,7 +114,7 @@ class RuntimeDyldELF : public RuntimeDyldImpl {
uint64_t findGOTEntry(uint64_t LoadAddr, uint64_t Offset);
size_t getGOTEntrySize();
virtual void updateGOTEntries(StringRef Name, uint64_t Addr);
void updateGOTEntries(StringRef Name, uint64_t Addr) override;
// Relocation entries for symbols whose position-independent offset is
// updated in a global offset table.
@ -132,20 +132,18 @@ public:
RuntimeDyldELF(RTDyldMemoryManager *mm) : RuntimeDyldImpl(mm)
{}
virtual void resolveRelocation(const RelocationEntry &RE, uint64_t Value);
virtual void processRelocationRef(unsigned SectionID,
RelocationRef RelI,
ObjectImage &Obj,
ObjSectionToIDMap &ObjSectionToID,
const SymbolTableMap &Symbols,
StubMap &Stubs);
virtual bool isCompatibleFormat(const ObjectBuffer *Buffer) const;
virtual bool isCompatibleFile(const object::ObjectFile *Buffer) const;
virtual ObjectImage *createObjectImage(ObjectBuffer *InputBuffer);
virtual ObjectImage *createObjectImageFromFile(object::ObjectFile *Obj);
virtual void registerEHFrames();
virtual void deregisterEHFrames();
virtual void finalizeLoad(ObjSectionToIDMap &SectionMap);
void resolveRelocation(const RelocationEntry &RE, uint64_t Value) override;
void processRelocationRef(unsigned SectionID, RelocationRef RelI,
ObjectImage &Obj, ObjSectionToIDMap &ObjSectionToID,
const SymbolTableMap &Symbols,
StubMap &Stubs) override;
bool isCompatibleFormat(const ObjectBuffer *Buffer) const override;
bool isCompatibleFile(const object::ObjectFile *Buffer) const override;
ObjectImage *createObjectImage(ObjectBuffer *InputBuffer) override;
ObjectImage *createObjectImageFromFile(object::ObjectFile *Obj) override;
void registerEHFrames() override;
void deregisterEHFrames() override;
void finalizeLoad(ObjSectionToIDMap &SectionMap) override;
virtual ~RuntimeDyldELF();
};

View File

@ -55,7 +55,7 @@ class RuntimeDyldMachO : public RuntimeDyldImpl {
bool isPCRel,
unsigned Size);
unsigned getMaxStubSize() {
unsigned getMaxStubSize() override {
if (Arch == Triple::arm || Arch == Triple::thumb)
return 8; // 32-bit instruction and 32-bit address
else if (Arch == Triple::x86_64)
@ -64,7 +64,7 @@ class RuntimeDyldMachO : public RuntimeDyldImpl {
return 0;
}
unsigned getStubAlignment() {
unsigned getStubAlignment() override {
return 1;
}
@ -86,17 +86,15 @@ class RuntimeDyldMachO : public RuntimeDyldImpl {
public:
RuntimeDyldMachO(RTDyldMemoryManager *mm) : RuntimeDyldImpl(mm) {}
virtual void resolveRelocation(const RelocationEntry &RE, uint64_t Value);
virtual void processRelocationRef(unsigned SectionID,
RelocationRef RelI,
ObjectImage &Obj,
ObjSectionToIDMap &ObjSectionToID,
const SymbolTableMap &Symbols,
StubMap &Stubs);
virtual bool isCompatibleFormat(const ObjectBuffer *Buffer) const;
virtual bool isCompatibleFile(const object::ObjectFile *Obj) const;
virtual void registerEHFrames();
virtual void finalizeLoad(ObjSectionToIDMap &SectionMap);
void resolveRelocation(const RelocationEntry &RE, uint64_t Value) override;
void processRelocationRef(unsigned SectionID, RelocationRef RelI,
ObjectImage &Obj, ObjSectionToIDMap &ObjSectionToID,
const SymbolTableMap &Symbols,
StubMap &Stubs) override;
bool isCompatibleFormat(const ObjectBuffer *Buffer) const override;
bool isCompatibleFile(const object::ObjectFile *Obj) const override;
void registerEHFrames() override;
void finalizeLoad(ObjSectionToIDMap &SectionMap) override;
};
} // end namespace llvm

View File

@ -643,75 +643,76 @@ namespace {
RecordStreamer(MCContext &Context) : MCStreamer(Context) {}
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) {
void EmitInstruction(const MCInst &Inst,
const MCSubtargetInfo &STI) override {
// Scan for values.
for (unsigned i = Inst.getNumOperands(); i--; )
if (Inst.getOperand(i).isExpr())
AddValueSymbols(Inst.getOperand(i).getExpr());
}
virtual void EmitLabel(MCSymbol *Symbol) {
void EmitLabel(MCSymbol *Symbol) override {
Symbol->setSection(*getCurrentSection().first);
markDefined(*Symbol);
}
virtual void EmitDebugLabel(MCSymbol *Symbol) {
void EmitDebugLabel(MCSymbol *Symbol) override {
EmitLabel(Symbol);
}
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override {
// FIXME: should we handle aliases?
markDefined(*Symbol);
}
virtual bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) {
bool EmitSymbolAttribute(MCSymbol *Symbol,
MCSymbolAttr Attribute) override {
if (Attribute == MCSA_Global)
markGlobal(*Symbol);
return true;
}
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size , unsigned ByteAlignment) {
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size , unsigned ByteAlignment) override {
markDefined(*Symbol);
}
virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override {
markDefined(*Symbol);
}
virtual void EmitBundleAlignMode(unsigned AlignPow2) {}
virtual void EmitBundleLock(bool AlignToEnd) {}
virtual void EmitBundleUnlock() {}
void EmitBundleAlignMode(unsigned AlignPow2) override {}
void EmitBundleLock(bool AlignToEnd) override {}
void EmitBundleUnlock() override {}
// Noop calls.
virtual void ChangeSection(const MCSection *Section,
const MCExpr *Subsection) {}
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {}
virtual void EmitThumbFunc(MCSymbol *Func) {}
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {}
virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) {}
virtual void EmitCOFFSymbolStorageClass(int StorageClass) {}
virtual void EmitCOFFSymbolType(int Type) {}
virtual void EndCOFFSymbolDef() {}
virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {}
virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) {}
virtual void EmitBytes(StringRef Data) {}
virtual void EmitValueImpl(const MCExpr *Value, unsigned Size) {}
virtual void EmitULEB128Value(const MCExpr *Value) {}
virtual void EmitSLEB128Value(const MCExpr *Value) {}
virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
unsigned ValueSize,
unsigned MaxBytesToEmit) {}
virtual void EmitCodeAlignment(unsigned ByteAlignment,
unsigned MaxBytesToEmit) {}
virtual bool EmitValueToOffset(const MCExpr *Offset,
unsigned char Value ) { return false; }
virtual void EmitFileDirective(StringRef Filename) {}
virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
const MCSymbol *LastLabel,
const MCSymbol *Label,
unsigned PointerSize) {}
virtual void FinishImpl() {}
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) {
void ChangeSection(const MCSection *Section,
const MCExpr *Subsection) override {}
void EmitAssemblerFlag(MCAssemblerFlag Flag) override {}
void EmitThumbFunc(MCSymbol *Func) override {}
void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override {}
void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override {}
void BeginCOFFSymbolDef(const MCSymbol *Symbol) override {}
void EmitCOFFSymbolStorageClass(int StorageClass) override {}
void EmitCOFFSymbolType(int Type) override {}
void EndCOFFSymbolDef() override {}
void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) override {}
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override {}
void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) override {}
void EmitBytes(StringRef Data) override {}
void EmitValueImpl(const MCExpr *Value, unsigned Size) override {}
void EmitULEB128Value(const MCExpr *Value) override {}
void EmitSLEB128Value(const MCExpr *Value) override {}
void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
unsigned ValueSize,
unsigned MaxBytesToEmit) override {}
void EmitCodeAlignment(unsigned ByteAlignment,
unsigned MaxBytesToEmit) override {}
bool EmitValueToOffset(const MCExpr *Offset,
unsigned char Value) override { return false; }
void EmitFileDirective(StringRef Filename) override {}
void EmitDwarfAdvanceLineAddr(int64_t LineDelta, const MCSymbol *LastLabel,
const MCSymbol *Label,
unsigned PointerSize) override {}
void FinishImpl() override {}
void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) override {
RecordProcEnd(Frame);
}
};