Page MenuHomePhabricator

[ARM] Emit error when ARM exec mode is not available.

Authored by fhahn on Jul 19 2017, 9:12 AM.



A similar error message has been removed from the ARMTargetMachineBase
constructor in r306939. With this patch, we generate an error message
for the example below, compiled with -mcpu=cortex-m0, which does not
have ARM execution mode.

__attribute__((target("arm"))) int foo(int a, int b)
    return a + b % a;

__attribute__((target("thumb"))) int bar(int a, int b)
    return a + b % a;

By adding this error message to ARMBaseTargetMachine::getSubtargetImpl,
we can deal with functions that set -thumb-mode in target-features.
At the moment it seems like Clang does not have access to target-feature
specific information, so adding the error message to the frontend will
be harder.

Diff Detail

Event Timeline

fhahn created this revision.Jul 19 2017, 9:12 AM

Even if clang eventually starts generating its own error message, we should still generate an error in the backend: we shouldn't crash on invalid bitcode files.


Do you need "not" here? I thought we only check the return code for the last program in the pipe.

fhahn retitled this revision from [ARM] Remove FeatureNoARM implies ModeThumb. to [ARM] Add fatal error when ARM exec mode is not available..Jul 19 2017, 12:06 PM
fhahn edited the summary of this revision. (Show Details)

Updated title


It seems like the return code of the first program is also checked. WIthout not, the test fails when run through lit.

efriedma accepted this revision.Jul 19 2017, 12:23 PM



Hmm, okay, that's fine then.

This revision is now accepted and ready to land.Jul 19 2017, 12:23 PM
echristo accepted this revision.Jul 21 2017, 5:10 PM
fhahn updated this revision to Diff 108929.Jul 31 2017, 8:17 AM
fhahn retitled this revision from [ARM] Add fatal error when ARM exec mode is not available. to [ARM] Emit error when ARM exec mode is not available..

Updated to use LLVMContext::emitError instead of fatal error. Before committing D35569 needs to land, otherwise the second invocation of in the test will not produce errors.

echristo accepted this revision.Jul 31 2017, 2:04 PM


fhahn closed this revision.Aug 9 2017, 8:39 AM