[llvm-commits] [dragonegg] r102900 - in /dragonegg/trunk: bits_and_bobs.cpp bits_and_bobs.h llvm-backend.cpp llvm-convert.cpp llvm-debug.cpp llvm-internal.h llvm-types.cpp
Duncan Sands
baldrick at free.fr
Mon May 3 05:21:54 PDT 2010
Author: baldrick
Date: Mon May 3 07:21:53 2010
New Revision: 102900
URL: http://llvm.org/viewvc/llvm-project?rev=102900&view=rev
Log:
Create a place for installing language specific configuration
settings. Use it to set flag_odr for C++.
Removed:
dragonegg/trunk/bits_and_bobs.h
Modified:
dragonegg/trunk/bits_and_bobs.cpp
dragonegg/trunk/llvm-backend.cpp
dragonegg/trunk/llvm-convert.cpp
dragonegg/trunk/llvm-debug.cpp
dragonegg/trunk/llvm-internal.h
dragonegg/trunk/llvm-types.cpp
Modified: dragonegg/trunk/bits_and_bobs.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/bits_and_bobs.cpp?rev=102900&r1=102899&r2=102900&view=diff
==============================================================================
--- dragonegg/trunk/bits_and_bobs.cpp (original)
+++ dragonegg/trunk/bits_and_bobs.cpp Mon May 3 07:21:53 2010
@@ -1,7 +1,5 @@
#include <stdlib.h>
-bool flag_odr = false;
-
int ix86_regparm;
union tree_node;
Removed: dragonegg/trunk/bits_and_bobs.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/bits_and_bobs.h?rev=102899&view=auto
==============================================================================
--- dragonegg/trunk/bits_and_bobs.h (original)
+++ dragonegg/trunk/bits_and_bobs.h (removed)
@@ -1,7 +0,0 @@
-// Place to keep various things that will need to be sorted out someday.
-#ifndef BITS_AND_BOBS_H
-#define BITS_AND_BOBS_H
-
-extern bool flag_odr;
-
-#endif
Modified: dragonegg/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=102900&r1=102899&r2=102900&view=diff
==============================================================================
--- dragonegg/trunk/llvm-backend.cpp (original)
+++ dragonegg/trunk/llvm-backend.cpp Mon May 3 07:21:53 2010
@@ -88,7 +88,6 @@
#include "llvm-debug.h"
#include "llvm-target.h"
#include "llvm-os.h"
-#include "bits_and_bobs.h"
extern "C" {
#include "llvm-cache.h"
}
@@ -514,6 +513,32 @@
getStringRepresentation());
}
+/// flag_odr - Whether the language being compiled obeys the One Definition Rule
+/// (i.e. if the same function is defined in multiple compilation units, all the
+/// definitions are equivalent).
+bool flag_odr;
+
+/// InstallLanguageSettings - Do any language-specific back-end configuration.
+static void InstallLanguageSettings() {
+ // The principal here is that not doing any language-specific configuration
+ // should still result in correct code. The language-specific settings are
+ // only for obtaining better code, but exploiting language-specific features.
+ StringRef LanguageName = lang_hooks.name;
+
+ if (LanguageName == "GNU Ada") {
+ flag_odr = true; // Ada obeys the one-definition-rule.
+ } else if (LanguageName == "GNU C") {
+ } else if (LanguageName == "GNU C++") {
+ flag_odr = true; // C++ obeys the one-definition-rule.
+ } else if (LanguageName == "GNU Fortran") {
+ } else if (LanguageName == "GNU GIMPLE") { // LTO gold plugin.
+ } else if (LanguageName == "GNU Java") {
+ } else if (LanguageName == "GNU Objective-C") {
+ } else if (LanguageName == "GNU Objective-C++") {
+ flag_odr = true; // Objective C++ obeys the one-definition-rule.
+ }
+}
+
/// InitializeBackend - Initialize the GCC to LLVM conversion machinery.
/// Can safely be called multiple times.
static void InitializeBackend(void) {
@@ -539,6 +564,9 @@
if (TheDebugInfo)
TheDebugInfo->Initialize();
+ // Perform language specific configuration.
+ InstallLanguageSettings();
+
Initialized = true;
}
Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=102900&r1=102899&r2=102900&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Mon May 3 07:21:53 2010
@@ -84,7 +84,6 @@
#include "llvm-abi.h"
#include "llvm-internal.h"
#include "llvm-debug.h"
-#include "bits_and_bobs.h"
static LLVMContext &Context = getGlobalContext();
Modified: dragonegg/trunk/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-debug.cpp?rev=102900&r1=102899&r2=102900&view=diff
==============================================================================
--- dragonegg/trunk/llvm-debug.cpp (original)
+++ dragonegg/trunk/llvm-debug.cpp Mon May 3 07:21:53 2010
@@ -59,7 +59,6 @@
#include "llvm-abi.h"
#include "llvm-debug.h"
#include "llvm-internal.h"
-#include "bits_and_bobs.h"
using namespace llvm;
using namespace llvm::dwarf;
Modified: dragonegg/trunk/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-internal.h?rev=102900&r1=102899&r2=102900&view=diff
==============================================================================
--- dragonegg/trunk/llvm-internal.h (original)
+++ dragonegg/trunk/llvm-internal.h Mon May 3 07:21:53 2010
@@ -87,6 +87,11 @@
/// getTargetData - Return the current TargetData object from TheTarget.
const TargetData &getTargetData();
+/// flag_odr - Whether the language being compiled obeys the One Definition Rule
+/// (i.e. if the same function is defined in multiple compilation units, all the
+/// definitions are equivalent).
+extern bool flag_odr;
+
/// AttributeUsedGlobals - The list of globals that are marked attribute(used).
extern SmallSetVector<Constant *,32> AttributeUsedGlobals;
Modified: dragonegg/trunk/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-types.cpp?rev=102900&r1=102899&r2=102900&view=diff
==============================================================================
--- dragonegg/trunk/llvm-types.cpp (original)
+++ dragonegg/trunk/llvm-types.cpp Mon May 3 07:21:53 2010
@@ -56,7 +56,6 @@
extern "C" {
#include "llvm-cache.h"
}
-#include "bits_and_bobs.h"
static LLVMContext &Context = getGlobalContext();
More information about the llvm-commits
mailing list