mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Ignore TargetConstant with an illegal type. These
are used for passing huge immediates in inline ASM from the front-end straight down to the ASM writer. Of course this is a hack, but it is simple, limited in scope, works in practice, and is what LegalizeDAG does. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53553 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
43d526d162
commit
d164ea2fb0
@ -60,11 +60,12 @@ void DAGTypeLegalizer::run() {
|
|||||||
assert(N->getNodeId() == ReadyToProcess &&
|
assert(N->getNodeId() == ReadyToProcess &&
|
||||||
"Node should be ready if on worklist!");
|
"Node should be ready if on worklist!");
|
||||||
|
|
||||||
|
if (IgnoreNodeResults(N))
|
||||||
|
goto ScanOperands;
|
||||||
|
|
||||||
// Scan the values produced by the node, checking to see if any result
|
// Scan the values produced by the node, checking to see if any result
|
||||||
// types are illegal.
|
// types are illegal.
|
||||||
unsigned i = 0;
|
for (unsigned i = 0, NumResults = N->getNumValues(); i < NumResults; ++i) {
|
||||||
unsigned NumResults = N->getNumValues();
|
|
||||||
do {
|
|
||||||
MVT ResultVT = N->getValueType(i);
|
MVT ResultVT = N->getValueType(i);
|
||||||
switch (getTypeAction(ResultVT)) {
|
switch (getTypeAction(ResultVT)) {
|
||||||
default:
|
default:
|
||||||
@ -90,14 +91,19 @@ void DAGTypeLegalizer::run() {
|
|||||||
SplitVectorResult(N, i);
|
SplitVectorResult(N, i);
|
||||||
goto NodeDone;
|
goto NodeDone;
|
||||||
}
|
}
|
||||||
} while (++i < NumResults);
|
}
|
||||||
|
|
||||||
|
ScanOperands:
|
||||||
// Scan the operand list for the node, handling any nodes with operands that
|
// Scan the operand list for the node, handling any nodes with operands that
|
||||||
// are illegal.
|
// are illegal.
|
||||||
{
|
{
|
||||||
unsigned NumOperands = N->getNumOperands();
|
unsigned NumOperands = N->getNumOperands();
|
||||||
bool NeedsRevisit = false;
|
bool NeedsRevisit = false;
|
||||||
|
unsigned i;
|
||||||
for (i = 0; i != NumOperands; ++i) {
|
for (i = 0; i != NumOperands; ++i) {
|
||||||
|
if (IgnoreNodeResults(N->getOperand(i).Val))
|
||||||
|
continue;
|
||||||
|
|
||||||
MVT OpVT = N->getOperand(i).getValueType();
|
MVT OpVT = N->getOperand(i).getValueType();
|
||||||
switch (getTypeAction(OpVT)) {
|
switch (getTypeAction(OpVT)) {
|
||||||
default:
|
default:
|
||||||
@ -187,15 +193,17 @@ NodeDone:
|
|||||||
bool Failed = false;
|
bool Failed = false;
|
||||||
|
|
||||||
// Check that all result types are legal.
|
// Check that all result types are legal.
|
||||||
for (unsigned i = 0, NumVals = I->getNumValues(); i < NumVals; ++i)
|
if (!IgnoreNodeResults(I))
|
||||||
if (!isTypeLegal(I->getValueType(i))) {
|
for (unsigned i = 0, NumVals = I->getNumValues(); i < NumVals; ++i)
|
||||||
cerr << "Result type " << i << " illegal!\n";
|
if (!isTypeLegal(I->getValueType(i))) {
|
||||||
Failed = true;
|
cerr << "Result type " << i << " illegal!\n";
|
||||||
}
|
Failed = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Check that all operand types are legal.
|
// Check that all operand types are legal.
|
||||||
for (unsigned i = 0, NumOps = I->getNumOperands(); i < NumOps; ++i)
|
for (unsigned i = 0, NumOps = I->getNumOperands(); i < NumOps; ++i)
|
||||||
if (!isTypeLegal(I->getOperand(i).getValueType())) {
|
if (!IgnoreNodeResults(I->getOperand(i).Val) &&
|
||||||
|
!isTypeLegal(I->getOperand(i).getValueType())) {
|
||||||
cerr << "Operand type " << i << " illegal!\n";
|
cerr << "Operand type " << i << " illegal!\n";
|
||||||
Failed = true;
|
Failed = true;
|
||||||
}
|
}
|
||||||
|
@ -105,6 +105,11 @@ private:
|
|||||||
return ValueTypeActions.getTypeAction(VT) == TargetLowering::Legal;
|
return ValueTypeActions.getTypeAction(VT) == TargetLowering::Legal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// IgnoreNodeResults - Pretend all of this node's results are legal.
|
||||||
|
bool IgnoreNodeResults(SDNode *N) const {
|
||||||
|
return N->getOpcode() == ISD::TargetConstant;
|
||||||
|
}
|
||||||
|
|
||||||
/// PromotedIntegers - For integer nodes that are below legal width, this map
|
/// PromotedIntegers - For integer nodes that are below legal width, this map
|
||||||
/// indicates what promoted value to use.
|
/// indicates what promoted value to use.
|
||||||
DenseMap<SDOperand, SDOperand> PromotedIntegers;
|
DenseMap<SDOperand, SDOperand> PromotedIntegers;
|
||||||
|
Loading…
Reference in New Issue
Block a user