[PATCH] D24317: Emit S_COMPILE3 CodeView record

Adrian McCarthy via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 15:27:55 PDT 2016


amccarth added a comment.

In https://reviews.llvm.org/D24317#536408, @majnemer wrote:

> Forgive my naïveté but under what circumstance does the debugger need to know C vs C++ vs whatever?


It may not _need_ to know, but the Visual Studio debugger does _display_ the source language in places like the call stack.  I suppose the source language might be used in evaluating Watch expressions.


================
Comment at: lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:542-543
@@ +541,4 @@
+      .Case("pentium4", CPUType::Pentium3)
+      .Case("sandybridge", CPUType::Ia64)
+      .Case("haswell", CPUType::Ia64_2)
+      .Case("i686", CPUType::PentiumPro)
----------------
majnemer wrote:
> This shouldn't map to IA64, that would be Itanium. It's also not correct to map it to X64 because it could be 32-bit sandybridge.
> 
> Does MSVC actually change what it sticks in here depending on /arch? If not, I'd just use the ArchType from the Triple to reconstruct this info.
OK, I'll try to fix that up.  I was mostly relying on Wikipedia to figure out how the architectures mapped.  I guess I misunderstood what I read.

> Does MSVC actually change what it sticks in here depending on /arch? If not, I'd just use the ArchType from the Triple to reconstruct this info.

I don't know how MSVC chooses what goes here.  I'll experiment.

It does appear, however, that clang-cl chooses one of these architectures for the triple based on /arch, so I figured these were the important ones to map back into the CodeView type.

================
Comment at: lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:593
@@ +592,3 @@
+  StringRef Triple = Asm->getTargetTriple();
+  StringRef CPUName = Triple.take_front(Triple.find("-"));
+  CPUType CPU = MapCPUtoCVCPU(CPUName);
----------------
majnemer wrote:
> Using the triple for this looks weird.  I'd grab the cpu name from the TM via `Asm->TM.getTargetCPU()`
Thanks!  I was looking for something like that but had failed to find it.

I had tried `Asm->TM.getMCSubtargetInfo()->getCPU();`, but that asserted.


https://reviews.llvm.org/D24317





More information about the llvm-commits mailing list