mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-18 11:24:01 +00:00
Initial implementation of 'fence' instruction, the new C++0x-style replacement for llvm.memory.barrier.
This is just a LangRef entry and reading/writing/memory representation; optimizer+codegen support coming soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136009 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -131,6 +131,27 @@ static int GetDecodedBinaryOpcode(unsigned Val, Type *Ty) {
|
||||
}
|
||||
}
|
||||
|
||||
static AtomicOrdering GetDecodedOrdering(unsigned Val) {
|
||||
switch (Val) {
|
||||
case bitc::ORDERING_NOTATOMIC: return NotAtomic;
|
||||
case bitc::ORDERING_UNORDERED: return Unordered;
|
||||
case bitc::ORDERING_MONOTONIC: return Monotonic;
|
||||
case bitc::ORDERING_ACQUIRE: return Acquire;
|
||||
case bitc::ORDERING_RELEASE: return Release;
|
||||
case bitc::ORDERING_ACQREL: return AcquireRelease;
|
||||
default: // Map unknown orderings to sequentially-consistent.
|
||||
case bitc::ORDERING_SEQCST: return SequentiallyConsistent;
|
||||
}
|
||||
}
|
||||
|
||||
static SynchronizationScope GetDecodedSynchScope(unsigned Val) {
|
||||
switch (Val) {
|
||||
case bitc::SYNCHSCOPE_SINGLETHREAD: return SingleThread;
|
||||
default: // Map unknown scopes to cross-thread.
|
||||
case bitc::SYNCHSCOPE_CROSSTHREAD: return CrossThread;
|
||||
}
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
namespace {
|
||||
/// @brief A class for maintaining the slot number definition
|
||||
@ -2534,6 +2555,18 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
InstructionList.push_back(I);
|
||||
break;
|
||||
}
|
||||
case bitc::FUNC_CODE_INST_FENCE: { // FENCE:[ordering, synchscope]
|
||||
if (2 != Record.size())
|
||||
return Error("Invalid FENCE record");
|
||||
AtomicOrdering Ordering = GetDecodedOrdering(Record[0]);
|
||||
if (Ordering == NotAtomic || Ordering == Unordered ||
|
||||
Ordering == Monotonic)
|
||||
return Error("Invalid FENCE record");
|
||||
SynchronizationScope SynchScope = GetDecodedSynchScope(Record[1]);
|
||||
I = new FenceInst(Context, Ordering, SynchScope);
|
||||
InstructionList.push_back(I);
|
||||
break;
|
||||
}
|
||||
case bitc::FUNC_CODE_INST_CALL: {
|
||||
// CALL: [paramattrs, cc, fnty, fnid, arg0, arg1...]
|
||||
if (Record.size() < 3)
|
||||
|
Reference in New Issue
Block a user