mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-12 18:33:22 +00:00
Cleaned up my last check-in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4014 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
113ad893b9
commit
275801b2dd
@ -1018,73 +1018,13 @@ void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I,
|
|
||||||
User::op_iterator E) {
|
|
||||||
bool HasImplicitAddress = false;
|
|
||||||
// If accessing a global value with no indexing, avoid *(&GV) syndrome
|
|
||||||
if (GlobalValue *V = dyn_cast<GlobalValue>(Ptr)) {
|
|
||||||
HasImplicitAddress = true;
|
|
||||||
} else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Ptr)) {
|
|
||||||
HasImplicitAddress = true;
|
|
||||||
Ptr = CPR->getValue(); // Get to the global...
|
|
||||||
}
|
|
||||||
|
|
||||||
if (I == E) {
|
|
||||||
if (!HasImplicitAddress)
|
|
||||||
Out << "*"; // Implicit zero first argument: '*x' is equivalent to 'x[0]'
|
|
||||||
|
|
||||||
writeOperandInternal(Ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Constant *CI = dyn_cast<Constant>(I->get());
|
|
||||||
if (HasImplicitAddress && (!CI || !CI->isNullValue()))
|
|
||||||
Out << "(&";
|
|
||||||
|
|
||||||
writeOperandInternal(Ptr);
|
|
||||||
|
|
||||||
if (HasImplicitAddress && (!CI || !CI->isNullValue())) {
|
|
||||||
Out << ")";
|
|
||||||
HasImplicitAddress = false; // HIA is only true if we haven't addressed yet
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(!HasImplicitAddress || (CI && CI->isNullValue()) &&
|
|
||||||
"Can only have implicit address with direct accessing");
|
|
||||||
|
|
||||||
if (HasImplicitAddress) {
|
|
||||||
++I;
|
|
||||||
} else if (CI && CI->isNullValue() && I+1 != E) {
|
|
||||||
// Print out the -> operator if possible...
|
|
||||||
if ((*(I+1))->getType() == Type::UByteTy) {
|
|
||||||
Out << (HasImplicitAddress ? "." : "->");
|
|
||||||
Out << "field" << cast<ConstantUInt>(*(I+1))->getValue();
|
|
||||||
I += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; I != E; ++I)
|
|
||||||
if ((*I)->getType() == Type::LongTy) {
|
|
||||||
Out << "[";
|
|
||||||
writeOperand(*I);
|
|
||||||
Out << "]";
|
|
||||||
} else {
|
|
||||||
Out << ".field" << cast<ConstantUInt>(*I)->getValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void CWriter::visitLoadInst(LoadInst &I) {
|
void CWriter::visitLoadInst(LoadInst &I) {
|
||||||
//Out << "*";
|
//Out << "*";
|
||||||
writeOperand(I.getOperand(0));
|
writeOperand(I.getOperand(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWriter::visitStoreInst(StoreInst &I) {
|
void CWriter::visitStoreInst(StoreInst &I) {
|
||||||
//Out << "*";
|
Out << "*";
|
||||||
writeOperand(I.getPointerOperand());
|
writeOperand(I.getPointerOperand());
|
||||||
Out << " = ";
|
Out << " = ";
|
||||||
writeOperand(I.getOperand(0));
|
writeOperand(I.getOperand(0));
|
||||||
|
@ -1018,73 +1018,13 @@ void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I,
|
|
||||||
User::op_iterator E) {
|
|
||||||
bool HasImplicitAddress = false;
|
|
||||||
// If accessing a global value with no indexing, avoid *(&GV) syndrome
|
|
||||||
if (GlobalValue *V = dyn_cast<GlobalValue>(Ptr)) {
|
|
||||||
HasImplicitAddress = true;
|
|
||||||
} else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Ptr)) {
|
|
||||||
HasImplicitAddress = true;
|
|
||||||
Ptr = CPR->getValue(); // Get to the global...
|
|
||||||
}
|
|
||||||
|
|
||||||
if (I == E) {
|
|
||||||
if (!HasImplicitAddress)
|
|
||||||
Out << "*"; // Implicit zero first argument: '*x' is equivalent to 'x[0]'
|
|
||||||
|
|
||||||
writeOperandInternal(Ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Constant *CI = dyn_cast<Constant>(I->get());
|
|
||||||
if (HasImplicitAddress && (!CI || !CI->isNullValue()))
|
|
||||||
Out << "(&";
|
|
||||||
|
|
||||||
writeOperandInternal(Ptr);
|
|
||||||
|
|
||||||
if (HasImplicitAddress && (!CI || !CI->isNullValue())) {
|
|
||||||
Out << ")";
|
|
||||||
HasImplicitAddress = false; // HIA is only true if we haven't addressed yet
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(!HasImplicitAddress || (CI && CI->isNullValue()) &&
|
|
||||||
"Can only have implicit address with direct accessing");
|
|
||||||
|
|
||||||
if (HasImplicitAddress) {
|
|
||||||
++I;
|
|
||||||
} else if (CI && CI->isNullValue() && I+1 != E) {
|
|
||||||
// Print out the -> operator if possible...
|
|
||||||
if ((*(I+1))->getType() == Type::UByteTy) {
|
|
||||||
Out << (HasImplicitAddress ? "." : "->");
|
|
||||||
Out << "field" << cast<ConstantUInt>(*(I+1))->getValue();
|
|
||||||
I += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; I != E; ++I)
|
|
||||||
if ((*I)->getType() == Type::LongTy) {
|
|
||||||
Out << "[";
|
|
||||||
writeOperand(*I);
|
|
||||||
Out << "]";
|
|
||||||
} else {
|
|
||||||
Out << ".field" << cast<ConstantUInt>(*I)->getValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void CWriter::visitLoadInst(LoadInst &I) {
|
void CWriter::visitLoadInst(LoadInst &I) {
|
||||||
//Out << "*";
|
//Out << "*";
|
||||||
writeOperand(I.getOperand(0));
|
writeOperand(I.getOperand(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWriter::visitStoreInst(StoreInst &I) {
|
void CWriter::visitStoreInst(StoreInst &I) {
|
||||||
//Out << "*";
|
Out << "*";
|
||||||
writeOperand(I.getPointerOperand());
|
writeOperand(I.getPointerOperand());
|
||||||
Out << " = ";
|
Out << " = ";
|
||||||
writeOperand(I.getOperand(0));
|
writeOperand(I.getOperand(0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user