mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
make the casts actually cast to the variable type
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25765 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5c6bdf71d4
commit
2cba57cb09
@ -2069,18 +2069,21 @@ public:
|
|||||||
unsigned ResNo = TmpNo++;
|
unsigned ResNo = TmpNo++;
|
||||||
unsigned NumRes = 1;
|
unsigned NumRes = 1;
|
||||||
if (!N->isLeaf() && N->getOperator()->getName() == "imm") {
|
if (!N->isLeaf() && N->getOperator()->getName() == "imm") {
|
||||||
|
const char* CastType;
|
||||||
assert(N->getExtTypes().size() == 1 && "Multiple types not handled!");
|
assert(N->getExtTypes().size() == 1 && "Multiple types not handled!");
|
||||||
const char *Code;
|
const char *Code;
|
||||||
switch (N->getTypeNum(0)) {
|
switch (N->getTypeNum(0)) {
|
||||||
default: assert(0 && "Unknown type for constant node!");
|
default: assert(0 && "Unknown type for constant node!");
|
||||||
case MVT::i1: Code = "bool Tmp"; break;
|
case MVT::i1: CastType = "bool"; Code = "bool Tmp"; break;
|
||||||
case MVT::i8: Code = "unsigned char Tmp"; break;
|
case MVT::i8:
|
||||||
case MVT::i16: Code = "unsigned short Tmp"; break;
|
CastType = "unsigned char"; Code = "unsigned char Tmp"; break;
|
||||||
case MVT::i32: Code = "unsigned Tmp"; break;
|
case MVT::i16:
|
||||||
case MVT::i64: Code = "uint64_t Tmp"; break;
|
CastType = "unsigned short"; Code = "unsigned short Tmp"; break;
|
||||||
|
case MVT::i32: CastType = "unsigned"; Code = "unsigned Tmp"; break;
|
||||||
|
case MVT::i64: CastType = "uint64_t"; Code = "uint64_t Tmp"; break;
|
||||||
}
|
}
|
||||||
emitCode(Code + utostr(ResNo) + "C = (uint64_t)cast<ConstantSDNode>(" +
|
emitCode(Code + utostr(ResNo) + "C = (" + CastType +
|
||||||
Val + ")->getValue();");
|
")cast<ConstantSDNode>(" + Val + ")->getValue();");
|
||||||
emitCode("SDOperand Tmp" + utostr(ResNo) +
|
emitCode("SDOperand Tmp" + utostr(ResNo) +
|
||||||
" = CurDAG->getTargetConstant(Tmp" + utostr(ResNo) +
|
" = CurDAG->getTargetConstant(Tmp" + utostr(ResNo) +
|
||||||
"C, MVT::" + getEnumName(N->getTypeNum(0)) + ");");
|
"C, MVT::" + getEnumName(N->getTypeNum(0)) + ");");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user