There is a generic Label that can be used as-is for ARM
and MIPS, and there is an x86 derived class Label which
adds the concept of near and far (for 8-bit vs 32-bit
jumps). Previously, one method "getOrCreateCfgNodeLabel"
would say that it returns a Label when it means the generic
one in some cases and the x86 one in other cases.
Split that into getCfgNodeLabel and getOrCreateCfgNodeLabel
where getCfgNodeLabel returns the generic one and
getOrCreateCfgNodeLabel is part of the x86 code and
returns the x86 one.
BUG=none
R=ascull@google.com, stichnot@chromium.org
Review URL: https://codereview.chromium.org/
1265023003 .
virtual llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const = 0;
/// Get the label for a CfgNode.
- virtual Label *getOrCreateCfgNodeLabel(SizeT NodeNumber) = 0;
+ virtual Label *getCfgNodeLabel(SizeT NodeNumber) = 0;
/// Mark the current text location as the start of a CFG node
/// (represented by NodeNumber).
virtual void bindCfgNodeLabel(SizeT NodeNumber) = 0;
llvm_unreachable("Not yet implemented.");
}
- Label *getOrCreateCfgNodeLabel(SizeT NodeNumber) override {
+ Ice::Label *getCfgNodeLabel(SizeT NodeNumber) override {
(void)NodeNumber;
llvm_unreachable("Not yet implemented.");
}
llvm::report_fatal_error("Not yet implemented.");
}
- Label *getOrCreateCfgNodeLabel(SizeT NodeNumber) override {
+ Ice::Label *getCfgNodeLabel(SizeT NodeNumber) override {
(void)NodeNumber;
llvm_unreachable("Not yet implemented.");
}
namespace X8632 {
using Immediate = ::Ice::X86Internal::Immediate;
+using Label = ::Ice::X86Internal::Label;
class AssemblerX8632 : public X86Internal::AssemblerX86Base<TargetX8632> {
AssemblerX8632(const AssemblerX8632 &) = delete;
nop(Padding);
}
- Label *getOrCreateCfgNodeLabel(SizeT NodeNumber) override;
+ Ice::Label *getCfgNodeLabel(SizeT NodeNumber) override;
void bindCfgNodeLabel(SizeT NodeNumber) override;
+ Label *getOrCreateCfgNodeLabel(SizeT Number);
Label *getOrCreateLocalLabel(SizeT Number);
void bindLocalLabel(SizeT Number);
}
template <class Machine>
+Ice::Label *AssemblerX86Base<Machine>::getCfgNodeLabel(SizeT NodeNumber) {
+ assert(NodeNumber < CfgNodeLabels.size());
+ return CfgNodeLabels[NodeNumber];
+}
+
+template <class Machine>
Label *AssemblerX86Base<Machine>::getOrCreateCfgNodeLabel(SizeT NodeNumber) {
return getOrCreateLabel(NodeNumber, CfgNodeLabels);
}
Ctx->addJumpTable(MangledName, JumpTable->getId(), NumTargets);
for (SizeT I = 0; I < NumTargets; ++I) {
SizeT Index = JumpTable->getTarget(I)->getIndex();
- JT.pushTarget(
- getAssembler()->getOrCreateCfgNodeLabel(Index)->getPosition());
+ JT.pushTarget(getAssembler()->getCfgNodeLabel(Index)->getPosition());
}
}
} break;