Eliminate the instruction placeholder. Simplify a bunch of code.
This results in no significant speedup, but does provide simpler code llvm-svn: 8980
This commit is contained in:
parent
42dce1e365
commit
1e8addf890
|
|
@ -134,7 +134,7 @@ Value *BytecodeParser::getValue(unsigned type, unsigned oNum, bool Create) {
|
||||||
if (I != ForwardReferences.end() && I->first == KeyValue)
|
if (I != ForwardReferences.end() && I->first == KeyValue)
|
||||||
return I->second; // We have already created this placeholder
|
return I->second; // We have already created this placeholder
|
||||||
|
|
||||||
Value *Val = new ValPHolder(getType(type), oNum);
|
Value *Val = new Argument(getType(type));
|
||||||
ForwardReferences.insert(I, std::make_pair(KeyValue, Val));
|
ForwardReferences.insert(I, std::make_pair(KeyValue, Val));
|
||||||
return Val;
|
return Val;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -203,20 +203,12 @@ public:
|
||||||
unsigned getID() { return ID; }
|
unsigned getID() { return ID; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct InstPlaceHolderHelper : public Instruction {
|
|
||||||
InstPlaceHolderHelper(const Type *Ty) : Instruction(Ty, UserOp1, "") {}
|
|
||||||
virtual const char *getOpcodeName() const { return "placeholder"; }
|
|
||||||
|
|
||||||
virtual Instruction *clone() const { abort(); return 0; }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ConstantPlaceHolderHelper : public Constant {
|
struct ConstantPlaceHolderHelper : public Constant {
|
||||||
ConstantPlaceHolderHelper(const Type *Ty)
|
ConstantPlaceHolderHelper(const Type *Ty)
|
||||||
: Constant(Ty) {}
|
: Constant(Ty) {}
|
||||||
virtual bool isNullValue() const { return false; }
|
virtual bool isNullValue() const { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef PlaceholderDef<InstPlaceHolderHelper> ValPHolder;
|
|
||||||
typedef PlaceholderDef<ConstantPlaceHolderHelper> ConstPHolder;
|
typedef PlaceholderDef<ConstantPlaceHolderHelper> ConstPHolder;
|
||||||
|
|
||||||
// Some common errors we find
|
// Some common errors we find
|
||||||
|
|
@ -225,12 +217,6 @@ static const std::string Error_read = "read(): error reading.";
|
||||||
static const std::string Error_inputdata = "input_data(): error reading.";
|
static const std::string Error_inputdata = "input_data(): error reading.";
|
||||||
static const std::string Error_DestSlot = "No destination slot found.";
|
static const std::string Error_DestSlot = "No destination slot found.";
|
||||||
|
|
||||||
static inline unsigned getValueIDNumberFromPlaceHolder(Value *Val) {
|
|
||||||
if (isa<Constant>(Val))
|
|
||||||
return ((ConstPHolder*)Val)->getID();
|
|
||||||
return ((ValPHolder*)Val)->getID();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void readBlock(const unsigned char *&Buf,
|
static inline void readBlock(const unsigned char *&Buf,
|
||||||
const unsigned char *EndBuf,
|
const unsigned char *EndBuf,
|
||||||
unsigned &Type, unsigned &Size) {
|
unsigned &Type, unsigned &Size) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue