mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
implementing shifting of literal integers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21336 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b9266f880a
commit
577057faaa
@ -297,6 +297,20 @@ Init *BitsInit::resolveReferences(Record &R) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Init *IntInit::getBinaryOp(BinaryOp Op, Init *RHS) {
|
||||||
|
IntInit *RHSi = dynamic_cast<IntInit*>(RHS);
|
||||||
|
if (RHSi == 0) return 0;
|
||||||
|
|
||||||
|
int NewValue;
|
||||||
|
switch (Op) {
|
||||||
|
case SHL: NewValue = Value << RHSi->getValue(); break;
|
||||||
|
case SRA: NewValue = Value >> RHSi->getValue(); break;
|
||||||
|
case SRL: NewValue = (unsigned)Value >> (unsigned)RHSi->getValue(); break;
|
||||||
|
}
|
||||||
|
return new IntInit(NewValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Init *IntInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) {
|
Init *IntInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) {
|
||||||
BitsInit *BI = new BitsInit(Bits.size());
|
BitsInit *BI = new BitsInit(Bits.size());
|
||||||
|
|
||||||
|
@ -567,6 +567,8 @@ public:
|
|||||||
}
|
}
|
||||||
virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
|
virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
|
||||||
|
|
||||||
|
virtual Init *getBinaryOp(BinaryOp Op, Init *RHS);
|
||||||
|
|
||||||
virtual void print(std::ostream &OS) const { OS << Value; }
|
virtual void print(std::ostream &OS) const { OS << Value; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user