Initial checkin of Module cloning support stuff

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4788 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-11-20 20:47:41 +00:00
parent d4fd397805
commit 51cbcbf435
4 changed files with 179 additions and 4 deletions

View File

@@ -10,6 +10,7 @@
#include "llvm/iTerminators.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
#include "ValueMapper.h"
// RemapInstruction - Convert the instruction operands from referencing the
// current values into those specified by ValueMap.
@@ -18,10 +19,7 @@ static inline void RemapInstruction(Instruction *I,
std::map<const Value *, Value*> &ValueMap) {
for (unsigned op = 0, E = I->getNumOperands(); op != E; ++op) {
const Value *Op = I->getOperand(op);
Value *V = ValueMap[Op];
if (!V && (isa<GlobalValue>(Op) || isa<Constant>(Op)))
continue; // Globals and constants don't get relocated
Value *V = MapValue(Op, ValueMap);
#ifndef NDEBUG
if (!V) {
std::cerr << "Val = \n" << Op << "Addr = " << (void*)Op;