mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Changed memory reference instructions to store the result as the implicit
type of the instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3fa0bc4408
commit
f0d0e9c262
@ -118,15 +118,7 @@ struct InstPlaceHolderHelper : public Instruction {
|
|||||||
InstPlaceHolderHelper(const Type *Ty) : Instruction(Ty, UserOp1, "") {}
|
InstPlaceHolderHelper(const Type *Ty) : Instruction(Ty, UserOp1, "") {}
|
||||||
|
|
||||||
virtual Instruction *clone() const { abort(); }
|
virtual Instruction *clone() const { abort(); }
|
||||||
|
|
||||||
inline virtual void dropAllReferences() {}
|
|
||||||
virtual string getOpcode() const { return "placeholder"; }
|
virtual string getOpcode() const { return "placeholder"; }
|
||||||
|
|
||||||
// No "operands"...
|
|
||||||
virtual Value *getOperand(unsigned i) { return 0; }
|
|
||||||
virtual const Value *getOperand(unsigned i) const { return 0; }
|
|
||||||
virtual bool setOperand(unsigned i, Value *Val) { return false; }
|
|
||||||
virtual unsigned getNumOperands() const { return 0; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BBPlaceHolderHelper : public BasicBlock {
|
struct BBPlaceHolderHelper : public BasicBlock {
|
||||||
|
@ -548,7 +548,7 @@ static const short yyrline[] = { 0,
|
|||||||
741, 744, 749, 753, 758, 762, 771, 776, 785, 789,
|
741, 744, 749, 753, 758, 762, 771, 776, 785, 789,
|
||||||
793, 796, 799, 802, 807, 818, 826, 836, 844, 849,
|
793, 796, 799, 802, 807, 818, 826, 836, 844, 849,
|
||||||
856, 860, 866, 866, 868, 873, 878, 889, 926, 930,
|
856, 860, 866, 866, 868, 873, 878, 889, 926, 930,
|
||||||
935, 945, 950, 960
|
935, 944, 949, 958
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1955,9 +1955,9 @@ case 119:
|
|||||||
case 120:
|
case 120:
|
||||||
#line 930 "llvmAsmParser.y"
|
#line 930 "llvmAsmParser.y"
|
||||||
{
|
{
|
||||||
ConstPoolVal *TyVal = new ConstPoolType(PointerType::getPointerType(yyvsp[0].TypeVal));
|
const Type *Ty = PointerType::getPointerType(yyvsp[0].TypeVal);
|
||||||
TyVal = addConstValToConstantPool(TyVal);
|
addConstValToConstantPool(new ConstPoolType(Ty));
|
||||||
yyval.InstVal = new MallocInst((ConstPoolType*)TyVal);
|
yyval.InstVal = new MallocInst(Ty);
|
||||||
;
|
;
|
||||||
break;}
|
break;}
|
||||||
case 121:
|
case 121:
|
||||||
@ -1966,36 +1966,34 @@ case 121:
|
|||||||
if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized())
|
if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized())
|
||||||
ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() +
|
ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() +
|
||||||
" as unsized array!");
|
" as unsized array!");
|
||||||
|
const Type *Ty = PointerType::getPointerType(yyvsp[-3].TypeVal);
|
||||||
|
addConstValToConstantPool(new ConstPoolType(Ty));
|
||||||
Value *ArrSize = getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
|
Value *ArrSize = getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
|
||||||
ConstPoolVal *TyVal = new ConstPoolType(PointerType::getPointerType(yyvsp[-3].TypeVal));
|
yyval.InstVal = new MallocInst(Ty, ArrSize);
|
||||||
TyVal = addConstValToConstantPool(TyVal);
|
|
||||||
yyval.InstVal = new MallocInst((ConstPoolType*)TyVal, ArrSize);
|
|
||||||
;
|
;
|
||||||
break;}
|
break;}
|
||||||
case 122:
|
case 122:
|
||||||
#line 945 "llvmAsmParser.y"
|
#line 944 "llvmAsmParser.y"
|
||||||
{
|
{
|
||||||
ConstPoolVal *TyVal = new ConstPoolType(PointerType::getPointerType(yyvsp[0].TypeVal));
|
const Type *Ty = PointerType::getPointerType(yyvsp[0].TypeVal);
|
||||||
TyVal = addConstValToConstantPool(TyVal);
|
addConstValToConstantPool(new ConstPoolType(Ty));
|
||||||
yyval.InstVal = new AllocaInst((ConstPoolType*)TyVal);
|
yyval.InstVal = new AllocaInst(Ty);
|
||||||
;
|
;
|
||||||
break;}
|
break;}
|
||||||
case 123:
|
case 123:
|
||||||
#line 950 "llvmAsmParser.y"
|
#line 949 "llvmAsmParser.y"
|
||||||
{
|
{
|
||||||
if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized())
|
if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized())
|
||||||
ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() +
|
ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() +
|
||||||
" as unsized array!");
|
" as unsized array!");
|
||||||
|
const Type *Ty = PointerType::getPointerType(yyvsp[-3].TypeVal);
|
||||||
|
addConstValToConstantPool(new ConstPoolType(Ty));
|
||||||
Value *ArrSize = getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
|
Value *ArrSize = getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
|
||||||
ConstPoolVal *TyVal = new ConstPoolType(PointerType::getPointerType(yyvsp[-3].TypeVal));
|
yyval.InstVal = new AllocaInst(Ty, ArrSize);
|
||||||
TyVal = addConstValToConstantPool(TyVal);
|
|
||||||
yyval.InstVal = new AllocaInst((ConstPoolType*)TyVal, ArrSize);
|
|
||||||
;
|
;
|
||||||
break;}
|
break;}
|
||||||
case 124:
|
case 124:
|
||||||
#line 960 "llvmAsmParser.y"
|
#line 958 "llvmAsmParser.y"
|
||||||
{
|
{
|
||||||
if (!yyvsp[-1].TypeVal->isPointerType())
|
if (!yyvsp[-1].TypeVal->isPointerType())
|
||||||
ThrowException("Trying to free nonpointer type " + yyvsp[-1].TypeVal->getName() + "!");
|
ThrowException("Trying to free nonpointer type " + yyvsp[-1].TypeVal->getName() + "!");
|
||||||
@ -2224,7 +2222,7 @@ yyerrhandle:
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#line 966 "llvmAsmParser.y"
|
#line 964 "llvmAsmParser.y"
|
||||||
|
|
||||||
int yyerror(char *ErrorMsg) {
|
int yyerror(char *ErrorMsg) {
|
||||||
ThrowException(string("Parse error: ") + ErrorMsg);
|
ThrowException(string("Parse error: ") + ErrorMsg);
|
||||||
|
@ -928,34 +928,32 @@ InstVal : BinaryOps Types ValueRef ',' ValueRef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MemoryInst : MALLOC Types {
|
MemoryInst : MALLOC Types {
|
||||||
ConstPoolVal *TyVal = new ConstPoolType(PointerType::getPointerType($2));
|
const Type *Ty = PointerType::getPointerType($2);
|
||||||
TyVal = addConstValToConstantPool(TyVal);
|
addConstValToConstantPool(new ConstPoolType(Ty));
|
||||||
$$ = new MallocInst((ConstPoolType*)TyVal);
|
$$ = new MallocInst(Ty);
|
||||||
}
|
}
|
||||||
| MALLOC Types ',' UINT ValueRef {
|
| MALLOC Types ',' UINT ValueRef {
|
||||||
if (!$2->isArrayType() || ((const ArrayType*)$2)->isSized())
|
if (!$2->isArrayType() || ((const ArrayType*)$2)->isSized())
|
||||||
ThrowException("Trying to allocate " + $2->getName() +
|
ThrowException("Trying to allocate " + $2->getName() +
|
||||||
" as unsized array!");
|
" as unsized array!");
|
||||||
|
const Type *Ty = PointerType::getPointerType($2);
|
||||||
|
addConstValToConstantPool(new ConstPoolType(Ty));
|
||||||
Value *ArrSize = getVal($4, $5);
|
Value *ArrSize = getVal($4, $5);
|
||||||
ConstPoolVal *TyVal = new ConstPoolType(PointerType::getPointerType($2));
|
$$ = new MallocInst(Ty, ArrSize);
|
||||||
TyVal = addConstValToConstantPool(TyVal);
|
|
||||||
$$ = new MallocInst((ConstPoolType*)TyVal, ArrSize);
|
|
||||||
}
|
}
|
||||||
| ALLOCA Types {
|
| ALLOCA Types {
|
||||||
ConstPoolVal *TyVal = new ConstPoolType(PointerType::getPointerType($2));
|
const Type *Ty = PointerType::getPointerType($2);
|
||||||
TyVal = addConstValToConstantPool(TyVal);
|
addConstValToConstantPool(new ConstPoolType(Ty));
|
||||||
$$ = new AllocaInst((ConstPoolType*)TyVal);
|
$$ = new AllocaInst(Ty);
|
||||||
}
|
}
|
||||||
| ALLOCA Types ',' UINT ValueRef {
|
| ALLOCA Types ',' UINT ValueRef {
|
||||||
if (!$2->isArrayType() || ((const ArrayType*)$2)->isSized())
|
if (!$2->isArrayType() || ((const ArrayType*)$2)->isSized())
|
||||||
ThrowException("Trying to allocate " + $2->getName() +
|
ThrowException("Trying to allocate " + $2->getName() +
|
||||||
" as unsized array!");
|
" as unsized array!");
|
||||||
|
const Type *Ty = PointerType::getPointerType($2);
|
||||||
|
addConstValToConstantPool(new ConstPoolType(Ty));
|
||||||
Value *ArrSize = getVal($4, $5);
|
Value *ArrSize = getVal($4, $5);
|
||||||
ConstPoolVal *TyVal = new ConstPoolType(PointerType::getPointerType($2));
|
$$ = new AllocaInst(Ty, ArrSize);
|
||||||
TyVal = addConstValToConstantPool(TyVal);
|
|
||||||
$$ = new AllocaInst((ConstPoolType*)TyVal, ArrSize);
|
|
||||||
}
|
}
|
||||||
| FREE Types ValueRef {
|
| FREE Types ValueRef {
|
||||||
if (!$2->isPointerType())
|
if (!$2->isPointerType())
|
||||||
|
Loading…
Reference in New Issue
Block a user