mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +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:
parent
c37fca1492
commit
0383cc4455
@ -43,6 +43,14 @@ string CurFilename;
|
||||
|
||||
#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
|
||||
// destroyed when the function is completed.
|
||||
//
|
||||
@ -1366,7 +1374,7 @@ InstructionList : InstructionList Inst {
|
||||
$$ = $1;
|
||||
}
|
||||
| /* empty */ {
|
||||
$$ = new BasicBlock();
|
||||
$$ = CurBB = new BasicBlock();
|
||||
};
|
||||
|
||||
BBTerminatorInst : RET ResolvedVal { // Return with a result...
|
||||
@ -1633,7 +1641,19 @@ MemoryInst : MALLOC Types {
|
||||
if (LoadInst::getIndexedType(*$2, *$4) == 0)
|
||||
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 $2;
|
||||
}
|
||||
@ -1647,7 +1667,20 @@ MemoryInst : MALLOC Types {
|
||||
if (ElTy != $2->getType())
|
||||
ThrowException("Can't store '" + $2->getType()->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;
|
||||
}
|
||||
| GETELEMENTPTR Types ValueRef IndexList {
|
||||
|
Loading…
x
Reference in New Issue
Block a user