mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
Emit type-correct constant null. Also fix a typo.
Patch by Robert G. Jakabosky! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57110 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6381a1334a
commit
ff4ca2e088
@ -722,16 +722,12 @@ namespace {
|
||||
|
||||
std::string constName(getCppName(CV));
|
||||
std::string typeName(getCppName(CV->getType()));
|
||||
if (CV->isNullValue()) {
|
||||
Out << "Constant* " << constName << " = Constant::getNullValue("
|
||||
<< typeName << ");";
|
||||
nl(Out);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isa<GlobalValue>(CV)) {
|
||||
// Skip variables and functions, we emit them elsewhere
|
||||
return;
|
||||
}
|
||||
|
||||
if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
|
||||
std::string constValue = CI->getValue().toString(10, true);
|
||||
Out << "ConstantInt* " << constName << " = ConstantInt::get(APInt("
|
||||
@ -742,7 +738,7 @@ namespace {
|
||||
<< " = ConstantAggregateZero::get(" << typeName << ");";
|
||||
} else if (isa<ConstantPointerNull>(CV)) {
|
||||
Out << "ConstantPointerNull* " << constName
|
||||
<< " = ConstanPointerNull::get(" << typeName << ");";
|
||||
<< " = ConstantPointerNull::get(" << typeName << ");";
|
||||
} else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV)) {
|
||||
Out << "ConstantFP* " << constName << " = ";
|
||||
printCFP(CFP);
|
||||
|
Loading…
Reference in New Issue
Block a user