Skip to content

Commit

Permalink
Change MemoryReference constructors from public to private/protected
Browse files Browse the repository at this point in the history
Since MemoryReference constructors should no longer be called directly to
create MemoryReference objects, they have been changed from public to
private/protected

Signed-off-by: Jackie Midroni <jackie.midroni@mail.utoronto.ca>
  • Loading branch information
Jackie Midroni committed Sep 11, 2020
1 parent d82b6ef commit 48c3e0b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 31 deletions.
9 changes: 3 additions & 6 deletions compiler/p/codegen/MemoryReference.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ class OMR_EXTENSIBLE MemoryReference : public OMR::MemoryReferenceConnector
int64_t disp,
uint8_t len,
TR::CodeGenerator *cg) :
OMR::MemoryReferenceConnector(br, disp, len, cg, 0) {}
OMR::MemoryReferenceConnector(br, disp, len, cg) {}

MemoryReference(TR::LabelSymbol *label, int64_t disp, int8_t len, TR::CodeGenerator *cg) :
OMR::MemoryReferenceConnector(label, disp, len, cg) {}

public:

MemoryReference(TR::CodeGenerator *cg) :
OMR::MemoryReferenceConnector(cg) {}

Expand All @@ -67,16 +65,15 @@ class OMR_EXTENSIBLE MemoryReference : public OMR::MemoryReferenceConnector
MemoryReference(TR::Node *node, MemoryReference& mr, int32_t n, uint32_t len, TR::CodeGenerator *cg):
OMR::MemoryReferenceConnector(node, mr, n, len, cg) {}

public:

static TR::MemoryReference *create(TR::CodeGenerator *cg);
static TR::MemoryReference *createWithLabel(TR::CodeGenerator *cg, TR::LabelSymbol *label, int64_t offset, int8_t length);
static TR::MemoryReference *createWithIndexReg(TR::CodeGenerator *cg, TR::Register *baseReg, TR::Register *indexReg, uint8_t length);
static TR::MemoryReference *createWithDisplacement(TR::CodeGenerator *cg, TR::Register *baseReg, int64_t displacement, int8_t length);
static TR::MemoryReference *createWithRootLoadOrStore(TR::CodeGenerator *cg, TR::Node *rootLoadOrStore, uint32_t length);
static TR::MemoryReference *createWithSymRef(TR::CodeGenerator *cg, TR::Node *node, TR::SymbolReference *symRef, uint32_t length);
static TR::MemoryReference *createWithMemRef(TR::CodeGenerator *cg, TR::Node *node, TR::MemoryReference& memRef, int32_t displacement, uint32_t length);

//Keeping the old version of the createWithLabel helper here to make sure OpenJ9 doesn't break
static TR::MemoryReference *withLabel(TR::CodeGenerator *cg, TR::LabelSymbol *label, int64_t offset, int8_t length);
};
}

Expand Down
6 changes: 0 additions & 6 deletions compiler/p/codegen/OMRMemoryReference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ TR::MemoryReference *TR::MemoryReference::createWithMemRef(TR::CodeGenerator *cg
return new (cg->trHeapMemory()) TR::MemoryReference(node, memRef, displacement, length, cg);
}

//Keeping the old version of the createWithLabel helper here to make sure OpenJ9 doesn't break
TR::MemoryReference *TR::MemoryReference::withLabel(TR::CodeGenerator *cg, TR::LabelSymbol *label, int64_t offset, int8_t length)
{
return new (cg->trHeapMemory()) TR::MemoryReference(label, offset, length, cg);
}

OMR::Power::MemoryReference::MemoryReference(
TR::CodeGenerator *cg) :
_baseRegister(NULL),
Expand Down
33 changes: 14 additions & 19 deletions compiler/p/codegen/OMRMemoryReference.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ class OMR_EXTENSIBLE MemoryReference : public OMR::MemoryReference

protected:

// The extra int parameter at the end is needed to ensure that this constructor is never
// ambiguous with the legacy constructor taking an int32_t for its displacement. This detail
// is hidden from other code, since this constructor can only be used by calling the
// MemoryReference::createWithDisplacement helper. Once the legacy constructor is removed, the extra
// parameter here can also be removed.
MemoryReference(
TR::Register *br,
int64_t disp,
Expand All @@ -96,6 +91,20 @@ class OMR_EXTENSIBLE MemoryReference : public OMR::MemoryReference
uint8_t len,
TR::CodeGenerator *cg);

MemoryReference(TR::CodeGenerator *cg);

MemoryReference(
TR::Register *br,
TR::Register *ir,
uint8_t len,
TR::CodeGenerator *cg);

MemoryReference(TR::Node *rootLoadOrStore, uint32_t len, TR::CodeGenerator *cg);

MemoryReference(TR::Node *node, TR::SymbolReference *symRef, uint32_t len, TR::CodeGenerator *cg);

MemoryReference(TR::Node *node, TR::MemoryReference& mr, int32_t n, uint32_t len, TR::CodeGenerator *cg);

public:

TR_ALLOC(TR_Memory::MemoryReference)
Expand All @@ -110,14 +119,6 @@ class OMR_EXTENSIBLE MemoryReference : public OMR::MemoryReference
TR_PPCMemoryReferenceControl_DelayedOffsetDone = 0x20
} TR_PPCMemoryReferenceControl;

MemoryReference(TR::CodeGenerator *cg);

MemoryReference(
TR::Register *br,
TR::Register *ir,
uint8_t len,
TR::CodeGenerator *cg);

virtual TR::RegisterDependencyConditions *getConditions() { return _conditions; }

TR::SymbolReference *getSymbolReference() {return _symbolReference;}
Expand Down Expand Up @@ -299,12 +300,6 @@ class OMR_EXTENSIBLE MemoryReference : public OMR::MemoryReference

void checkRegisters(TR::CodeGenerator *cg);

MemoryReference(TR::Node *rootLoadOrStore, uint32_t len, TR::CodeGenerator *cg);

MemoryReference(TR::Node *node, TR::SymbolReference *symRef, uint32_t len, TR::CodeGenerator *cg);

MemoryReference(TR::Node *node, TR::MemoryReference& mr, int32_t n, uint32_t len, TR::CodeGenerator *cg);

void accessStaticItem(TR::Node *node, TR::SymbolReference *ref, bool isStore, TR::CodeGenerator *cg);

void addToOffset(TR::Node * node, int64_t amount, TR::CodeGenerator *cg);
Expand Down

0 comments on commit 48c3e0b

Please sign in to comment.