mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-12 01:25:10 +00:00
handle function-level forward references, read binops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36620 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -51,6 +51,22 @@ public:
|
||||
virtual void print(std::ostream&) const {}
|
||||
|
||||
Constant *getConstantFwdRef(unsigned Idx, const Type *Ty);
|
||||
Value *getValueFwdRef(unsigned Idx, const Type *Ty);
|
||||
|
||||
void AssignValue(Value *V, unsigned Idx) {
|
||||
if (Idx == size()) {
|
||||
push_back(V);
|
||||
} else if (Value *OldV = getOperand(Idx)) {
|
||||
// If there was a forward reference to this value, replace it.
|
||||
setOperand(Idx, V);
|
||||
OldV->replaceAllUsesWith(V);
|
||||
delete OldV;
|
||||
} else {
|
||||
initVal(Idx, V);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void initVal(unsigned Idx, Value *V) {
|
||||
assert(Uses[Idx] == 0 && "Cannot init an already init'd Use!");
|
||||
Uses[Idx].init(V, this);
|
||||
@@ -113,6 +129,9 @@ public:
|
||||
bool ParseBitcode();
|
||||
private:
|
||||
const Type *getTypeByID(unsigned ID, bool isTypeTable = false);
|
||||
Value *getFnValueByID(unsigned ID, const Type *Ty) {
|
||||
return ValueList.getValueFwdRef(ID, Ty);
|
||||
}
|
||||
|
||||
bool ParseModule(const std::string &ModuleID);
|
||||
bool ParseTypeTable();
|
||||
|
Reference in New Issue
Block a user