summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2015-03-03 22:01:13 +0000
committerMehdi Amini <mehdi.amini@apple.com>2015-03-03 22:01:13 +0000
commit9a9738f6e5ecbd45bb2bc105d37570f045717152 (patch)
tree607649fe7f2d6f54383c72f31b0b4648c7cca6e7 /llvm/lib/IR
parent1dbe2e3dc4368a1985decfb180bd8e7290cd9f8e (diff)
downloadbcm5719-llvm-9a9738f6e5ecbd45bb2bc105d37570f045717152.tar.gz
bcm5719-llvm-9a9738f6e5ecbd45bb2bc105d37570f045717152.zip
Remove getDataLayout() from Instruction/GlobalValue/BasicBlock/Function
Summary: This does not conceptually belongs here. Instead provide a shortcut getModule() that provides access to the DataLayout. Reviewers: chandlerc, echristo Reviewed By: echristo Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8027 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 231147
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/BasicBlock.cpp7
-rw-r--r--llvm/lib/IR/Globals.cpp4
-rw-r--r--llvm/lib/IR/Instruction.cpp8
3 files changed, 7 insertions, 12 deletions
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index eac7d3afbe5..fe38385d341 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -29,10 +29,6 @@ ValueSymbolTable *BasicBlock::getValueSymbolTable() {
return nullptr;
}
-const DataLayout *BasicBlock::getDataLayout() const {
- return getParent()->getDataLayout();
-}
-
LLVMContext &BasicBlock::getContext() const {
return getType()->getContext();
}
@@ -117,6 +113,9 @@ void BasicBlock::moveAfter(BasicBlock *MovePos) {
getParent()->getBasicBlockList(), this);
}
+const Module *BasicBlock::getModule() const {
+ return getParent()->getParent();
+}
TerminatorInst *BasicBlock::getTerminator() {
if (InstList.empty()) return nullptr;
diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp
index 54197d96763..5a6adb3f304 100644
--- a/llvm/lib/IR/Globals.cpp
+++ b/llvm/lib/IR/Globals.cpp
@@ -42,10 +42,6 @@ void GlobalValue::Dematerialize() {
getParent()->Dematerialize(this);
}
-const DataLayout *GlobalValue::getDataLayout() const {
- return getParent()->getDataLayout();
-}
-
/// Override destroyConstant to make sure it doesn't get called on
/// GlobalValue's because they shouldn't be treated like other constants.
void GlobalValue::destroyConstant() {
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 92c6e9f3ded..7d9bd7ed5ff 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -32,10 +32,6 @@ Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
}
}
-const DataLayout *Instruction::getDataLayout() const {
- return getParent()->getDataLayout();
-}
-
Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
BasicBlock *InsertAtEnd)
: User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(nullptr) {
@@ -58,6 +54,10 @@ void Instruction::setParent(BasicBlock *P) {
Parent = P;
}
+const Module *Instruction::getModule() const {
+ return getParent()->getModule();
+}
+
void Instruction::removeFromParent() {
getParent()->getInstList().remove(this);
}
OpenPOWER on IntegriCloud