ARMAsmPrinter::ARMAsmPrinter(TargetMachine &TM,
std::unique_ptr<MCStreamer> Streamer)
: AsmPrinter(TM, std::move(Streamer)), AFI(nullptr), MCP(nullptr),
- InConstantPool(false), OptimizationGoals(-1) {}
+ InConstantPool(false) {}
void ARMAsmPrinter::EmitFunctionBodyEnd() {
// Make sure to terminate any constant pools that were at the end
Subtarget = &MF.getSubtarget<ARMSubtarget>();
SetupMachineFunction(MF);
- const Function* F = MF.getFunction();
- const TargetMachine& TM = MF.getTarget();
-
- // Calculate this function's optimization goal.
- unsigned OptimizationGoal;
- if (F->hasFnAttribute(Attribute::OptimizeNone))
- // For best debugging illusion, speed and small size sacrificed
- OptimizationGoal = 6;
- else if (F->optForMinSize())
- // Aggressively for small size, speed and debug illusion sacrificed
- OptimizationGoal = 4;
- else if (F->optForSize())
- // For small size, but speed and debugging illusion preserved
- OptimizationGoal = 3;
- else if (TM.getOptLevel() == CodeGenOpt::Aggressive)
- // Aggressively for speed, small size and debug illusion sacrificed
- OptimizationGoal = 2;
- else if (TM.getOptLevel() > CodeGenOpt::None)
- // For speed, but small size and good debug illusion preserved
- OptimizationGoal = 1;
- else // TM.getOptLevel() == CodeGenOpt::None
- // For good debugging, but speed and small size preserved
- OptimizationGoal = 5;
-
- // Combine a new optimization goal with existing ones.
- if (OptimizationGoals == -1) // uninitialized goals
- OptimizationGoals = OptimizationGoal;
- else if (OptimizationGoals != (int)OptimizationGoal) // conflicting goals
- OptimizationGoals = 0;
if (Subtarget->isTargetCOFF()) {
- bool Internal = F->hasInternalLinkage();
+ bool Internal = MF.getFunction()->hasInternalLinkage();
COFF::SymbolStorageClass Scl = Internal ? COFF::IMAGE_SYM_CLASS_STATIC
: COFF::IMAGE_SYM_CLASS_EXTERNAL;
int Type = COFF::IMAGE_SYM_DTYPE_FUNCTION << COFF::SCT_COMPLEX_TYPE_SHIFT;
// generates code that does this, it is always safe to set.
OutStreamer->EmitAssemblerFlag(MCAF_SubsectionsViaSymbols);
}
-
- // The last attribute to be emitted is ABI_optimization_goals
- MCTargetStreamer &TS = *OutStreamer->getTargetStreamer();
- ARMTargetStreamer &ATS = static_cast<ARMTargetStreamer &>(TS);
-
- if (OptimizationGoals > 0)
- ATS.emitAttribute(ARMBuildAttrs::ABI_optimization_goals, OptimizationGoals);
- OptimizationGoals = -1;
-
- ATS.finishAttributeSection();
}
//===----------------------------------------------------------------------===//
else if (STI.hasVirtualization())
ATS.emitAttribute(ARMBuildAttrs::Virtualization_use,
ARMBuildAttrs::AllowVirtualization);
+
+ ATS.finishAttributeSection();
}
//===----------------------------------------------------------------------===//