[PATCH] Adding skeleton for unit testing Hexagon Code Emission
Chad Rosier
mcrosier at codeaurora.org
Mon Sep 29 14:02:00 PDT 2014
Once the comments are address, I believe this is in good enough shape. Please upload a revised patch and I'll approve.
================
Comment at: lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp:10
@@ +9,3 @@
+
+#define DEBUG_TYPE "mccodeemitter"
+
----------------
IIRC, I believe this should be added after the #includes.
================
Comment at: lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp:41
@@ +40,3 @@
+ unsigned PacketBits;
+ if (HMI.isPacketEnd())
+ PacketBits = static_cast<uint32_t>(ParseField::end) << ParseFieldOffset;
----------------
How about something like this?
ParseField Field = HMI.isPacketEnd() ? ParseField::end : ParseField::last0;
return static_cast<uint32_t>(Field) << ParseFieldOffset;
================
Comment at: unittests/CMakeLists.txt:26
@@ -25,2 +25,3 @@
add_subdirectory(Support)
+add_subdirectory(Target)
add_subdirectory(Transforms)
----------------
Would this be better in
unittests/MC/Target
or
unittests/MC/Hexagon (I prefer)
?
The latter suggestion is more inline with how test/MC/Hexagon and test/CodeGen/Hexagon are laid out.
================
Comment at: unittests/Target/Hexagon/HexagonMCCodeEmitterTest.cpp:23
@@ +22,3 @@
+ Target = llvm::TargetRegistry::lookupTarget("hexagon", error);
+ assert(Target != nullptr);
+ assert(error.empty());
----------------
assert(Target && "Expected to find a target.");
================
Comment at: unittests/Target/Hexagon/HexagonMCCodeEmitterTest.cpp:24
@@ +23,3 @@
+ assert(Target != nullptr);
+ assert(error.empty());
+ RegisterInfo = Target->createMCRegInfo(Triple);
----------------
Please use the
assert(cond && "msg");
style.
Many more instances below.
http://reviews.llvm.org/D5523
More information about the llvm-commits
mailing list