mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-11 06:38:20 +00:00
- Fix asmparser and bytecode reader to not generate loads/stores with idxs
Now an obnoxious warning is emitted to discourage usage. Eventually support will be removed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3435 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -43,6 +43,14 @@ string CurFilename;
|
|||||||
|
|
||||||
#define YYERROR_VERBOSE 1
|
#define YYERROR_VERBOSE 1
|
||||||
|
|
||||||
|
// HACK ALERT: This variable is used to implement the automatic conversion of
|
||||||
|
// load/store instructions with indexes into a load/store + getelementptr pair
|
||||||
|
// of instructions. When this compatiblity "Feature" is removed, this should be
|
||||||
|
// too.
|
||||||
|
//
|
||||||
|
static BasicBlock *CurBB;
|
||||||
|
|
||||||
|
|
||||||
// This contains info used when building the body of a function. It is
|
// This contains info used when building the body of a function. It is
|
||||||
// destroyed when the function is completed.
|
// destroyed when the function is completed.
|
||||||
//
|
//
|
||||||
@ -1366,7 +1374,7 @@ InstructionList : InstructionList Inst {
|
|||||||
$$ = $1;
|
$$ = $1;
|
||||||
}
|
}
|
||||||
| /* empty */ {
|
| /* empty */ {
|
||||||
$$ = new BasicBlock();
|
$$ = CurBB = new BasicBlock();
|
||||||
};
|
};
|
||||||
|
|
||||||
BBTerminatorInst : RET ResolvedVal { // Return with a result...
|
BBTerminatorInst : RET ResolvedVal { // Return with a result...
|
||||||
@ -1633,7 +1641,19 @@ MemoryInst : MALLOC Types {
|
|||||||
if (LoadInst::getIndexedType(*$2, *$4) == 0)
|
if (LoadInst::getIndexedType(*$2, *$4) == 0)
|
||||||
ThrowException("Invalid indices for load instruction!");
|
ThrowException("Invalid indices for load instruction!");
|
||||||
|
|
||||||
$$ = new LoadInst(getVal(*$2, $3), *$4);
|
Value *Src = getVal(*$2, $3);
|
||||||
|
if (!$4->empty()) {
|
||||||
|
std::cerr << "WARNING: Use of index load instruction:"
|
||||||
|
<< " replacing with getelementptr/load pair.\n";
|
||||||
|
// Create a getelementptr hack instruction to do the right thing for
|
||||||
|
// compatibility.
|
||||||
|
//
|
||||||
|
Instruction *I = new GetElementPtrInst(Src, *$4);
|
||||||
|
CurBB->getInstList().push_back(I);
|
||||||
|
Src = I;
|
||||||
|
}
|
||||||
|
|
||||||
|
$$ = new LoadInst(Src);
|
||||||
delete $4; // Free the vector...
|
delete $4; // Free the vector...
|
||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
@ -1647,7 +1667,20 @@ MemoryInst : MALLOC Types {
|
|||||||
if (ElTy != $2->getType())
|
if (ElTy != $2->getType())
|
||||||
ThrowException("Can't store '" + $2->getType()->getDescription() +
|
ThrowException("Can't store '" + $2->getType()->getDescription() +
|
||||||
"' into space of type '" + ElTy->getDescription() + "'!");
|
"' into space of type '" + ElTy->getDescription() + "'!");
|
||||||
$$ = new StoreInst($2, getVal(*$4, $5), *$6);
|
|
||||||
|
Value *Ptr = getVal(*$4, $5);
|
||||||
|
if (!$6->empty()) {
|
||||||
|
std::cerr << "WARNING: Use of index store instruction:"
|
||||||
|
<< " replacing with getelementptr/store pair.\n";
|
||||||
|
// Create a getelementptr hack instruction to do the right thing for
|
||||||
|
// compatibility.
|
||||||
|
//
|
||||||
|
Instruction *I = new GetElementPtrInst(Ptr, *$6);
|
||||||
|
CurBB->getInstList().push_back(I);
|
||||||
|
Ptr = I;
|
||||||
|
}
|
||||||
|
|
||||||
|
$$ = new StoreInst($2, Ptr);
|
||||||
delete $4; delete $6;
|
delete $4; delete $6;
|
||||||
}
|
}
|
||||||
| GETELEMENTPTR Types ValueRef IndexList {
|
| GETELEMENTPTR Types ValueRef IndexList {
|
||||||
|
Reference in New Issue
Block a user